Summary: | Gold generates odd MemSiz for TLS segment | ||
---|---|---|---|
Product: | binutils | Reporter: | H.J. Lu <hjl.tools> |
Component: | gold | Assignee: | Cary Coutant <ccoutant> |
Status: | REOPENED --- | ||
Severity: | normal | CC: | ccoutant |
Priority: | P2 | ||
Version: | 2.25 | ||
Target Milestone: | --- | ||
Host: | Target: | ||
Build: | Last reconfirmed: | ||
Attachments: | x86-64 foo.o |
Description
H.J. Lu
2013-12-11 20:40:03 UTC
I tried your test case and got: Program Headers: Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align PHDR 0x000040 0x0000000000000040 0x0000000000000040 0x000188 0x000188 R 0x8 LOAD 0x000000 0x0000000000000000 0x0000000000000000 0x000330 0x000330 R E 0x1000 LOAD 0x000ea0 0x0000000000001ea0 0x0000000000001ea0 0x000168 0x000168 RW 0x1000 DYNAMIC 0x000f08 0x0000000000001f08 0x0000000000001f08 0x0000f0 0x0000f0 RW 0x8 GNU_STACK 0x000000 0x0000000000000000 0x0000000000000000 0x000000 0x000000 RW 0 TLS 0x000ea0 0x0000000000001ea0 0x0000000000001ea0 0x00002c 0x00002c R 0x4 GNU_RELRO 0x000ea0 0x0000000000001ea0 0x0000000000001ea0 0x000160 0x000160 RW 0x20 The TLS segment has FileSiz and MemSiz both set to 0x2c. Created attachment 7561 [details] x86-64 foo.o As of GNU gold (GNU Binutils 2.24.51.20140425) 1.11, I still got: [hjl@gnu-6 pr16320]$ ./ld.gold -shared -z relro -o libx.so foo.o [hjl@gnu-6 pr16320]$ readelf -lW libx.so | grep TLS TLS 0x000f20 0x0000000000001f20 0x0000000000001f20 0x00002c 0x000030 R 0x10 [hjl@gnu-6 pr16320]$ I still got the same result with the uploaded foo.o In your case, the alignment specified for the TLS segment was 0x10. Gold explicitly pads the TLS segment to a multiple of the alignment. |