[gold patch committed] Fix x86/x86_64 TLSDESC with -z relro

Ian Lance Taylor iant@google.com
Mon Aug 2 10:09:00 GMT 2010


The TLSDESC relocations used with -mtls-dialect=gnu2 did not work in
gold when using -z relro.  The problem was that the GOT entries were
created in the regular .got section, which, when using -z relro, is
marked read-only after relocations are complete.  The TLSDESC
relocations are resolved lazily, so attempting to set them while the
program was running failed.  I committed this path to fix the problem by
moving the GOT entries into the .got.plt section.

Ian

2010-08-02  Ian Lance Taylor  <iant@google.com>

	* i386.cc (class Target_i386): Add got_tlsdesc_ field.
	(Target_i386::Target_i386):: Initialize got_tlsdesc_.
	(Target_i386::got_tlsdesc_section): New function.
	(Target_i386::got_section): Create space for GOT entries for
	TLSDESC relocations.
	(Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
	R_386_TLS_GOTDESC.
	(Target_i386::Scan::global): Likewise.
	(Target_i386::Relocate::relocate_tls): Adjust GOT offset when
	using TLSDESC GOT.
	* x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
	(Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
	(Target_x86_64::got_tlsdesc_section): New function.
	(Target_x86_64::got_section): Create space for GOT entries for
	TLSDESC relocations.
	(Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
	R_386_TLS_GOTDESC.
	(Target_x86_64::Scan::global): Likewise.
	(Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
	using TLSDESC GOT.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: foo.patch
Type: text/x-diff
Size: 11715 bytes
Desc: TLSDESC
URL: <https://sourceware.org/pipermail/binutils/attachments/20100802/f54e98b3/attachment.bin>


More information about the Binutils mailing list