[llvm-dev] what does read-only data section consist?

慕冬亮 via llvm-dev llvm-dev at lists.llvm.org
Mon Oct 19 01:19:23 PDT 2015


In C language programming, which content of variable will store in
read-only data section?

void func( int i ){
    printf("%d\n", i);
}

int main()
{
    const str = "const string";
    int b;

    func(b);
    return 0;
}

Look at the program before, what, I already know, will be stored in
read-only data section is constant string like "const str = "const
string"", jump table(switch ... case), printf/scanf fomat string like
"%d\n".

What do I miss? And for a ordinary application, what's the size of
read-only data section?
Is there any difference between GCC with LLVM about the content of
read-only data section?

Thanks in advance.
    - mudongliang


More information about the llvm-dev mailing list