eddyz87 added a comment.
As an additional data point, the same example but w/o section specification
compiles fine:
const int with_init = 1;
const int no_init;
And puts both globals to the same section:
$ clang -c t.c -o - | llvm-readelf --section-headers -s -
Section Headers:
[Nr] Name Type Address Off Size ES
Flg Lk Inf Al
...
[ 3] .rodata PROGBITS 0000000000000000 000040 000008 00
A 0 0 4
...
Symbol table '.symtab' contains 4 entries:
Num: Value Size Type Bind Vis Ndx Name
...
2: 0000000000000000 4 OBJECT GLOBAL DEFAULT 3 with_init
3: 0000000000000004 4 OBJECT GLOBAL DEFAULT 3 no_init
(`Ndx` stands for section `Nr`).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D156726/new/
https://reviews.llvm.org/D156726
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits