aboutsummaryrefslogtreecommitdiff
path: root/ld
diff options
context:
space:
mode:
Diffstat (limited to 'ld')
-rw-r--r--ld/ChangeLog9
-rw-r--r--ld/testsuite/ld-powerpc/aix-neg-reloc-32.d23
-rw-r--r--ld/testsuite/ld-powerpc/aix-neg-reloc-64.d23
-rw-r--r--ld/testsuite/ld-powerpc/aix-neg-reloc.ex1
-rw-r--r--ld/testsuite/ld-powerpc/aix-neg-reloc.s30
-rw-r--r--ld/testsuite/ld-powerpc/aix52.exp6
6 files changed, 92 insertions, 0 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog
index 663c06c..a6be046 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,12 @@
+2021-04-20 Clément Chigot <clement.chigot@atos.net>
+
+ PR binutils/21700
+ * testsuite/ld-powerpc/aix52.exp: Add new test.
+ * testsuite/ld-powerpc/aix-neg-reloc-32.d: New test.
+ * testsuite/ld-powerpc/aix-neg-reloc-64.d: New test.
+ * testsuite/ld-powerpc/aix-neg-reloc.ex: New test.
+ * testsuite/ld-powerpc/aix-neg-reloc.s: New test.
+
2021-04-13 Nick Clifton <nickc@redhat.com>
* ld.texi (Options): Add note about the effect of --as-needed on
diff --git a/ld/testsuite/ld-powerpc/aix-neg-reloc-32.d b/ld/testsuite/ld-powerpc/aix-neg-reloc-32.d
new file mode 100644
index 0000000..4e980f0
--- /dev/null
+++ b/ld/testsuite/ld-powerpc/aix-neg-reloc-32.d
@@ -0,0 +1,23 @@
+#source: aix-tls-reloc.s
+#as: -a32
+#ld: -b32 -shared -bE:aix-tls-reloc.ex
+#objdump: -dr
+#target: [is_xcoff_format]
+
+.*
+
+Disassembly of section \.text:
+
+.* <.foo>:
+.*: 4e 80 00 20 br
+.*: R_REF _foo.ro_-.*
+.*: 60 00 00 00 oril r0,r0,0
+.*: 60 00 00 00 oril r0,r0,0
+.*: 60 00 00 00 oril r0,r0,0
+.* <_GLOBAL__F_foo>:
+.*: ff ff ff f0 .long 0xfffffff0
+.*: R_POS .text-.*
+.*: R_NEG _foo.ro_-.*
+.*: 60 00 00 00 oril r0,r0,0
+.*: 60 00 00 00 oril r0,r0,0
+.*: 60 00 00 00 oril r0,r0,0
diff --git a/ld/testsuite/ld-powerpc/aix-neg-reloc-64.d b/ld/testsuite/ld-powerpc/aix-neg-reloc-64.d
new file mode 100644
index 0000000..9cf16d0
--- /dev/null
+++ b/ld/testsuite/ld-powerpc/aix-neg-reloc-64.d
@@ -0,0 +1,23 @@
+#source: aix-tls-reloc.s
+#as: -a32
+#ld: -b32 -shared -bE:aix-tls-reloc.ex
+#objdump: -dr
+#target: [is_xcoff_format]
+
+.*
+
+Disassembly of section \.text:
+
+.* <.foo>:
+.*: 4e 80 00 20 blr
+.*: R_REF _foo.ro_-.*
+.*: 60 00 00 00 nop
+.*: 60 00 00 00 nop
+.*: 60 00 00 00 nop
+.* <_GLOBAL__F_foo>:
+.*: ff ff ff ff fnmadd. f31,f31,f31,f31
+.*: R_POS_64 .text-.*
+.*: R_NEG _foo.ro_-.*
+.*: ff ff ff f0 .long 0xfffffff0
+.*: 60 00 00 00 nop
+.*: 60 00 00 00 nop
diff --git a/ld/testsuite/ld-powerpc/aix-neg-reloc.ex b/ld/testsuite/ld-powerpc/aix-neg-reloc.ex
new file mode 100644
index 0000000..257cc56
--- /dev/null
+++ b/ld/testsuite/ld-powerpc/aix-neg-reloc.ex
@@ -0,0 +1 @@
+foo
diff --git a/ld/testsuite/ld-powerpc/aix-neg-reloc.s b/ld/testsuite/ld-powerpc/aix-neg-reloc.s
new file mode 100644
index 0000000..20b48bd
--- /dev/null
+++ b/ld/testsuite/ld-powerpc/aix-neg-reloc.s
@@ -0,0 +1,30 @@
+ .toc
+ .csect .text[PR]
+ .globl foo
+ .globl .foo
+ .csect foo[DS],3
+foo:
+ .if size == 32
+ .long .foo, TOC[tc0], 0
+ .else
+ .llong .foo, TOC[tc0], 0
+ .endif
+
+ .csect .text[PR]
+.foo:
+LFB..0:
+ blr
+
+ .csect _foo.ro_[RO],4
+ .globl _GLOBAL__F_foo
+_GLOBAL__F_foo:
+ .if size == 32
+ .vbyte 4,LFB..0-$
+ .else
+ .vbyte 8,LFB..0-$
+ .endif
+
+# Make sure that .ref is also enough to keep _GLOBAL__F_foo
+# when exporting foo.
+ .csect .text[PR]
+ .ref _GLOBAL__F_foo
diff --git a/ld/testsuite/ld-powerpc/aix52.exp b/ld/testsuite/ld-powerpc/aix52.exp
index 0e68b6a..51d3132 100644
--- a/ld/testsuite/ld-powerpc/aix52.exp
+++ b/ld/testsuite/ld-powerpc/aix52.exp
@@ -251,6 +251,12 @@ set aix52tests {
"" {aix-toc-1a.s aix-toc-1b.s}
{{objdump -dr aix-toc-1-SIZE.dd}}
"aix-toc-1.so"}
+
+ {"Negative relocation test 1" "-shared -bE:aix-neg-reloc.ex"
+ "" {aix-neg-reloc.s}
+ {{objdump -dr aix-neg-reloc-SIZE.d}}
+ "aix-neg-reloc.so"}
+
}
foreach test $aix52tests {