This patch fixes the wrong .tbss segment size generated for cases 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
This issue is at 'lib/ReaderWriter/ELF/SegmentChunks.cpp' where
Segment<ELFT>::assignVirtualAddress is setting wrong slice values, not taking care
of although tbss segments file size does noy play role in other segment virtual
address placement, its size should still be considered.