PATCH COMMITTED: Fix debug info for TLS variables
Ian Lance Taylor
iant@google.com
Fri May 16 21:01:00 GMT 2008
gold was generating incorrect debug information for TLS variables.
The debug information for TLS variables uses the same relocation types
as for code. The problem is that in some cases we can optimize the
code relocations, but we must never optimized the debug relocations.
I committed this patch to fix the problem for i386 and x86_64. This
looks at the preceding relocations to see whether it can optimize the
relocations. If there is no relocation to get the address of the TLS
block, then we assume that we are not in a regular code section, and
we should not optimize the relocation.
I don't know whether this problem occurs on SPARC.
I also don't know how to write a good test case for this. It's easy
to see if you run gdb--just try to print the value of a TLS variable
defined in an object which is linked into an executable. Any
suggestions for a way to test for this without running gdb?
Ian
2008-05-16 Ian Lance Taylor <iant@google.com>
* i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
know the dynamic type.
* x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
field. Initialize it in constructor.
(Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
reloc.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: foo.patch
Type: text/x-patch
Size: 4112 bytes
Desc: Fix debug info for TLS variables
URL: <https://sourceware.org/pipermail/binutils/attachments/20080516/7f74a3ae/attachment.bin>
More information about the Binutils
mailing list