summaryrefslogtreecommitdiff
path: root/ld/testsuite/ld-i386/pr19609-1e.d
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2016-02-10 15:12:27 -0800
committerH.J. Lu <hjl.tools@gmail.com>2016-02-25 10:24:22 -0800
commit448207b5eb92770cb8471a6e668bb711dbe7c558 (patch)
treea47e9370df2dbc4f40d324e4f5b3e202a7f0a484 /ld/testsuite/ld-i386/pr19609-1e.d
parenta3a5e04ffbea45a1a8833efef68f9b6a12e9736e (diff)
downloadbinutils-gdb-users/hjl/pr19609/master.tar.gz
Optimize x86 GOT32X/GOTPCRELX relocationsusers/hjl/pr19609/master
R_386_GOT32X, R_X86_64_GOTPCRELX and R_X86_64_REX_GOTPCRELX relocations retrieve the symbol address via its GOT slot. If the symbol address is known at the link-time, we can use it directly by changing instruction encoding. Indirect branch can only be converted to PC relative direct branch. MOV can be changed to LEA or encoded differently with signed address. The subset of binary operations can be encoded only with signed address. If undefined weak symbol is resolved to zero link-time, we can use it as address. Zero addresss can't used with PC relative direct branch when PIC is true since the current PC is unknown. In 64-bit, 32-bit relocation for PC relatiave direct branch to zero may also overflow. If this transformation causes relocation overflow, --no-relax can be used to avoid it. bfd/ PR ld/19609 * elf32-i386.c (elf_i386_convert_load): Convert to R_386_32 for load with locally bound symbols if PIC is false or there is no base register. Optimize branch to 0 if PIC is false. (elf_i386_relocate_section): Don't generate dynamic relocations against undefined weak symbols if PIC is false. * elf64-x86-64.c (elf_x86_64_convert_load): Disable optimization if we can't estimate relocation overflow with --no-relax. Convert to R_X86_64_32S/R_X86_64_32 for load with locally bound symbols if PIC is false. Optimize branch to 0 if PIC is false. (elf_x86_64_relocate_section): Don't generate dynamic relocations against undefined weak symbols if PIC is false. ld/ PR ld/19609 * testsuite/ld-i386/got1.dd: Updated. * testsuite/ld-i386/lea1c.d: Likewise. * testsuite/ld-i386/load1-nacl.d: Likewise. * testsuite/ld-i386/load1.d: Likewise. * testsuite/ld-i386/load4b.d: Likewise. * testsuite/ld-i386/load5b.d: Likewise. * testsuite/ld-i386/mov1b.d: Likewise. * testsuite/ld-x86-64/mov1b.d: Likewise. * testsuite/ld-x86-64/mov1d.d: Likewise. * testsuite/ld-ifunc/ifunc-21-i386.d: Likewise. * testsuite/ld-ifunc/ifunc-21-x86-64.d: Likewise. * testsuite/ld-ifunc/ifunc-22-i386.d: Likewise. * testsuite/ld-ifunc/ifunc-22-x86-64.d: Likewise. * testsuite/ld-x86-64/gotpcrel1.dd: Likewise. * testsuite/ld-x86-64/lea1a.d: Likewise. * testsuite/ld-x86-64/lea1b.d: Likewise. * testsuite/ld-x86-64/lea1c.d: Likewise. * testsuite/ld-x86-64/lea1d.d: Likewise. * testsuite/ld-x86-64/lea1e.d: Likewise. * testsuite/ld-x86-64/lea1f.d: Likewise. * testsuite/ld-x86-64/mov1b.d: Likewise. * testsuite/ld-x86-64/mov1d.d: Likewise. * testsuite/ld-x86-64/pr13082-3b.d: Likewise. * testsuite/ld-x86-64/pr13082-4b.d: Likewise. * testsuite/ld-x86-64/lea1.s: Add tests for 32-bit registers. * testsuite/ld-i386/pr19609-1.s: New file. * testsuite/ld-i386/pr19609-1a.d: Likewise. * testsuite/ld-i386/pr19609-1b.d: Likewise. * testsuite/ld-i386/pr19609-1c.d: Likewise. * testsuite/ld-i386/pr19609-1d.d: Likewise. * testsuite/ld-i386/pr19609-1e.d: Likewise. * testsuite/ld-i386/pr19609-1f.d: Likewise. * testsuite/ld-i386/pr19609-1g.d: Likewise. * testsuite/ld-i386/pr19609-1h.d: Likewise. * testsuite/ld-i386/pr19609-1i.d: Likewise. * testsuite/ld-i386/pr19609-2.s: Likewise. * testsuite/ld-i386/pr19609-2a.d: Likewise. * testsuite/ld-i386/pr19609-2b.d: Likewise. * testsuite/ld-i386/pr19609-2c.d: Likewise. * testsuite/ld-i386/undefweak.s: Likewise. * testsuite/ld-i386/undefweaka.d: Likewise. * testsuite/ld-i386/undefweakb.d: Likewise. * testsuite/ld-x86-64/pr13082-3c.d: Likewise. * testsuite/ld-x86-64/pr13082-3d.d: Likewise. * testsuite/ld-x86-64/pr19609-1.s: Likewise. * testsuite/ld-x86-64/pr19609-1a.d: Likewise. * testsuite/ld-x86-64/pr19609-1b.d: Likewise. * testsuite/ld-x86-64/pr19609-1c.d: Likewise. * testsuite/ld-x86-64/pr19609-1d.d: Likewise. * testsuite/ld-x86-64/pr19609-1e.d: Likewise. * testsuite/ld-x86-64/pr19609-1f.d: Likewise. * testsuite/ld-x86-64/pr19609-1g.d: Likewise. * testsuite/ld-x86-64/pr19609-1h.d: Likewise. * testsuite/ld-x86-64/pr19609-1i.d: Likewise. * testsuite/ld-x86-64/pr19609-1j.d: Likewise. * testsuite/ld-x86-64/pr19609-1k.d: Likewise. * testsuite/ld-x86-64/pr19609-1l.d: Likewise. * testsuite/ld-x86-64/pr19609-1m.d: Likewise. * testsuite/ld-x86-64/pr19609-2.s: Likewise. * testsuite/ld-x86-64/pr19609-2a.d: Likewise. * testsuite/ld-x86-64/pr19609-2b.d: Likewise. * testsuite/ld-x86-64/pr19609-2c.d: Likewise. * testsuite/ld-x86-64/pr19609-2d.d: Likewise. * testsuite/ld-x86-64/pr19609-3.s: Likewise. * testsuite/ld-x86-64/pr19609-3a.d: Likewise. * testsuite/ld-x86-64/pr19609-3b.d: Likewise. * testsuite/ld-x86-64/pr19609-4.s: Likewise. * testsuite/ld-x86-64/pr19609-4a.d: Likewise. * testsuite/ld-x86-64/pr19609-4b.d: Likewise. * testsuite/ld-x86-64/pr19609-4c.d: Likewise. * testsuite/ld-x86-64/pr19609-4d.d: Likewise. * testsuite/ld-x86-64/pr19609-4e.d: Likewise. * testsuite/ld-x86-64/pr19609-5.s: Likewise. * testsuite/ld-x86-64/pr19609-5a.d: Likewise. * testsuite/ld-x86-64/pr19609-5b.d: Likewise. * testsuite/ld-x86-64/pr19609-5c.d: Likewise. * testsuite/ld-x86-64/pr19609-5d.d: Likewise. * testsuite/ld-x86-64/pr19609-5e.d: Likewise. * testsuite/ld-i386/i386.exp: Run undefweak tests and tests for PR ld/19609. * testsuite/ld-x86-64/x86-64.exp: Run pr13082-3c, pr13082-3d and tests for PR ld/19609.
Diffstat (limited to 'ld/testsuite/ld-i386/pr19609-1e.d')
-rw-r--r--ld/testsuite/ld-i386/pr19609-1e.d17
1 files changed, 17 insertions, 0 deletions
diff --git a/ld/testsuite/ld-i386/pr19609-1e.d b/ld/testsuite/ld-i386/pr19609-1e.d
new file mode 100644
index 00000000000..a515ad6c897
--- /dev/null
+++ b/ld/testsuite/ld-i386/pr19609-1e.d
@@ -0,0 +1,17 @@
+#source: pr19609-1.s
+#as: --32 -mrelax-relocations=yes
+#ld: -shared -E -Bsymbolic -melf_i386
+#objdump: -dw
+
+.*: +file format .*
+
+
+Disassembly of section .text:
+
+[a-f0-9]+ <_start>:
+[ ]*[a-f0-9]+: 3b 82 fc ff ff ff cmp -0x4\(%edx\),%eax
+[ ]*[a-f0-9]+: 3b 8a fc ff ff ff cmp -0x4\(%edx\),%ecx
+[ ]*[a-f0-9]+: 8b 82 fc ff ff ff mov -0x4\(%edx\),%eax
+[ ]*[a-f0-9]+: 8b 8a fc ff ff ff mov -0x4\(%edx\),%ecx
+[ ]*[a-f0-9]+: 85 82 fc ff ff ff test %eax,-0x4\(%edx\)
+[ ]*[a-f0-9]+: 85 8a fc ff ff ff test %ecx,-0x4\(%edx\)