aboutsummaryrefslogtreecommitdiff
path: root/ld
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2016-02-03 08:25:15 -0800
committerH.J. Lu <hjl.tools@gmail.com>2016-02-03 08:25:15 -0800
commit0cb4071ef9e10f703220f5e731141bf438aca16e (patch)
tree273468cc997e953c37aff7edc3179a716ff3e372 /ld
parent3d8efabf21cfeb2f6244fadcf915da4c7f51ed6f (diff)
downloadgdb-0cb4071ef9e10f703220f5e731141bf438aca16e.zip
gdb-0cb4071ef9e10f703220f5e731141bf438aca16e.tar.gz
gdb-0cb4071ef9e10f703220f5e731141bf438aca16e.tar.bz2
Add -mrelax-relocations= to x86 assembler
The x86 relax relocations introduced in binutils 2.26 aren't supported by linker on Solaris older than Solaris 12. To use x86 assembler with older Solaris linker, this patch adds 1. A command line option -mrelax-relocations= to x86 assembler to control whether to generate relax relocations. 2. A configure option --enable-x86-relax-relocations to decide whether x86 assembler should generate relax relocations by default. It is defaulted to yes, except for x86 Solaris targets older than Solaris 12. gas/ PR gas/19520 * NEWS: Mention new command line option -mrelax-relocations and new configure option --enable-x86-relax-relocations for x86 target. * config.in: Regenerated. * configure.ac: Add --enable-x86-relax-relocations. (ac_default_x86_relax_relocations): New. Default to 1 except for x86 Solaris targets older than Solaris 12. (DEFAULT_GENERATE_X86_RELAX_RELOCATIONS): Define. * configure: Likewise. * config/tc-i386.c (generate_relax_relocations): New. (OPTION_MRELAX_RELOCATIONS): Likewise. (output_disp): Don't generate relax relocations if generate_relax_relocations is 0. (md_longopts): Add -mrelax-relocations. (md_show_usage): Likewise. (md_parse_option): Handle OPTION_MRELAX_RELOCATIONS. * doc/c-i386.texi: Document -mrelax-relocations=. * testsuite/gas/i386/got-no-relax.d: New file. * testsuite/gas/i386/x86-64-gotpcrel-no-relax.d: Likewise. * testsuite/gas/i386/got.d: Pass -mrelax-relocations=yes to as. * testsuite/gas/i386/localpic.d: Likewise. * testsuite/gas/i386/mixed-mode-reloc32.d: Likewise. * testsuite/gas/i386/reloc32.d: Likewise. * testsuite/gas/i386/x86-64-gotpcrel.d: Likewise. * testsuite/gas/i386/x86-64-localpic.d: Likewise. * testsuite/gas/i386/ilp32/x86-64-gotpcrel.d: Likewise. * testsuite/gas/i386/ilp32/x86-64-localpic.d: Likewise. * testsuite/gas/i386/i386.exp: Run got-no-relax and x86-64-gotpcrel-no-relax. ld/ PR gas/19520 * testsuite/ld-i386/branch1.d: Pass -mrelax-relocations=yes to as. * testsuite/ld-i386/call1.d: Likewise. * testsuite/ld-i386/call2.d: Likewise. * testsuite/ld-i386/call3a.d: Likewise. * testsuite/ld-i386/call3b.d: Likewise. * testsuite/ld-i386/call3c.d: Likewise. * testsuite/ld-i386/call3d.d: Likewise. * testsuite/ld-i386/call3e.d: Likewise. * testsuite/ld-i386/call3f.d: Likewise. * testsuite/ld-i386/call3g.d: Likewise. * testsuite/ld-i386/call3h.d: Likewise. * testsuite/ld-i386/jmp1.d: Likewise. * testsuite/ld-i386/jmp2.d: Likewise. * testsuite/ld-i386/lea1c.d: Likewise. * testsuite/ld-i386/load1.d: Likewise. * testsuite/ld-i386/load2.d: Likewise. * testsuite/ld-i386/load3.d: Likewise. * testsuite/ld-i386/load4a.d: Likewise. * testsuite/ld-i386/load5a.d: Likewise. * testsuite/ld-i386/mov2b.d: Likewise. * testsuite/ld-i386/mov3.d: Likewise. * testsuite/ld-ifunc/ifunc-21-x86-64.d: Likewise. * testsuite/ld-ifunc/ifunc-22-x86-64.d: Likewise. * testsuite/ld-ifunc/ifunc-5r-local-x86-64.d: Likewise. * testsuite/ld-x86-64/call1a.d: Likewise. * testsuite/ld-x86-64/call1b.d: Likewise. * testsuite/ld-x86-64/call1c.d: Likewise. * testsuite/ld-x86-64/call1d.d: Likewise. * testsuite/ld-x86-64/call1e.d: Likewise. * testsuite/ld-x86-64/call1f.d: Likewise. * testsuite/ld-x86-64/call1h.d: Likewise. * testsuite/ld-x86-64/call1i.d: Likewise. * testsuite/ld-x86-64/load1a.d: Likewise. * testsuite/ld-x86-64/load1b.d: Likewise. * testsuite/ld-i386/got1a.S: Load GOT into %ecx and use it. * testsuite/ld-i386/got1.dd: Updated. * testsuite/ld-i386/got1d.S (1): Removed. * testsuite/ld-i386/i386.exp: Add -Wa,-mrelax-relocations=yes. * testsuite/ld-x86-64/x86-64.exp: Likewise.
Diffstat (limited to 'ld')
-rw-r--r--ld/ChangeLog43
-rw-r--r--ld/testsuite/ld-i386/branch1.d2
-rw-r--r--ld/testsuite/ld-i386/call1.d2
-rw-r--r--ld/testsuite/ld-i386/call2.d2
-rw-r--r--ld/testsuite/ld-i386/call3a.d2
-rw-r--r--ld/testsuite/ld-i386/call3b.d2
-rw-r--r--ld/testsuite/ld-i386/call3c.d2
-rw-r--r--ld/testsuite/ld-i386/call3d.d2
-rw-r--r--ld/testsuite/ld-i386/call3e.d2
-rw-r--r--ld/testsuite/ld-i386/call3f.d2
-rw-r--r--ld/testsuite/ld-i386/call3g.d2
-rw-r--r--ld/testsuite/ld-i386/call3h.d2
-rw-r--r--ld/testsuite/ld-i386/got1.dd2
-rw-r--r--ld/testsuite/ld-i386/got1a.S11
-rw-r--r--ld/testsuite/ld-i386/got1d.S1
-rw-r--r--ld/testsuite/ld-i386/i386.exp10
-rw-r--r--ld/testsuite/ld-i386/jmp1.d2
-rw-r--r--ld/testsuite/ld-i386/jmp2.d2
-rw-r--r--ld/testsuite/ld-i386/lea1c.d2
-rw-r--r--ld/testsuite/ld-i386/load1.d2
-rw-r--r--ld/testsuite/ld-i386/load2.d2
-rw-r--r--ld/testsuite/ld-i386/load3.d2
-rw-r--r--ld/testsuite/ld-i386/load4a.d2
-rw-r--r--ld/testsuite/ld-i386/load5a.d2
-rw-r--r--ld/testsuite/ld-i386/mov2b.d2
-rw-r--r--ld/testsuite/ld-i386/mov3.d2
-rw-r--r--ld/testsuite/ld-ifunc/ifunc-21-x86-64.d2
-rw-r--r--ld/testsuite/ld-ifunc/ifunc-22-x86-64.d2
-rw-r--r--ld/testsuite/ld-ifunc/ifunc-5r-local-x86-64.d2
-rw-r--r--ld/testsuite/ld-x86-64/call1a.d2
-rw-r--r--ld/testsuite/ld-x86-64/call1b.d2
-rw-r--r--ld/testsuite/ld-x86-64/call1c.d2
-rw-r--r--ld/testsuite/ld-x86-64/call1d.d2
-rw-r--r--ld/testsuite/ld-x86-64/call1e.d2
-rw-r--r--ld/testsuite/ld-x86-64/call1f.d2
-rw-r--r--ld/testsuite/ld-x86-64/call1g.d2
-rw-r--r--ld/testsuite/ld-x86-64/call1h.d2
-rw-r--r--ld/testsuite/ld-x86-64/call1i.d2
-rw-r--r--ld/testsuite/ld-x86-64/load1a.d2
-rw-r--r--ld/testsuite/ld-x86-64/load1b.d2
-rw-r--r--ld/testsuite/ld-x86-64/x86-64.exp10
41 files changed, 100 insertions, 47 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog
index a46c644..54e169b 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,46 @@
+2016-02-03 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR gas/19520
+ * testsuite/ld-i386/branch1.d: Pass -mrelax-relocations=yes to as.
+ * testsuite/ld-i386/call1.d: Likewise.
+ * testsuite/ld-i386/call2.d: Likewise.
+ * testsuite/ld-i386/call3a.d: Likewise.
+ * testsuite/ld-i386/call3b.d: Likewise.
+ * testsuite/ld-i386/call3c.d: Likewise.
+ * testsuite/ld-i386/call3d.d: Likewise.
+ * testsuite/ld-i386/call3e.d: Likewise.
+ * testsuite/ld-i386/call3f.d: Likewise.
+ * testsuite/ld-i386/call3g.d: Likewise.
+ * testsuite/ld-i386/call3h.d: Likewise.
+ * testsuite/ld-i386/jmp1.d: Likewise.
+ * testsuite/ld-i386/jmp2.d: Likewise.
+ * testsuite/ld-i386/lea1c.d: Likewise.
+ * testsuite/ld-i386/load1.d: Likewise.
+ * testsuite/ld-i386/load2.d: Likewise.
+ * testsuite/ld-i386/load3.d: Likewise.
+ * testsuite/ld-i386/load4a.d: Likewise.
+ * testsuite/ld-i386/load5a.d: Likewise.
+ * testsuite/ld-i386/mov2b.d: Likewise.
+ * testsuite/ld-i386/mov3.d: Likewise.
+ * testsuite/ld-ifunc/ifunc-21-x86-64.d: Likewise.
+ * testsuite/ld-ifunc/ifunc-22-x86-64.d: Likewise.
+ * testsuite/ld-ifunc/ifunc-5r-local-x86-64.d: Likewise.
+ * testsuite/ld-x86-64/call1a.d: Likewise.
+ * testsuite/ld-x86-64/call1b.d: Likewise.
+ * testsuite/ld-x86-64/call1c.d: Likewise.
+ * testsuite/ld-x86-64/call1d.d: Likewise.
+ * testsuite/ld-x86-64/call1e.d: Likewise.
+ * testsuite/ld-x86-64/call1f.d: Likewise.
+ * testsuite/ld-x86-64/call1h.d: Likewise.
+ * testsuite/ld-x86-64/call1i.d: Likewise.
+ * testsuite/ld-x86-64/load1a.d: Likewise.
+ * testsuite/ld-x86-64/load1b.d: Likewise.
+ * testsuite/ld-i386/got1a.S: Load GOT into %ecx and use it.
+ * testsuite/ld-i386/got1.dd: Updated.
+ * testsuite/ld-i386/got1d.S (1): Removed.
+ * testsuite/ld-i386/i386.exp: Add -Wa,-mrelax-relocations=yes.
+ * testsuite/ld-x86-64/x86-64.exp: Likewise.
+
2016-02-02 H.J. Lu <hongjiu.lu@intel.com>
PR ld/18591
diff --git a/ld/testsuite/ld-i386/branch1.d b/ld/testsuite/ld-i386/branch1.d
index a078f1d..81b069e 100644
--- a/ld/testsuite/ld-i386/branch1.d
+++ b/ld/testsuite/ld-i386/branch1.d
@@ -1,4 +1,4 @@
-#as: --32
+#as: --32 -mrelax-relocations=yes
#ld: -melf_i386
#objdump: -dw
diff --git a/ld/testsuite/ld-i386/call1.d b/ld/testsuite/ld-i386/call1.d
index 69383b2..e3ebedc 100644
--- a/ld/testsuite/ld-i386/call1.d
+++ b/ld/testsuite/ld-i386/call1.d
@@ -1,3 +1,3 @@
-#as: --32
+#as: --32 -mrelax-relocations=yes
#ld: -shared -melf_i386
#error: direct GOT relocation R_386_GOT32X against `foo' without base register can not be used when making a shared object
diff --git a/ld/testsuite/ld-i386/call2.d b/ld/testsuite/ld-i386/call2.d
index 69383b2..e3ebedc 100644
--- a/ld/testsuite/ld-i386/call2.d
+++ b/ld/testsuite/ld-i386/call2.d
@@ -1,3 +1,3 @@
-#as: --32
+#as: --32 -mrelax-relocations=yes
#ld: -shared -melf_i386
#error: direct GOT relocation R_386_GOT32X against `foo' without base register can not be used when making a shared object
diff --git a/ld/testsuite/ld-i386/call3a.d b/ld/testsuite/ld-i386/call3a.d
index a8ff27f..5a1e1df 100644
--- a/ld/testsuite/ld-i386/call3a.d
+++ b/ld/testsuite/ld-i386/call3a.d
@@ -1,5 +1,5 @@
#source: call3.s
-#as: --32
+#as: --32 -mrelax-relocations=yes
#ld: -melf_i386
#objdump: -dw
diff --git a/ld/testsuite/ld-i386/call3b.d b/ld/testsuite/ld-i386/call3b.d
index 06af6f5..de98ce4 100644
--- a/ld/testsuite/ld-i386/call3b.d
+++ b/ld/testsuite/ld-i386/call3b.d
@@ -1,5 +1,5 @@
#source: call3.s
-#as: --32
+#as: --32 -mrelax-relocations=yes
#ld: -melf_i386 -z call-nop=prefix-addr
#objdump: -dw
diff --git a/ld/testsuite/ld-i386/call3c.d b/ld/testsuite/ld-i386/call3c.d
index 64e8372..0fdbee4 100644
--- a/ld/testsuite/ld-i386/call3c.d
+++ b/ld/testsuite/ld-i386/call3c.d
@@ -1,5 +1,5 @@
#source: call3.s
-#as: --32
+#as: --32 -mrelax-relocations=yes
#ld: -melf_i386 -z call-nop=prefix-nop
#objdump: -dw
diff --git a/ld/testsuite/ld-i386/call3d.d b/ld/testsuite/ld-i386/call3d.d
index a9274c8..4d965b3 100644
--- a/ld/testsuite/ld-i386/call3d.d
+++ b/ld/testsuite/ld-i386/call3d.d
@@ -1,5 +1,5 @@
#source: call3.s
-#as: --32
+#as: --32 -mrelax-relocations=yes
#ld: -melf_i386 -z call-nop=suffix-nop
#objdump: -dw
diff --git a/ld/testsuite/ld-i386/call3e.d b/ld/testsuite/ld-i386/call3e.d
index 2876b49..608682c 100644
--- a/ld/testsuite/ld-i386/call3e.d
+++ b/ld/testsuite/ld-i386/call3e.d
@@ -1,5 +1,5 @@
#source: call3.s
-#as: --32
+#as: --32 -mrelax-relocations=yes
#ld: -melf_i386 -z call-nop=prefix-0x67
#objdump: -dw
diff --git a/ld/testsuite/ld-i386/call3f.d b/ld/testsuite/ld-i386/call3f.d
index 5ab0cf1..f3a4869 100644
--- a/ld/testsuite/ld-i386/call3f.d
+++ b/ld/testsuite/ld-i386/call3f.d
@@ -1,5 +1,5 @@
#source: call3.s
-#as: --32
+#as: --32 -mrelax-relocations=yes
#ld: -melf_i386 -z call-nop=prefix-0x90
#objdump: -dw
diff --git a/ld/testsuite/ld-i386/call3g.d b/ld/testsuite/ld-i386/call3g.d
index 8287770..f3e3f36 100644
--- a/ld/testsuite/ld-i386/call3g.d
+++ b/ld/testsuite/ld-i386/call3g.d
@@ -1,5 +1,5 @@
#source: call3.s
-#as: --32
+#as: --32 -mrelax-relocations=yes
#ld: -melf_i386 -z call-nop=suffix-0x90
#objdump: -dw
diff --git a/ld/testsuite/ld-i386/call3h.d b/ld/testsuite/ld-i386/call3h.d
index 83f371a..afd1ce8 100644
--- a/ld/testsuite/ld-i386/call3h.d
+++ b/ld/testsuite/ld-i386/call3h.d
@@ -1,5 +1,5 @@
#source: call3.s
-#as: --32
+#as: --32 -mrelax-relocations=yes
#ld: -melf_i386 -z call-nop=suffix-144
#objdump: -dw
diff --git a/ld/testsuite/ld-i386/got1.dd b/ld/testsuite/ld-i386/got1.dd
index e46153d..e6e82de 100644
--- a/ld/testsuite/ld-i386/got1.dd
+++ b/ld/testsuite/ld-i386/got1.dd
@@ -10,6 +10,8 @@
[ ]*[a-f0-9]+: ff d0 call \*%eax
[ ]*[a-f0-9]+: [ a-f0-9]+ mov *0x[a-f0-9]+,%eax
[ ]*[a-f0-9]+: ff d0 call \*%eax
+[ ]*[a-f0-9]+: [ a-f0-9]+ call [a-f0-9]+ <__x86.get_pc_thunk.cx>
+[ ]*[a-f0-9]+: [ a-f0-9]+ add \$0x[a-f0-9]+,%ecx
[ ]*[a-f0-9]+: [ a-f0-9]+ lea *0x[a-f0-9]+,%ecx
[ ]*[a-f0-9]+: ff d1 call \*%ecx
[ ]*[a-f0-9]+: 83 ec 0c sub \$0xc,%esp
diff --git a/ld/testsuite/ld-i386/got1a.S b/ld/testsuite/ld-i386/got1a.S
index f3d5330..7a3f7b5 100644
--- a/ld/testsuite/ld-i386/got1a.S
+++ b/ld/testsuite/ld-i386/got1a.S
@@ -12,10 +12,19 @@ main:
call *%eax
movl plt@GOT, %eax
call *%eax
- movl foo@GOT(%ebx), %ecx
+ call __x86.get_pc_thunk.cx
+ addl $_GLOBAL_OFFSET_TABLE_, %ecx
+ movl foo@GOT(%ecx), %ecx
call *%ecx
subl $12, %esp
pushl $0
pushl $0 # Push a dummy return address onto stack.
jmp *myexit@GOT
.size main, .-main
+ .section .text.__x86.get_pc_thunk.cx,"axG",@progbits,__x86.get_pc_thunk.cx,comdat
+ .globl __x86.get_pc_thunk.cx
+ .hidden __x86.get_pc_thunk.cx
+ .type __x86.get_pc_thunk.cx, @function
+__x86.get_pc_thunk.cx:
+ movl (%esp), %ecx
+ ret
diff --git a/ld/testsuite/ld-i386/got1d.S b/ld/testsuite/ld-i386/got1d.S
index a6d51c6..7e4c9b1 100644
--- a/ld/testsuite/ld-i386/got1d.S
+++ b/ld/testsuite/ld-i386/got1d.S
@@ -19,7 +19,6 @@ plt:
pushl %esi
pushl %ebx
call __x86.get_pc_thunk.bx
-1:
addl $_GLOBAL_OFFSET_TABLE_, %ebx
subl $20, %esp
leal __FUNCTION__.1866@GOTOFF(%ebx), %esi
diff --git a/ld/testsuite/ld-i386/i386.exp b/ld/testsuite/ld-i386/i386.exp
index 04eb7b1..9d392c2 100644
--- a/ld/testsuite/ld-i386/i386.exp
+++ b/ld/testsuite/ld-i386/i386.exp
@@ -357,7 +357,7 @@ if { [isnative]
[list \
"Build libplt-main1.a" \
"" \
- "-fPIC" \
+ "-fPIC -Wa,-mrelax-relocations=yes" \
{ plt-main1.c } \
{{readelf {-Wr} plt-main1.rd}} \
"libplt-main1.a" \
@@ -365,7 +365,7 @@ if { [isnative]
[list \
"Build libplt-main2.a" \
"" \
- "-fPIC" \
+ "-fPIC -Wa,-mrelax-relocations=yes" \
{ plt-main2.c } \
{{readelf {-Wr} plt-main2.rd}} \
"libplt-main2.a" \
@@ -373,7 +373,7 @@ if { [isnative]
[list \
"Build libplt-main3.a" \
"" \
- "-fPIC $PLT_CFLAGS" \
+ "-fPIC -Wa,-mrelax-relocations=yes $PLT_CFLAGS" \
{ plt-main3.c } \
{{readelf {-Wr} plt-main3.rd}} \
"libplt-main3.a" \
@@ -381,7 +381,7 @@ if { [isnative]
[list \
"Build libplt-main4.a" \
"" \
- "-fPIC $PLT_CFLAGS" \
+ "-fPIC -Wa,-mrelax-relocations=yes $PLT_CFLAGS" \
{ plt-main4.c } \
{{readelf {-Wr} plt-main4.rd}} \
"libplt-main4.a" \
@@ -535,7 +535,7 @@ if { [isnative]
[list \
"Build gotpc1" \
"tmpdir/got1d.so" \
- "" \
+ "-Wa,-mrelax-relocations=yes" \
{ got1a.S got1b.c got1c.c } \
{{objdump {-dw} got1.dd}} \
"got1" \
diff --git a/ld/testsuite/ld-i386/jmp1.d b/ld/testsuite/ld-i386/jmp1.d
index 69383b2..e3ebedc 100644
--- a/ld/testsuite/ld-i386/jmp1.d
+++ b/ld/testsuite/ld-i386/jmp1.d
@@ -1,3 +1,3 @@
-#as: --32
+#as: --32 -mrelax-relocations=yes
#ld: -shared -melf_i386
#error: direct GOT relocation R_386_GOT32X against `foo' without base register can not be used when making a shared object
diff --git a/ld/testsuite/ld-i386/jmp2.d b/ld/testsuite/ld-i386/jmp2.d
index 69383b2..e3ebedc 100644
--- a/ld/testsuite/ld-i386/jmp2.d
+++ b/ld/testsuite/ld-i386/jmp2.d
@@ -1,3 +1,3 @@
-#as: --32
+#as: --32 -mrelax-relocations=yes
#ld: -shared -melf_i386
#error: direct GOT relocation R_386_GOT32X against `foo' without base register can not be used when making a shared object
diff --git a/ld/testsuite/ld-i386/lea1c.d b/ld/testsuite/ld-i386/lea1c.d
index dd76258..0c3580d 100644
--- a/ld/testsuite/ld-i386/lea1c.d
+++ b/ld/testsuite/ld-i386/lea1c.d
@@ -1,5 +1,5 @@
#source: lea1.s
-#as: --32
+#as: --32 -mrelax-relocations=yes
#ld: -melf_i386
#objdump: -dw
diff --git a/ld/testsuite/ld-i386/load1.d b/ld/testsuite/ld-i386/load1.d
index 062ea18..a252a15 100644
--- a/ld/testsuite/ld-i386/load1.d
+++ b/ld/testsuite/ld-i386/load1.d
@@ -1,4 +1,4 @@
-#as: --32
+#as: --32 -mrelax-relocations=yes
#ld: -melf_i386
#objdump: -dw --sym
#notarget: i?86-*-nacl* x86_64-*-nacl*
diff --git a/ld/testsuite/ld-i386/load2.d b/ld/testsuite/ld-i386/load2.d
index 87c2509..467fee0 100644
--- a/ld/testsuite/ld-i386/load2.d
+++ b/ld/testsuite/ld-i386/load2.d
@@ -1,3 +1,3 @@
-#as: --32
+#as: --32 -mrelax-relocations=yes
#ld: -melf_i386 -shared
#error: direct GOT relocation R_386_GOT32X against `foo' without base register can not be used when making a shared object
diff --git a/ld/testsuite/ld-i386/load3.d b/ld/testsuite/ld-i386/load3.d
index 87c2509..467fee0 100644
--- a/ld/testsuite/ld-i386/load3.d
+++ b/ld/testsuite/ld-i386/load3.d
@@ -1,3 +1,3 @@
-#as: --32
+#as: --32 -mrelax-relocations=yes
#ld: -melf_i386 -shared
#error: direct GOT relocation R_386_GOT32X against `foo' without base register can not be used when making a shared object
diff --git a/ld/testsuite/ld-i386/load4a.d b/ld/testsuite/ld-i386/load4a.d
index 3aa56bd..f3f02ea 100644
--- a/ld/testsuite/ld-i386/load4a.d
+++ b/ld/testsuite/ld-i386/load4a.d
@@ -1,4 +1,4 @@
#source: load4.s
-#as: --32
+#as: --32 -mrelax-relocations=yes
#ld: -Bsymbolic -shared -melf_i386
#error: direct GOT relocation R_386_GOT32X against `foo' without base register can not be used when making a shared object
diff --git a/ld/testsuite/ld-i386/load5a.d b/ld/testsuite/ld-i386/load5a.d
index 88c225a..9744316 100644
--- a/ld/testsuite/ld-i386/load5a.d
+++ b/ld/testsuite/ld-i386/load5a.d
@@ -1,4 +1,4 @@
#source: load5.s
-#as: --32
+#as: --32 -mrelax-relocations=yes
#ld: -Bsymbolic -shared -melf_i386
#error: direct GOT relocation R_386_GOT32X against `foo' without base register can not be used when making a shared object
diff --git a/ld/testsuite/ld-i386/mov2b.d b/ld/testsuite/ld-i386/mov2b.d
index ea5dd9b..295a7c5 100644
--- a/ld/testsuite/ld-i386/mov2b.d
+++ b/ld/testsuite/ld-i386/mov2b.d
@@ -1,5 +1,5 @@
#source: mov2.s
-#as: --32
+#as: --32 -mrelax-relocations=yes
#ld: -pie -melf_i386
#objdump: -dw
diff --git a/ld/testsuite/ld-i386/mov3.d b/ld/testsuite/ld-i386/mov3.d
index 17da244..4ce5cd8 100644
--- a/ld/testsuite/ld-i386/mov3.d
+++ b/ld/testsuite/ld-i386/mov3.d
@@ -1,4 +1,4 @@
-#as: --32
+#as: --32 -mrelax-relocations=yes
#ld: -melf_i386
#objdump: -dw
diff --git a/ld/testsuite/ld-ifunc/ifunc-21-x86-64.d b/ld/testsuite/ld-ifunc/ifunc-21-x86-64.d
index 53ccd5a..ae75487 100644
--- a/ld/testsuite/ld-ifunc/ifunc-21-x86-64.d
+++ b/ld/testsuite/ld-ifunc/ifunc-21-x86-64.d
@@ -1,4 +1,4 @@
-#as: --64
+#as: --64 -mrelax-relocations=yes
#ld: -melf_x86_64
#objdump: -dw
#target: x86_64-*-*
diff --git a/ld/testsuite/ld-ifunc/ifunc-22-x86-64.d b/ld/testsuite/ld-ifunc/ifunc-22-x86-64.d
index 53ccd5a..ae75487 100644
--- a/ld/testsuite/ld-ifunc/ifunc-22-x86-64.d
+++ b/ld/testsuite/ld-ifunc/ifunc-22-x86-64.d
@@ -1,4 +1,4 @@
-#as: --64
+#as: --64 -mrelax-relocations=yes
#ld: -melf_x86_64
#objdump: -dw
#target: x86_64-*-*
diff --git a/ld/testsuite/ld-ifunc/ifunc-5r-local-x86-64.d b/ld/testsuite/ld-ifunc/ifunc-5r-local-x86-64.d
index 18021e7..2ce53a9 100644
--- a/ld/testsuite/ld-ifunc/ifunc-5r-local-x86-64.d
+++ b/ld/testsuite/ld-ifunc/ifunc-5r-local-x86-64.d
@@ -1,5 +1,5 @@
#source: ifunc-5-local-x86-64.s
-#as: --64
+#as: --64 -mrelax-relocations=yes
#ld: -r -melf_x86_64
#readelf: -r --wide
#target: x86_64-*-*
diff --git a/ld/testsuite/ld-x86-64/call1a.d b/ld/testsuite/ld-x86-64/call1a.d
index 2a63b1c..2b131ee 100644
--- a/ld/testsuite/ld-x86-64/call1a.d
+++ b/ld/testsuite/ld-x86-64/call1a.d
@@ -1,5 +1,5 @@
#source: call1.s
-#as: --64
+#as: --64 -mrelax-relocations=yes
#ld: -melf_x86_64
#objdump: -dw
diff --git a/ld/testsuite/ld-x86-64/call1b.d b/ld/testsuite/ld-x86-64/call1b.d
index e782fa2..e2fef07 100644
--- a/ld/testsuite/ld-x86-64/call1b.d
+++ b/ld/testsuite/ld-x86-64/call1b.d
@@ -1,5 +1,5 @@
#source: call1.s
-#as: --64
+#as: --64 -mrelax-relocations=yes
#ld: -melf_x86_64 -z call-nop=prefix-addr
#objdump: -dw
diff --git a/ld/testsuite/ld-x86-64/call1c.d b/ld/testsuite/ld-x86-64/call1c.d
index d058fc7..7fe8056 100644
--- a/ld/testsuite/ld-x86-64/call1c.d
+++ b/ld/testsuite/ld-x86-64/call1c.d
@@ -1,5 +1,5 @@
#source: call1.s
-#as: --64
+#as: --64 -mrelax-relocations=yes
#ld: -melf_x86_64 -z call-nop=prefix-nop
#objdump: -dw
diff --git a/ld/testsuite/ld-x86-64/call1d.d b/ld/testsuite/ld-x86-64/call1d.d
index 8871cc6..c93756b 100644
--- a/ld/testsuite/ld-x86-64/call1d.d
+++ b/ld/testsuite/ld-x86-64/call1d.d
@@ -1,5 +1,5 @@
#source: call1.s
-#as: --64
+#as: --64 -mrelax-relocations=yes
#ld: -melf_x86_64 -z call-nop=suffix-nop
#objdump: -dw
diff --git a/ld/testsuite/ld-x86-64/call1e.d b/ld/testsuite/ld-x86-64/call1e.d
index 7127f1a..c7c467c 100644
--- a/ld/testsuite/ld-x86-64/call1e.d
+++ b/ld/testsuite/ld-x86-64/call1e.d
@@ -1,5 +1,5 @@
#source: call1.s
-#as: --64
+#as: --64 -mrelax-relocations=yes
#ld: -melf_x86_64 -z call-nop=prefix-0x67
#objdump: -dw
diff --git a/ld/testsuite/ld-x86-64/call1f.d b/ld/testsuite/ld-x86-64/call1f.d
index 587bade..d0c3f11 100644
--- a/ld/testsuite/ld-x86-64/call1f.d
+++ b/ld/testsuite/ld-x86-64/call1f.d
@@ -1,5 +1,5 @@
#source: call1.s
-#as: --64
+#as: --64 -mrelax-relocations=yes
#ld: -melf_x86_64 -z call-nop=prefix-0x90
#objdump: -dw
diff --git a/ld/testsuite/ld-x86-64/call1g.d b/ld/testsuite/ld-x86-64/call1g.d
index 3bb512e..6a8d790 100644
--- a/ld/testsuite/ld-x86-64/call1g.d
+++ b/ld/testsuite/ld-x86-64/call1g.d
@@ -1,5 +1,5 @@
#source: call1.s
-#as: --64
+#as: --64 -mrelax-relocations=yes
#ld: -melf_x86_64 -z call-nop=suffix-0x90
#objdump: -dw
diff --git a/ld/testsuite/ld-x86-64/call1h.d b/ld/testsuite/ld-x86-64/call1h.d
index c7c8dde..f8e1d07 100644
--- a/ld/testsuite/ld-x86-64/call1h.d
+++ b/ld/testsuite/ld-x86-64/call1h.d
@@ -1,5 +1,5 @@
#source: call1.s
-#as: --64
+#as: --64 -mrelax-relocations=yes
#ld: -melf_x86_64 -z call-nop=suffix-144
#objdump: -dw
diff --git a/ld/testsuite/ld-x86-64/call1i.d b/ld/testsuite/ld-x86-64/call1i.d
index b3684ad..d5a157b 100644
--- a/ld/testsuite/ld-x86-64/call1i.d
+++ b/ld/testsuite/ld-x86-64/call1i.d
@@ -1,5 +1,5 @@
#source: call1.s
-#as: --x32
+#as: --x32 -mrelax-relocations=yes
#ld: -melf32_x86_64 -z call-nop=suffix-0x90
#objdump: -dw
diff --git a/ld/testsuite/ld-x86-64/load1a.d b/ld/testsuite/ld-x86-64/load1a.d
index 5c9349e..0eb4880 100644
--- a/ld/testsuite/ld-x86-64/load1a.d
+++ b/ld/testsuite/ld-x86-64/load1a.d
@@ -1,5 +1,5 @@
#source: load1.s
-#as: --64
+#as: --64 -mrelax-relocations=yes
#ld: -melf_x86_64
#objdump: -dw --sym
#notarget: x86_64-*-nacl*
diff --git a/ld/testsuite/ld-x86-64/load1b.d b/ld/testsuite/ld-x86-64/load1b.d
index 70ef274..8827f38 100644
--- a/ld/testsuite/ld-x86-64/load1b.d
+++ b/ld/testsuite/ld-x86-64/load1b.d
@@ -1,5 +1,5 @@
#source: load1.s
-#as: --x32
+#as: --x32 -mrelax-relocations=yes
#ld: -melf32_x86_64
#objdump: -dw --sym
#notarget: x86_64-*-nacl*
diff --git a/ld/testsuite/ld-x86-64/x86-64.exp b/ld/testsuite/ld-x86-64/x86-64.exp
index 1254b44..f21a30e 100644
--- a/ld/testsuite/ld-x86-64/x86-64.exp
+++ b/ld/testsuite/ld-x86-64/x86-64.exp
@@ -392,7 +392,7 @@ if { [isnative] && [which $CC] != 0 } {
[list \
"Build libplt-main1.a" \
"" \
- "-fPIC" \
+ "-fPIC -Wa,-mrelax-relocations=yes" \
{ plt-main1.c } \
{{readelf {-Wr} plt-main1.rd}} \
"libplt-main1.a" \
@@ -400,7 +400,7 @@ if { [isnative] && [which $CC] != 0 } {
[list \
"Build libplt-main2.a" \
"" \
- "-fPIC" \
+ "-fPIC -Wa,-mrelax-relocations=yes" \
{ plt-main2.c } \
{{readelf {-Wr} plt-main2.rd}} \
"libplt-main2.a" \
@@ -408,7 +408,7 @@ if { [isnative] && [which $CC] != 0 } {
[list \
"Build libplt-main3.a" \
"" \
- "-fPIC $PLT_CFLAGS" \
+ "-fPIC -Wa,-mrelax-relocations=yes $PLT_CFLAGS" \
{ plt-main3.c } \
{{readelf {-Wr} plt-main3.rd}} \
"libplt-main3.a" \
@@ -416,7 +416,7 @@ if { [isnative] && [which $CC] != 0 } {
[list \
"Build libplt-main4.a" \
"" \
- "-fPIC $PLT_CFLAGS" \
+ "-fPIC -Wa,-mrelax-relocations=yes $PLT_CFLAGS" \
{ plt-main4.c } \
{{readelf {-Wr} plt-main4.rd}} \
"libplt-main4.a" \
@@ -546,7 +546,7 @@ if { [isnative] && [which $CC] != 0 } {
[list \
"Build gotpcrel1" \
"tmpdir/gotpcrel1d.so" \
- "" \
+ "-Wa,-mrelax-relocations=yes" \
{ gotpcrel1a.S gotpcrel1b.c gotpcrel1c.c } \
{{objdump {-dw} gotpcrel1.dd}} \
"gotpcrel1" \