summaryrefslogtreecommitdiff
path: root/ld
diff options
context:
space:
mode:
authorHans-Peter Nilsson <hp@bitrange.com>2017-07-25 04:09:32 +0200
committerHans-Peter Nilsson <hp@bitrange.com>2017-08-21 03:43:35 +0200
commit284d826d9f57e3ff47e41f61f3250c8d029baaa3 (patch)
treeb6ff8464f39f8dc7a92634e0d4e83c193354f243 /ld
parent454c9bb956abd5451b6a46c96327c5ec0884eaed (diff)
downloadbinutils-gdb-284d826d9f57e3ff47e41f61f3250c8d029baaa3.tar.gz
PR ld/20125, MMIX weak symbols
Weak undefineds with PUSHJ relocs were "lost", causing internal inconsistencies and an abort.
Diffstat (limited to 'ld')
-rw-r--r--ld/ChangeLog6
-rw-r--r--ld/testsuite/ld-mmix/pr20125.d21
-rw-r--r--ld/testsuite/ld-mmix/pr20125.s2
3 files changed, 29 insertions, 0 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog
index ba576c2a1a4..a15025608df 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,9 @@
+2017-08-21 Hans-Peter Nilsson <hp@bitrange.com>
+
+ PR ld/20125
+ * testsuite/ld-mmix/pr20125.d, testsuite/ld-mmix/pr20125.s: New
+ test.
+
2017-08-20 A. Wilcox <awilfox@adelielinux.org>
PR ld/21976
diff --git a/ld/testsuite/ld-mmix/pr20125.d b/ld/testsuite/ld-mmix/pr20125.d
new file mode 100644
index 00000000000..7c09c04383e
--- /dev/null
+++ b/ld/testsuite/ld-mmix/pr20125.d
@@ -0,0 +1,21 @@
+#as: -no-predefined-syms -x -I$srcdir/$subdir
+#ld: -m mmo --defsym __.MMIX.start..text=0x80000
+#objdump: -dr
+
+# PUSHJ reloc handling was wrong for weak undefined symbols, causing
+# internal inconsistencies, leading to a call to abort.
+# Note that we don't keep track of which symbols have pushj-stubs, so
+# we get one stub each for the two calls to "foo".
+
+.*: file format mmo
+
+Disassembly of section \.text:
+
+0+80000 <(_start|Main)>:
+ 80000: fe000004 get \$0,rJ
+ 80004: f2010004 pushj \$1,80014 <Main\+0x14>
+ 80008: f2010004 pushj \$1,80018 <Main\+0x18>
+ 8000c: f6040000 put rJ,\$0
+ 80010: f8010000 pop 1,0
+ 80014: f1fdfffb jmp 0 <Main-0x80000>
+ 80018: f1fdfffa jmp 0 <Main-0x80000>
diff --git a/ld/testsuite/ld-mmix/pr20125.s b/ld/testsuite/ld-mmix/pr20125.s
new file mode 100644
index 00000000000..e528d9d75f7
--- /dev/null
+++ b/ld/testsuite/ld-mmix/pr20125.s
@@ -0,0 +1,2 @@
+ .weak bar
+ .include "pr12815-2.s"