[PATCH] D156726: Make globals with mutable members non-constant, even in custom sections
David Blaikie via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Aug 16 12:37:44 PDT 2023
dblaikie added a comment.
In D156726#4591543 <https://reviews.llvm.org/D156726#4591543>, @eddyz87 wrote:
> 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`).
Thanks for the details - looking into it!
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D156726/new/
https://reviews.llvm.org/D156726
More information about the cfe-commits
mailing list