[LLVMdev] [lld] TBSS wrong size
Shankar Easwaram
shankarke at gmail.com
Tue Jun 2 17:14:23 PDT 2015
Are you saying it generates wrong section size? Tbss is very special and I checked the behavior on X86_64 to model it. It does not account for virtual address increase as libc allocates it.
> On Jun 2, 2015, at 17:20, Adhemerval Zanella <adhemerval.zanella at linaro.org> wrote:
>
> Hi,
>
> I am tracking some TLS issues with lld and found that it is
> generating wrong tbss size for case where multiple modules
> have non initialized threads variables. For instance:
>
> -- t0.c --
>
> __thread int x0;
> __thread int x1;
> __thread int x2;
>
> extern __thread int e0;
> extern __thread int e1;
> extern __thread int e2;
> extern __thread int e3;
>
> int foo0 ()
> {
> return x0;
> }
>
> int main ()
> {
> return x0;
> }
>
> -- t1.c --
>
> __thread int e0;
> __thread int e1;
> __thread int e2;
> __thread int e3;
>
> ---
>
> lld is generating (for aarch64):
>
> [14] .tbss NOBITS 0000000000401000 00001000
> 0000000000000010 0000000000000000 WAT 0 0 4
>
> Where is just taking in consideration the largest tbss segment, not all
> from all objects. ld generates a correct output:
>
> [17] .tbss NOBITS 0000000000410dec 00000dec
> 000000000000001c 0000000000000000 WAT 0 0 4
>
> My initial idea is that 'lib/ReaderWriter/ELF/SegmentChunks.cpp' /
> Segment<ELFT>::assignVirtualAddress is setting wrong slice values, however
> playing with this I could not find a correct logic to handle the TBSS.
>
> Any ideas where lld is possible messing the TBSS segments sizes?
More information about the llvm-dev
mailing list