[llvm-dev] why do undefined globals end up in .data instead of .bss?

Andrew Kelley via llvm-dev llvm-dev at lists.llvm.org
Sun Apr 23 10:10:51 PDT 2017


Here is a module:

@vals = internal unnamed_addr global [20000000 x i32] undef, align 4

When I compile it into an .o file:

$ clang -c test.ll
$ objdump -t test.o

test.o:     file format elf64-x86-64

SYMBOL TABLE:
0000000000000000 l    df *ABS* 0000000000000000 test.ll
0000000000000000 l     O .data 0000000004c4b400 vals


LLVM puts the global in the .data section, and results in a 77MB .o file of
mostly zeroes. Why does this variable not go in the .bss section?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170423/db0314d5/attachment.html>


More information about the llvm-dev mailing list