[AArch64] Fix the creation of .got and _GLOBAL_OFFSET_TABLE_ placement.

Marcus Shawcroft marcus.shawcroft@arm.com
Mon Jul 1 16:44:00 GMT 2013


Hi,

My recent patch: http://sourceware.org/ml/binutils/2013-06/msg00248.html 
to place &_DYNAMIC in .got[0] instead of .gotplt[0] exposes an issue in 
the placement of the _GLOBAL_OFFSET_TABLE_ symbol.

The AArch64 back end has code in elfNN_aarch64_create_dynamic_sections 
to place _GLOBAL_OFFSET_TABLE_ at got[0].  However, the .got section is 
initially created by a call to the generic _bfd_elf_create_got_section 
which contains code to place the symbol at gotplt[0].  The overall 
effect is that the symbol placement changes dependent on whether 
elfNN_aarch64_create_dynamic_sections is called for an object.

This patch follows the MIPs approach and defines a target specific 
alternative to _bfd_elf_create_got_section and drops the bogus code from 
elfNN_aarch64_create_dynamic_sections.

Regressed on aarch64-none-linux-gnu.

/Marcus

2013-07-01  Marcus Shawcroft  <marcus.shawcroft@arm.com>

	* elfnn-aarch64.c (aarch64_elf_create_got_section): New.
	(elfNN_aarch64_check_relocs): Use aarch64_elf_create_got_section.
	(elfNN_aarch64_create_dynamic_sections): Do not define
	_GLOBAL_OFFSET_TABLE_; call aarch64_elf_create_got_section.

/ld/testsuite/ChangeLog

2013-07-01  Marcus Shawcroft  <marcus.shawcroft@arm.com>


	* ld-aarch64/gc-plt-relocs.d: Adjust expected .got offsets.
	* ld-aarch64/tls-desc-ie.d: Likewise.
	* ld-aarch64/emit-relocs-311.d: Adjust expected	symbol.
	* ld-aarch64/tls-relax-all.d: Likewise.
	* ld-aarch64/tls-relax-gd-ie.d: Likewise.
	* ld-aarch64/tls-relax-gdesc-ie.d: Likewise.
	* ld-aarch64/tls-relax-gdesc-ie-2.d: Likewise.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bfd-fix-.got-creation.diff
Type: text/x-patch
Size: 9211 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20130701/4340e19a/attachment.bin>


More information about the Binutils mailing list