old-cross-binutils/ld/testsuite
H.J. Lu 02e2aef89b Optimize R_386_GOT32/R_386_GOT32X only if addend is 0
Linker can't optimize R_386_GOT32 and R_386_GOT32X relocations if addend
isn't 0.  It isn't valid to convert

movl	foo@GOT+1(%ecx), %eax

to

leal	foo@GOTOFF+1(%ecx), %eax

nor to convert

movq	foo@GOTPCREL+1(%rip), %rax

to

leaq	foo(%rip), %rax

for x86-64.  We should check if addend is 0 before optimizing R_386_GOT32
and R_386_GOT32X relocations.  Testcases are added for i386 and x86-64.

bfd/

	* elf32-i386.c (elf_i386_convert_load): Skip if addend isn't 0.
	(elf_i386_relocate_section): Skip R_386_GOT32X optimization if
	addend isn't 0.

ld/testsuite/

	* ld-i386/i386.exp: Run mov2a, mov2b and mov3.
	* ld-i386/mov2.s: New file.
	* ld-i386/mov2a.d: Likewise.
	* ld-i386/mov2b.d: Likewise.
	* ld-i386/mov3.d: Likewise.
	* ld-i386/mov3.s: Likewise.
	* ld-x86-64/mov2.s: Likewise.
	* ld-x86-64/mov2a.d: Likewise.
	* ld-x86-64/mov2b.d: Likewise.
	* ld-x86-64/mov2c.d: Likewise.
	* ld-x86-64/mov2d.d: Likewise.
	* ld-x86-64/x86-64.exp: Run mov2a, mov2b, mov2c and mov2d.
2015-12-04 09:03:04 -08:00
..
config objcopy --extract-symbol testcase 2015-10-15 23:38:29 +10:30
ld-aarch64 Revert "[LD][AARCH64]Add TLSIE relaxation support under large memory model." 2015-11-12 15:16:40 +00:00
ld-alpha
ld-arm Add --fix-stm32l4xx-629360 to the ARM linker to enable a link-time workaround for a bug in the bus matrix / memory controller for some of the STM32 Cortex-M4 based products (STM32L4xx). 2015-10-27 13:20:33 +00:00
ld-auto-import
ld-avr Define DIFF_EXPR_OK for avr target to allow PC relative difference relocation. 2015-07-08 21:41:52 +03:00
ld-bootstrap
ld-cdtest
ld-checks
ld-cris
ld-crx
ld-cygwin
ld-d10v
ld-discard
ld-elf Add test to ensure that ternary linker script operators copy symbol flags. 2015-10-19 14:32:54 +01:00
ld-elfcomm
ld-elfvers Pass $PLT_CFLAGS to build_binary 2015-07-27 05:13:55 -07:00
ld-elfvsb Pass $PLT_CFLAGS to ld_compile 2015-07-27 05:15:01 -07:00
ld-elfweak
ld-fastcall
ld-frv
ld-gc xfail pr19161 test on hppa-linux 2015-10-27 18:09:21 +10:30
ld-h8300
ld-i386 Optimize R_386_GOT32/R_386_GOT32X only if addend is 0 2015-12-04 09:03:04 -08:00
ld-ia64
ld-ifunc Add R_X86_64_[REX_]GOTPCRELX support to gas and ld 2015-10-22 04:49:38 -07:00
ld-libs
ld-linkonce
ld-m68hc11
ld-m68k
ld-mep
ld-metag
ld-mips-elf 2015-10-29 Catherine Moore <clm@codesourcery.com> 2015-10-29 06:58:16 -07:00
ld-misc
ld-mmix Update .strtab section sizes in mmix tests 2015-06-25 10:07:53 -07:00
ld-mn10300
ld-nds32
ld-nios2 Add Nios II arch flags and compatibility tests 2015-07-01 15:55:28 -07:00
ld-pe Fix building PE test executables in environments where $CFLAGS is needed. 2015-05-29 11:51:41 +01:00
ld-pie
ld-plugin Add "ld -r" tests for PR ld/15323 2015-09-11 10:02:57 -07:00
ld-powerpc Add assembler, disassembler and linker support for power9. 2015-11-11 19:52:52 -06:00
ld-s390 S/390: Fix gotreloc_31-1 testcase. 2015-04-27 10:24:24 +02:00
ld-scripts Allow mmix-knuth-mmixware adjustments to objcopy --extract-symbols test. 2015-10-22 16:16:09 +02:00
ld-selective
ld-sh Don't hardcode offset of .shstrtab section 2015-04-20 09:55:47 -07:00
ld-shared Pass $PLT_CFLAGS to ld_compile 2015-07-27 05:17:26 -07:00
ld-size Move run-time support check for size relocation 2015-07-29 10:52:38 -07:00
ld-sparc
ld-spu
ld-srec Append $PLT_CFLAGS to CC/CXX for S-records tests 2015-07-27 05:18:20 -07:00
ld-tic6x Don't hardcode offset of .shstrtab section 2015-04-20 09:55:47 -07:00
ld-tilegx
ld-tilepro
ld-undefined ld: Add '--require-defined' command line option. 2015-08-04 10:00:05 +01:00
ld-unique
ld-v850
ld-vax-elf
ld-versados
ld-visium
ld-vxworks
ld-x86-64 Optimize R_386_GOT32/R_386_GOT32X only if addend is 0 2015-12-04 09:03:04 -08:00
ld-xc16x
ld-xstormy16
ld-xtensa Update xtensa linker tests 2015-06-27 16:25:34 -07:00
lib Skip IFUNC relocations in debug sections 2015-08-11 12:59:11 -07:00
ChangeLog Optimize R_386_GOT32/R_386_GOT32X only if addend is 0 2015-12-04 09:03:04 -08:00
ChangeLog-2004
ChangeLog-2005
ChangeLog-2006
ChangeLog-2007
ChangeLog-2008
ChangeLog-2009
ChangeLog-2010
ChangeLog-2011
ChangeLog-2012
ChangeLog-2013
ChangeLog-2014
ChangeLog-9303