aboutsummaryrefslogtreecommitdiff
path: root/ld
diff options
context:
space:
mode:
Diffstat (limited to 'ld')
-rw-r--r--ld/testsuite/ChangeLog17
-rw-r--r--ld/testsuite/ld-mmix/bpo-1.d33
-rw-r--r--ld/testsuite/ld-mmix/bpo-1.s2
-rw-r--r--ld/testsuite/ld-mmix/bpo-10.d34
-rw-r--r--ld/testsuite/ld-mmix/bpo-11.d39
-rw-r--r--ld/testsuite/ld-mmix/bpo-12.d9
-rw-r--r--ld/testsuite/ld-mmix/bpo-12m.d9
-rw-r--r--ld/testsuite/ld-mmix/bpo-13.d9
-rw-r--r--ld/testsuite/ld-mmix/bpo-13m.d9
-rw-r--r--ld/testsuite/ld-mmix/bpo-14.d33
-rw-r--r--ld/testsuite/ld-mmix/bpo-14m.d20
-rw-r--r--ld/testsuite/ld-mmix/bpo-15.d7
-rw-r--r--ld/testsuite/ld-mmix/bpo-15m.d7
-rw-r--r--ld/testsuite/ld-mmix/bpo-16.d34
-rw-r--r--ld/testsuite/ld-mmix/bpo-16m.d21
-rw-r--r--ld/testsuite/ld-mmix/bpo-17.d34
-rw-r--r--ld/testsuite/ld-mmix/bpo-17m.d22
-rw-r--r--ld/testsuite/ld-mmix/bpo-1m.d18
-rw-r--r--ld/testsuite/ld-mmix/bpo-2.d34
-rw-r--r--ld/testsuite/ld-mmix/bpo-2.s2
-rw-r--r--ld/testsuite/ld-mmix/bpo-2m.d21
-rw-r--r--ld/testsuite/ld-mmix/bpo-3.d34
-rw-r--r--ld/testsuite/ld-mmix/bpo-3.s1
-rw-r--r--ld/testsuite/ld-mmix/bpo-3m.d20
-rw-r--r--ld/testsuite/ld-mmix/bpo-4.d36
-rw-r--r--ld/testsuite/ld-mmix/bpo-4.s5
-rw-r--r--ld/testsuite/ld-mmix/bpo-4m.d22
-rw-r--r--ld/testsuite/ld-mmix/bpo-5.d35
-rw-r--r--ld/testsuite/ld-mmix/bpo-5.s4
-rw-r--r--ld/testsuite/ld-mmix/bpo-5m.d21
-rw-r--r--ld/testsuite/ld-mmix/bpo-6.d41
-rw-r--r--ld/testsuite/ld-mmix/bpo-6.s4
-rw-r--r--ld/testsuite/ld-mmix/bpo-6m.d27
-rw-r--r--ld/testsuite/ld-mmix/bpo-7.d6
-rw-r--r--ld/testsuite/ld-mmix/bpo-7.s2
-rw-r--r--ld/testsuite/ld-mmix/bpo-7m.d6
-rw-r--r--ld/testsuite/ld-mmix/bpo-8.d7
-rw-r--r--ld/testsuite/ld-mmix/bpo-8.s3
-rw-r--r--ld/testsuite/ld-mmix/bpo-8m.d7
-rw-r--r--ld/testsuite/ld-mmix/bpo-9.d36
-rw-r--r--ld/testsuite/ld-mmix/bpo-9m.d22
-rw-r--r--ld/testsuite/ld-mmix/start3.s7
-rw-r--r--ld/testsuite/ld-mmix/start4.s6
43 files changed, 766 insertions, 0 deletions
diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog
index a59759c..843fa7a 100644
--- a/ld/testsuite/ChangeLog
+++ b/ld/testsuite/ChangeLog
@@ -1,3 +1,20 @@
+2002-02-01 Hans-Peter Nilsson <hp@bitrange.com>
+
+ * ld-mmix/bpo-1.d, ld-mmix/bpo-1.s, ld-mmix/bpo-1m.d,
+ ld-mmix/bpo-15.d, ld-mmix/bpo-4.s, ld-mmix/bpo-6.d,
+ ld-mmix/bpo-6.s, ld-mmix/bpo-2.d, ld-mmix/bpo-6m.d,
+ ld-mmix/bpo-12m.d, ld-mmix/bpo-2m.d, ld-mmix/bpo-2.s,
+ ld-mmix/bpo-5.s, ld-mmix/bpo-3.d, ld-mmix/start3.s,
+ ld-mmix/bpo-3m.d, ld-mmix/bpo-9m.d, ld-mmix/bpo-4.d,
+ ld-mmix/bpo-3.s, ld-mmix/bpo-4m.d, ld-mmix/bpo-7.d,
+ ld-mmix/bpo-5.d, ld-mmix/bpo-16.d, ld-mmix/bpo-5m.d,
+ ld-mmix/bpo-7m.d, ld-mmix/bpo-9.d, ld-mmix/bpo-8.d,
+ ld-mmix/start4.s, ld-mmix/bpo-8m.d, ld-mmix/bpo-13m.d,
+ ld-mmix/bpo-15m.d, ld-mmix/bpo-10.d, ld-mmix/bpo-11.d,
+ ld-mmix/bpo-14m.d, ld-mmix/bpo-13.d, ld-mmix/bpo-7.s,
+ ld-mmix/bpo-12.d, ld-mmix/bpo-16m.d, ld-mmix/bpo-14.d,
+ ld-mmix/bpo-8.s, ld-mmix/bpo-17.d, ld-mmix/bpo-17m.d: New tests.
+
2002-01-31 Hans-Peter Nilsson <hp@axis.com>
* ld-cris/weakref1.d, ld-cris/libdso-1.d, ld-cris/gotrel2.s,
diff --git a/ld/testsuite/ld-mmix/bpo-1.d b/ld/testsuite/ld-mmix/bpo-1.d
new file mode 100644
index 0000000..7f409fc
--- /dev/null
+++ b/ld/testsuite/ld-mmix/bpo-1.d
@@ -0,0 +1,33 @@
+#source: start.s
+#source: bpo-1.s
+#as: -linker-allocated-gregs
+#ld: -m elf64mmix
+#objdump: -st
+
+# Just a simple linker-allocated GREG with no explicit GREGs.
+
+.*: file format elf64-mmix
+
+SYMBOL TABLE:
+0000000000000000 l d \.text 0+
+2000000000000000 l d \.data 0+
+2000000000000000 l d \.sbss 0+
+2000000000000000 l d \.bss 0+
+0+7f0 l d \.MMIX\.reg_contents 0+
+0+ l d \*ABS\* 0+
+0+ l d \*ABS\* 0+
+0+ l d \*ABS\* 0+
+0+4 l \.text 0+ x
+0+ g \.text 0+ _start
+2000000000000000 g O \*ABS\* 0+ __bss_start
+2000000000000000 g O \*ABS\* 0+ _edata
+2000000000000000 g O \*ABS\* 0+ _end
+0+ g O \.text 0+ _start\.
+
+
+Contents of section \.text:
+ 0000 e3fd0001 232afe00 .*
+Contents of section \.data:
+Contents of section \.sbss:
+Contents of section \.MMIX\.reg_contents:
+ 07f0 00000000 0000002e .*
diff --git a/ld/testsuite/ld-mmix/bpo-1.s b/ld/testsuite/ld-mmix/bpo-1.s
new file mode 100644
index 0000000..0a76e40
--- /dev/null
+++ b/ld/testsuite/ld-mmix/bpo-1.s
@@ -0,0 +1,2 @@
+# A most simple instruction needing a linker-supplied GREG.
+x LDA $42,x+42
diff --git a/ld/testsuite/ld-mmix/bpo-10.d b/ld/testsuite/ld-mmix/bpo-10.d
new file mode 100644
index 0000000..31aa661
--- /dev/null
+++ b/ld/testsuite/ld-mmix/bpo-10.d
@@ -0,0 +1,34 @@
+#source: start4.s
+#source: bpo-6.s
+#source: bpo-5.s
+#as: -linker-allocated-gregs
+#ld: -m elf64mmix --gc-sections
+#objdump: -st
+
+# Check that GC removes all (two) BPO:s when all are collected.
+
+.*: file format elf64-mmix
+
+SYMBOL TABLE:
+0+ l d \.init 0+
+0+4 l d \.text 0+
+2000000000000000 l d \.sbss 0+
+2000000000000000 l d \.bss 0+
+0+7f8 l d \.MMIX\.reg_contents 0+
+0+ l d \*ABS\* 0+
+0+ l d \*ABS\* 0+
+0+ l d \*ABS\* 0+
+0+ l \.init 0+ _start
+0+ g \*ABS\* 0+
+0+ g \*ABS\* 0+
+2000000000000000 g O \*ABS\* 0+ __bss_start
+2000000000000000 g O \*ABS\* 0+ _edata
+2000000000000000 g O \*ABS\* 0+ _end
+0+4 g O \.text 0+ _start\.
+
+Contents of section \.init:
+ 0000 e37704a6 .*
+Contents of section \.text:
+Contents of section \.sbss:
+Contents of section \.bss:
+Contents of section \.MMIX\.reg_contents:
diff --git a/ld/testsuite/ld-mmix/bpo-11.d b/ld/testsuite/ld-mmix/bpo-11.d
new file mode 100644
index 0000000..b863678
--- /dev/null
+++ b/ld/testsuite/ld-mmix/bpo-11.d
@@ -0,0 +1,39 @@
+#source: start3.s
+#source: bpo-6.s
+#source: bpo-2.s
+#source: bpo-5.s
+#as: -linker-allocated-gregs
+#ld: -m elf64mmix --gc-sections
+#objdump: -st
+
+# Check that GC removes one of the three BPO:s, for the collected section.
+
+.*: file format elf64-mmix
+
+SYMBOL TABLE:
+0+ l d \.init 0+
+0+10 l d \.text 0+
+20+ l d \.sbss 0+
+2000000000000000 l d \.bss 0+
+0+7e8 l d \.MMIX\.reg_contents 0+
+0+ l d \*ABS\* 0+
+0+ l d \*ABS\* 0+
+0+ l d \*ABS\* 0+
+0+ l \.init 0+ _start
+0+14 g \.text 0+ x
+0+10 g \.text 0+ x2
+2000000000000000 g O \*ABS\* 0+ __bss_start
+0+ g \*ABS\* 0+
+2000000000000000 g O \*ABS\* 0+ _edata
+2000000000000000 g O \*ABS\* 0+ _end
+0+10 g O \.text 0+ _start\.
+
+
+Contents of section \.init:
+ 0000 00000000 0000003d 00000000 0000003a .*
+Contents of section \.text:
+ 0010 232dfe00 232dfd00 .*
+Contents of section \.sbss:
+Contents of section \.bss:
+Contents of section \.MMIX\.reg_contents:
+ 07e8 00000000 0000107c 00000000 0000a420 .*
diff --git a/ld/testsuite/ld-mmix/bpo-12.d b/ld/testsuite/ld-mmix/bpo-12.d
new file mode 100644
index 0000000..2961e8b
--- /dev/null
+++ b/ld/testsuite/ld-mmix/bpo-12.d
@@ -0,0 +1,9 @@
+#source: start.s
+#source: bpo-7.s
+#source: greg-1.s
+#as: -linker-allocated-gregs
+#ld: -m elf64mmix
+#error: base-plus-offset relocation against register symbol
+
+# Check that we get an error message if we see a BPO against a register
+# symbol. Variant 1: a GREG allocated register.
diff --git a/ld/testsuite/ld-mmix/bpo-12m.d b/ld/testsuite/ld-mmix/bpo-12m.d
new file mode 100644
index 0000000..7d847fe
--- /dev/null
+++ b/ld/testsuite/ld-mmix/bpo-12m.d
@@ -0,0 +1,9 @@
+#source: start.s
+#source: bpo-7.s
+#source: greg-1.s
+#as: -linker-allocated-gregs
+#ld: -m mmo
+#error: base-plus-offset relocation against register symbol
+
+# Check that we get an error message if we see a BPO against a register
+# symbol. Variant 1: a GREG allocated register.
diff --git a/ld/testsuite/ld-mmix/bpo-13.d b/ld/testsuite/ld-mmix/bpo-13.d
new file mode 100644
index 0000000..78f7c7a
--- /dev/null
+++ b/ld/testsuite/ld-mmix/bpo-13.d
@@ -0,0 +1,9 @@
+#source: start.s
+#source: bpo-7.s
+#source: areg-256.s
+#as: -linker-allocated-gregs
+#ld: -m elf64mmix
+#error: base-plus-offset relocation against register symbol
+
+# Check that we get an error message if we see a BPO against a register
+# symbol. Variant 2: a register symbol.
diff --git a/ld/testsuite/ld-mmix/bpo-13m.d b/ld/testsuite/ld-mmix/bpo-13m.d
new file mode 100644
index 0000000..8bd0bf6
--- /dev/null
+++ b/ld/testsuite/ld-mmix/bpo-13m.d
@@ -0,0 +1,9 @@
+#source: start.s
+#source: bpo-7.s
+#source: areg-256.s
+#as: -linker-allocated-gregs
+#ld: -m mmo
+#error: base-plus-offset relocation against register symbol
+
+# Check that we get an error message if we see a BPO against a register
+# symbol. Variant 2: a register symbol.
diff --git a/ld/testsuite/ld-mmix/bpo-14.d b/ld/testsuite/ld-mmix/bpo-14.d
new file mode 100644
index 0000000..9023952
--- /dev/null
+++ b/ld/testsuite/ld-mmix/bpo-14.d
@@ -0,0 +1,33 @@
+#source: start.s
+#source: bpo-7.s
+#source: areg-t.s
+#as: -linker-allocated-gregs
+#ld: -m elf64mmix
+#objdump: -st
+
+# A BPO against an external symbol.
+
+.*: file format elf64-mmix
+
+SYMBOL TABLE:
+0+ l d \.text 0+
+2000000000000000 l d \.data 0+
+2000000000000000 l d \.sbss 0+
+2000000000000000 l d \.bss 0+
+0+7f0 l d \.MMIX\.reg_contents 0+
+0+ l d \*ABS\* 0+
+0+ l d \*ABS\* 0+
+0+ l d \*ABS\* 0+
+0+ g \.text 0+ _start
+0+8 g \.text 0+ areg
+2000000000000000 g O \*ABS\* 0+ __bss_start
+2000000000000000 g O \*ABS\* 0+ _edata
+2000000000000000 g O \*ABS\* 0+ _end
+0+ g O \.text 0+ _start\.
+
+Contents of section \.text:
+ 0000 e3fd0001 234dfe00 fd040810 .*
+Contents of section \.data:
+Contents of section \.sbss:
+Contents of section \.MMIX\.reg_contents:
+ 07f0 00000000 00000003 .*
diff --git a/ld/testsuite/ld-mmix/bpo-14m.d b/ld/testsuite/ld-mmix/bpo-14m.d
new file mode 100644
index 0000000..541b108
--- /dev/null
+++ b/ld/testsuite/ld-mmix/bpo-14m.d
@@ -0,0 +1,20 @@
+#source: start.s
+#source: bpo-7.s
+#source: areg-t.s
+#as: -linker-allocated-gregs
+#ld: -m mmo
+#objdump: -st
+
+# A BPO against an external symbol.
+
+.*: file format mmo
+
+SYMBOL TABLE:
+0+ g \.text Main
+0+ g \.text _start
+0+8 g \.text areg
+
+Contents of section \.text:
+ 0000 e3fd0001 234dfe00 fd040810 .*
+Contents of section \.MMIX\.reg_contents:
+ 07f0 00000000 00000003 .*
diff --git a/ld/testsuite/ld-mmix/bpo-15.d b/ld/testsuite/ld-mmix/bpo-15.d
new file mode 100644
index 0000000..6845a87
--- /dev/null
+++ b/ld/testsuite/ld-mmix/bpo-15.d
@@ -0,0 +1,7 @@
+#source: start.s
+#source: bpo-7.s
+#as: -linker-allocated-gregs
+#ld: -m elf64mmix
+#error: ^[^c][^h][^i][^l][^d].* undefined reference to `areg'$
+
+# A BPO against an undefined symbol.
diff --git a/ld/testsuite/ld-mmix/bpo-15m.d b/ld/testsuite/ld-mmix/bpo-15m.d
new file mode 100644
index 0000000..eacedf5
--- /dev/null
+++ b/ld/testsuite/ld-mmix/bpo-15m.d
@@ -0,0 +1,7 @@
+#source: start.s
+#source: bpo-7.s
+#as: -linker-allocated-gregs
+#ld: -m mmo
+#error: ^[^c][^h][^i][^l][^d].* undefined reference to `areg'$
+
+# A BPO against an undefined symbol.
diff --git a/ld/testsuite/ld-mmix/bpo-16.d b/ld/testsuite/ld-mmix/bpo-16.d
new file mode 100644
index 0000000..2cf77c2
--- /dev/null
+++ b/ld/testsuite/ld-mmix/bpo-16.d
@@ -0,0 +1,34 @@
+#source: start.s
+#source: bpo-7.s
+#source: bpo-7.s
+#source: areg-t.s
+#as: -linker-allocated-gregs
+#ld: -m elf64mmix
+#objdump: -st
+
+# Two BPO:s against the same value get merged.
+
+.*: file format elf64-mmix
+
+SYMBOL TABLE:
+0+ l d \.text 0+
+2000000000000000 l d \.data 0+
+2000000000000000 l d \.sbss 0+
+2000000000000000 l d \.bss 0+
+0+7f0 l d \.MMIX\.reg_contents 0+
+0+ l d \*ABS\* 0+
+0+ l d \*ABS\* 0+
+0+ l d \*ABS\* 0+
+0+ g \.text 0+ _start
+0+c g \.text 0+ areg
+2000000000000000 g O \*ABS\* 0+ __bss_start
+2000000000000000 g O \*ABS\* 0+ _edata
+2000000000000000 g O \*ABS\* 0+ _end
+0+ g O \.text 0+ _start\.
+
+Contents of section \.text:
+ 0000 e3fd0001 234dfe00 234dfe00 fd040810 .*
+Contents of section \.data:
+Contents of section \.sbss:
+Contents of section \.MMIX\.reg_contents:
+ 07f0 00000000 00000007 .*
diff --git a/ld/testsuite/ld-mmix/bpo-16m.d b/ld/testsuite/ld-mmix/bpo-16m.d
new file mode 100644
index 0000000..f1fe336
--- /dev/null
+++ b/ld/testsuite/ld-mmix/bpo-16m.d
@@ -0,0 +1,21 @@
+#source: start.s
+#source: bpo-7.s
+#source: bpo-7.s
+#source: areg-t.s
+#as: -linker-allocated-gregs
+#ld: -m mmo
+#objdump: -st
+
+# Two BPO:s against the same value get merged.
+
+.*: file format mmo
+
+SYMBOL TABLE:
+0+ g \.text Main
+0+ g \.text _start
+0+c g \.text areg
+
+Contents of section \.text:
+ 0000 e3fd0001 234dfe00 234dfe00 fd040810 .*
+Contents of section \.MMIX\.reg_contents:
+ 07f0 00000000 00000007 .*
diff --git a/ld/testsuite/ld-mmix/bpo-17.d b/ld/testsuite/ld-mmix/bpo-17.d
new file mode 100644
index 0000000..effb972
--- /dev/null
+++ b/ld/testsuite/ld-mmix/bpo-17.d
@@ -0,0 +1,34 @@
+#source: start.s
+#source: bpo-8.s
+#source: areg-t.s
+#as: -linker-allocated-gregs
+#ld: -m elf64mmix
+#objdump: -st
+
+# A BPO and another reloc in the same section.
+
+.*: file format elf64-mmix
+
+SYMBOL TABLE:
+0+ l d \.text 0+
+2000000000000000 l d \.data 0+
+2000000000000000 l d \.sbss 0+
+2000000000000000 l d \.bss 0+
+0+7f0 l d \.MMIX\.reg_contents 0+
+0+ l d \*ABS\* 0+
+0+ l d \*ABS\* 0+
+0+ l d \*ABS\* 0+
+0+ g \.text 0+ _start
+0+10 g \.text 0+ areg
+2000000000000000 g O \*ABS\* 0+ __bss_start
+2000000000000000 g O \*ABS\* 0+ _edata
+2000000000000000 g O \*ABS\* 0+ _end
+0+ g O \.text 0+ _start\.
+
+Contents of section \.text:
+ 0000 e3fd0001 2336fe00 00000000 0000000c .*
+ 0010 fd040810 .*
+Contents of section \.data:
+Contents of section \.sbss:
+Contents of section \.MMIX\.reg_contents:
+ 07f0 00000000 00000008 .*
diff --git a/ld/testsuite/ld-mmix/bpo-17m.d b/ld/testsuite/ld-mmix/bpo-17m.d
new file mode 100644
index 0000000..6458ebe
--- /dev/null
+++ b/ld/testsuite/ld-mmix/bpo-17m.d
@@ -0,0 +1,22 @@
+#source: start.s
+#source: bpo-8.s
+#source: areg-t.s
+#as: -linker-allocated-gregs
+#ld: -m mmo
+#objdump: -st
+
+# A BPO and another reloc in the same section.
+
+.*: file format mmo
+
+SYMBOL TABLE:
+0+ g \.text Main
+0+ g \.text _start
+0+10 g \.text areg
+
+
+Contents of section \.text:
+ 0000 e3fd0001 2336fe00 00000000 0000000c .*
+ 0010 fd040810 .*
+Contents of section \.MMIX\.reg_contents:
+ 07f0 00000000 00000008 .*
diff --git a/ld/testsuite/ld-mmix/bpo-1m.d b/ld/testsuite/ld-mmix/bpo-1m.d
new file mode 100644
index 0000000..b2d0384
--- /dev/null
+++ b/ld/testsuite/ld-mmix/bpo-1m.d
@@ -0,0 +1,18 @@
+#source: start.s
+#source: bpo-1.s
+#as: -linker-allocated-gregs
+#ld: -m mmo
+#objdump: -st
+
+# Just a simple linker-allocated GREG with no explicit GREGs.
+
+.*: file format mmo
+
+SYMBOL TABLE:
+0+ g \.text Main
+0+ g \.text _start
+
+Contents of section \.text:
+ 0000 e3fd0001 232afe00 .*
+Contents of section \.MMIX\.reg_contents:
+ 07f0 00000000 0000002e .*
diff --git a/ld/testsuite/ld-mmix/bpo-2.d b/ld/testsuite/ld-mmix/bpo-2.d
new file mode 100644
index 0000000..a0c362b
--- /dev/null
+++ b/ld/testsuite/ld-mmix/bpo-2.d
@@ -0,0 +1,34 @@
+#source: start.s
+#source: greg-1.s
+#source: bpo-1.s
+#as: -linker-allocated-gregs
+#ld: -m elf64mmix
+#objdump: -st
+
+# Just a simple linker-allocated GREG plus one explicit GREG.
+
+.*: file format elf64-mmix
+
+SYMBOL TABLE:
+0+ l d \.text 0+
+2000000000000000 l d \.data 0+
+2000000000000000 l d \.sbss 0+
+2000000000000000 l d \.bss 0+
+0+7e8 l d \.MMIX\.reg_contents 0+
+0+ l d \*ABS\* 0+
+0+ l d \*ABS\* 0+
+0+ l d \*ABS\* 0+
+0+4 l \.text 0+ x
+0+ g \.text 0+ _start
+0+fe g \*REG\* 0+ areg
+2000000000000000 g O \*ABS\* 0+ __bss_start
+2000000000000000 g O \*ABS\* 0+ _edata
+2000000000000000 g O \*ABS\* 0+ _end
+0+ g O \.text 0+ _start\.
+
+Contents of section \.text:
+ 0000 e3fd0001 232afd00 .*
+Contents of section \.data:
+Contents of section \.sbss:
+Contents of section \.MMIX\.reg_contents:
+ 07e8 00000000 0000002e 00007048 860f3a38 .*
diff --git a/ld/testsuite/ld-mmix/bpo-2.s b/ld/testsuite/ld-mmix/bpo-2.s
new file mode 100644
index 0000000..02c7901
--- /dev/null
+++ b/ld/testsuite/ld-mmix/bpo-2.s
@@ -0,0 +1,2 @@
+ .global y
+y LDA $33,y+8
diff --git a/ld/testsuite/ld-mmix/bpo-2m.d b/ld/testsuite/ld-mmix/bpo-2m.d
new file mode 100644
index 0000000..7ddcfd2
--- /dev/null
+++ b/ld/testsuite/ld-mmix/bpo-2m.d
@@ -0,0 +1,21 @@
+#source: start.s
+#source: greg-1.s
+#source: bpo-1.s
+#as: -linker-allocated-gregs
+#ld: -m mmo
+#objdump: -st
+
+# Just a simple linker-allocated GREG plus one explicit GREG.
+
+.*: file format mmo
+
+SYMBOL TABLE:
+0+ g \.text Main
+0+ g \.text _start
+0+fe g \*REG\* areg
+
+Contents of section \.text:
+ 0000 e3fd0001 232afd00 .*
+Contents of section \.MMIX\.reg_contents:
+ 07e8 00000000 0000002e 00007048 860f3a38 .*
+
diff --git a/ld/testsuite/ld-mmix/bpo-3.d b/ld/testsuite/ld-mmix/bpo-3.d
new file mode 100644
index 0000000..c8c3078
--- /dev/null
+++ b/ld/testsuite/ld-mmix/bpo-3.d
@@ -0,0 +1,34 @@
+#source: start.s
+#source: bpo-1.s
+#source: bpo-2.s
+#as: -linker-allocated-gregs
+#ld: -m elf64mmix
+#objdump: -st
+
+# Just two BPO relocs merged as one linker-allocated GREG.
+
+.*: file format elf64-mmix
+
+SYMBOL TABLE:
+0+ l d \.text 0+
+2000000000000000 l d \.data 0+
+2000000000000000 l d \.sbss 0+
+2000000000000000 l d \.bss 0+
+0+7f0 l d \.MMIX\.reg_contents 0+
+0+ l d \*ABS\* 0+
+0+ l d \*ABS\* 0+
+0+ l d \*ABS\* 0+
+0+4 l \.text 0+ x
+0+ g \.text 0+ _start
+2000000000000000 g O \*ABS\* 0+ __bss_start
+0+8 g \.text 0+ y
+2000000000000000 g O \*ABS\* 0+ _edata
+2000000000000000 g O \*ABS\* 0+ _end
+0+ g O \.text 0+ _start\.
+
+Contents of section \.text:
+ 0000 e3fd0001 232afe1e 2321fe00 .*
+Contents of section \.data:
+Contents of section \.sbss:
+Contents of section \.MMIX\.reg_contents:
+ 07f0 00000000 00000010 .*
diff --git a/ld/testsuite/ld-mmix/bpo-3.s b/ld/testsuite/ld-mmix/bpo-3.s
new file mode 100644
index 0000000..b975a82
--- /dev/null
+++ b/ld/testsuite/ld-mmix/bpo-3.s
@@ -0,0 +1 @@
+ LDOU $121,_start+42+4+4+257
diff --git a/ld/testsuite/ld-mmix/bpo-3m.d b/ld/testsuite/ld-mmix/bpo-3m.d
new file mode 100644
index 0000000..c0f4707
--- /dev/null
+++ b/ld/testsuite/ld-mmix/bpo-3m.d
@@ -0,0 +1,20 @@
+#source: start.s
+#source: bpo-1.s
+#source: bpo-2.s
+#as: -linker-allocated-gregs
+#ld: -m mmo
+#objdump: -st
+
+# Just two BPO relocs merged as one linker-allocated GREG.
+
+.*: file format mmo
+
+SYMBOL TABLE:
+0+ g \.text Main
+0+ g \.text _start
+0+8 g \.text y
+
+Contents of section \.text:
+ 0000 e3fd0001 232afe1e 2321fe00 .*
+Contents of section \.MMIX\.reg_contents:
+ 07f0 00000000 00000010 .*
diff --git a/ld/testsuite/ld-mmix/bpo-4.d b/ld/testsuite/ld-mmix/bpo-4.d
new file mode 100644
index 0000000..1255202
--- /dev/null
+++ b/ld/testsuite/ld-mmix/bpo-4.d
@@ -0,0 +1,36 @@
+#source: start.s
+#source: greg-1.s
+#source: bpo-3.s
+#source: bpo-1.s
+#as: -linker-allocated-gregs
+#ld: -m elf64mmix
+#objdump: -st
+
+# Three GREGs: one explicit, two linker-allocated.
+
+.*: file format elf64-mmix
+
+SYMBOL TABLE:
+0+ l d \.text 0+
+2000000000000000 l d \.data 0+
+2000000000000000 l d \.sbss 0+
+2000000000000000 l d \.bss 0+
+0+7e0 l d \.MMIX\.reg_contents 0+
+0+ l d \*ABS\* 0+
+0+ l d \*ABS\* 0+
+0+ l d \*ABS\* 0+
+0+8 l \.text 0+ x
+0+ g \.text 0+ _start
+0+fe g \*REG\* 0+ areg
+2000000000000000 g O \*ABS\* 0+ __bss_start
+2000000000000000 g O \*ABS\* 0+ _edata
+2000000000000000 g O \*ABS\* 0+ _end
+0+ g O \.text 0+ _start\.
+
+Contents of section \.text:
+ 0000 e3fd0001 8f79fd00 232afc00 .*
+Contents of section \.data:
+Contents of section \.sbss:
+Contents of section \.MMIX\.reg_contents:
+ 07e0 00000000 00000032 00000000 00000133 .*
+ 07f0 00007048 860f3a38 .*
diff --git a/ld/testsuite/ld-mmix/bpo-4.s b/ld/testsuite/ld-mmix/bpo-4.s
new file mode 100644
index 0000000..c5c21cf
--- /dev/null
+++ b/ld/testsuite/ld-mmix/bpo-4.s
@@ -0,0 +1,5 @@
+ .set i,0
+ .rept 223
+ LDA $11,_start+i*256
+ .set i,i+1
+ .endr
diff --git a/ld/testsuite/ld-mmix/bpo-4m.d b/ld/testsuite/ld-mmix/bpo-4m.d
new file mode 100644
index 0000000..2f3b59c
--- /dev/null
+++ b/ld/testsuite/ld-mmix/bpo-4m.d
@@ -0,0 +1,22 @@
+#source: start.s
+#source: greg-1.s
+#source: bpo-3.s
+#source: bpo-1.s
+#as: -linker-allocated-gregs
+#ld: -m mmo
+#objdump: -st
+
+# Three GREGs: one explicit, two linker-allocated.
+
+.*: file format mmo
+
+SYMBOL TABLE:
+0+ g \.text Main
+0+ g \.text _start
+0+fe g \*REG\* areg
+
+Contents of section \.text:
+ 0000 e3fd0001 8f79fd00 232afc00 .*
+Contents of section \.MMIX\.reg_contents:
+ 07e0 00000000 00000032 00000000 00000133 .*
+ 07f0 00007048 860f3a38 .*
diff --git a/ld/testsuite/ld-mmix/bpo-5.d b/ld/testsuite/ld-mmix/bpo-5.d
new file mode 100644
index 0000000..bc9ac38
--- /dev/null
+++ b/ld/testsuite/ld-mmix/bpo-5.d
@@ -0,0 +1,35 @@
+#source: start.s
+#source: bpo-1.s
+#source: bpo-3.s
+#source: bpo-2.s
+#as: -linker-allocated-gregs
+#ld: -m elf64mmix
+#objdump: -st
+
+# Three linker-allocated GREGs: one eliminated.
+
+.*: file format elf64-mmix
+
+SYMBOL TABLE:
+0+ l d \.text 0+
+2000000000000000 l d \.data 0+
+2000000000000000 l d \.sbss 0+
+2000000000000000 l d \.bss 0+
+0+7e8 l d \.MMIX\.reg_contents 0+
+0+ l d \*ABS\* 0+
+0+ l d \*ABS\* 0+
+0+ l d \*ABS\* 0+
+0+4 l \.text 0+ x
+0+ g \.text 0+ _start
+2000000000000000 g O \*ABS\* 0+ __bss_start
+0+c g \.text 0+ y
+2000000000000000 g O \*ABS\* 0+ _edata
+2000000000000000 g O \*ABS\* 0+ _end
+0+ g O \.text 0+ _start\.
+
+Contents of section \.text:
+ 0000 e3fd0001 232afd1a 8f79fe00 2321fd00 .*
+Contents of section \.data:
+Contents of section \.sbss:
+Contents of section \.MMIX\.reg_contents:
+ 07e8 00000000 00000014 00000000 00000133 .*
diff --git a/ld/testsuite/ld-mmix/bpo-5.s b/ld/testsuite/ld-mmix/bpo-5.s
new file mode 100644
index 0000000..c0fcfac
--- /dev/null
+++ b/ld/testsuite/ld-mmix/bpo-5.s
@@ -0,0 +1,4 @@
+# A section with a symbol and a BPO allocation.
+ .section .text.x,"ax",@progbits
+ .global x
+x LDA $45,x+4200
diff --git a/ld/testsuite/ld-mmix/bpo-5m.d b/ld/testsuite/ld-mmix/bpo-5m.d
new file mode 100644
index 0000000..078d34e
--- /dev/null
+++ b/ld/testsuite/ld-mmix/bpo-5m.d
@@ -0,0 +1,21 @@
+#source: start.s
+#source: bpo-1.s
+#source: bpo-3.s
+#source: bpo-2.s
+#as: -linker-allocated-gregs
+#ld: -m mmo
+#objdump: -st
+
+# Three linker-allocated GREGs: one eliminated.
+
+.*: file format mmo
+
+SYMBOL TABLE:
+0+ g \.text Main
+0+ g \.text _start
+0+c g \.text y
+
+Contents of section \.text:
+ 0000 e3fd0001 232afd1a 8f79fe00 2321fd00 .*
+Contents of section \.MMIX\.reg_contents:
+ 07e8 00000000 00000014 00000000 00000133 .*
diff --git a/ld/testsuite/ld-mmix/bpo-6.d b/ld/testsuite/ld-mmix/bpo-6.d
new file mode 100644
index 0000000..4edd4ab
--- /dev/null
+++ b/ld/testsuite/ld-mmix/bpo-6.d
@@ -0,0 +1,41 @@
+#source: start.s
+#source: bpo-4.s
+#as: -linker-allocated-gregs
+#ld: -m elf64mmix
+#objdump: -st
+
+# 223 (max) linker-allocated GREGs.
+
+.*: file format elf64-mmix
+
+SYMBOL TABLE:
+0+ l d \.text 0+
+2000000000000000 l d \.data 0+
+2000000000000000 l d \.sbss 0+
+2000000000000000 l d \.bss 0+
+0+100 l d \.MMIX\.reg_contents 0+
+0+ l d \*ABS\* 0+
+0+ l d \*ABS\* 0+
+0+ l d \*ABS\* 0+
+0+df l \*ABS\* 0+ i
+0+ g \.text 0+ _start
+2000000000000000 g O \*ABS\* 0+ __bss_start
+2000000000000000 g O \*ABS\* 0+ _edata
+2000000000000000 g O \*ABS\* 0+ _end
+0+ g O \.text 0+ _start\.
+
+Contents of section \.text:
+ 0000 e3fd0001 230b2000 230b2100 230b2200 .*
+ 0010 230b2300 230b2400 230b2500 230b2600 .*
+#...
+ 0360 230bf700 230bf800 230bf900 230bfa00 .*
+ 0370 230bfb00 230bfc00 230bfd00 230bfe00 .*
+Contents of section \.data:
+Contents of section \.sbss:
+Contents of section \.MMIX\.reg_contents:
+ 0100 00000000 00000000 00000000 00000100 .*
+ 0110 00000000 00000200 00000000 00000300 .*
+#...
+ 07d0 00000000 0000da00 00000000 0000db00 .*
+ 07e0 00000000 0000dc00 00000000 0000dd00 .*
+ 07f0 00000000 0000de00 .*
diff --git a/ld/testsuite/ld-mmix/bpo-6.s b/ld/testsuite/ld-mmix/bpo-6.s
new file mode 100644
index 0000000..a10e9a8
--- /dev/null
+++ b/ld/testsuite/ld-mmix/bpo-6.s
@@ -0,0 +1,4 @@
+# A section with a symbol and a BPO allocation.
+ .section .text.x2,"ax",@progbits
+ .global x2
+x2 LDA $45,x2+42000
diff --git a/ld/testsuite/ld-mmix/bpo-6m.d b/ld/testsuite/ld-mmix/bpo-6m.d
new file mode 100644
index 0000000..9d8e304
--- /dev/null
+++ b/ld/testsuite/ld-mmix/bpo-6m.d
@@ -0,0 +1,27 @@
+#source: start.s
+#source: bpo-4.s
+#as: -linker-allocated-gregs
+#ld: -m mmo
+#objdump: -st
+
+# 223 (max) linker-allocated GREGs.
+
+.*: file format mmo
+
+SYMBOL TABLE:
+0+ g \.text Main
+0+ g \.text _start
+
+Contents of section \.text:
+ 0000 e3fd0001 230b2000 230b2100 230b2200 .*
+ 0010 230b2300 230b2400 230b2500 230b2600 .*
+#...
+ 0360 230bf700 230bf800 230bf900 230bfa00 .*
+ 0370 230bfb00 230bfc00 230bfd00 230bfe00 .*
+Contents of section \.MMIX\.reg_contents:
+ 0100 00000000 00000000 00000000 00000100 .*
+ 0110 00000000 00000200 00000000 00000300 .*
+#...
+ 07d0 00000000 0000da00 00000000 0000db00 .*
+ 07e0 00000000 0000dc00 00000000 0000dd00 .*
+ 07f0 00000000 0000de00 .*
diff --git a/ld/testsuite/ld-mmix/bpo-7.d b/ld/testsuite/ld-mmix/bpo-7.d
new file mode 100644
index 0000000..693a502
--- /dev/null
+++ b/ld/testsuite/ld-mmix/bpo-7.d
@@ -0,0 +1,6 @@
+#source: start.s
+#source: bpo-4.s
+#source: greg-1.s
+#as: -linker-allocated-gregs
+#ld: -m elf64mmix
+#error: Too many global registers: 224
diff --git a/ld/testsuite/ld-mmix/bpo-7.s b/ld/testsuite/ld-mmix/bpo-7.s
new file mode 100644
index 0000000..b920764
--- /dev/null
+++ b/ld/testsuite/ld-mmix/bpo-7.s
@@ -0,0 +1,2 @@
+# If the symbol is a register then this is an error.
+ LDA $77,areg-5
diff --git a/ld/testsuite/ld-mmix/bpo-7m.d b/ld/testsuite/ld-mmix/bpo-7m.d
new file mode 100644
index 0000000..21c4659
--- /dev/null
+++ b/ld/testsuite/ld-mmix/bpo-7m.d
@@ -0,0 +1,6 @@
+#source: start.s
+#source: bpo-4.s
+#source: greg-1.s
+#as: -linker-allocated-gregs
+#ld: -m mmo
+#error: Too many global registers: 224
diff --git a/ld/testsuite/ld-mmix/bpo-8.d b/ld/testsuite/ld-mmix/bpo-8.d
new file mode 100644
index 0000000..438b072
--- /dev/null
+++ b/ld/testsuite/ld-mmix/bpo-8.d
@@ -0,0 +1,7 @@
+#source: start.s
+#source: bpo-4.s
+#source: pad2p18m32.s
+#source: bpo-1.s
+#as: -linker-allocated-gregs
+#ld: -m elf64mmix
+#error: Too many global registers: 224
diff --git a/ld/testsuite/ld-mmix/bpo-8.s b/ld/testsuite/ld-mmix/bpo-8.s
new file mode 100644
index 0000000..ebe410d
--- /dev/null
+++ b/ld/testsuite/ld-mmix/bpo-8.s
@@ -0,0 +1,3 @@
+# A BPO and an ordinary reloc in the same section.
+ LDA $54,areg-8
+ .quad areg-4
diff --git a/ld/testsuite/ld-mmix/bpo-8m.d b/ld/testsuite/ld-mmix/bpo-8m.d
new file mode 100644
index 0000000..9187672
--- /dev/null
+++ b/ld/testsuite/ld-mmix/bpo-8m.d
@@ -0,0 +1,7 @@
+#source: start.s
+#source: bpo-4.s
+#source: pad2p18m32.s
+#source: bpo-1.s
+#as: -linker-allocated-gregs
+#ld: -m mmo
+#error: Too many global registers: 224
diff --git a/ld/testsuite/ld-mmix/bpo-9.d b/ld/testsuite/ld-mmix/bpo-9.d
new file mode 100644
index 0000000..00e2545
--- /dev/null
+++ b/ld/testsuite/ld-mmix/bpo-9.d
@@ -0,0 +1,36 @@
+#source: start3.s
+#source: bpo-6.s
+#source: bpo-5.s
+#as: -linker-allocated-gregs
+#ld: -m elf64mmix --gc-sections
+#objdump: -st
+
+# Check that GC does not mess up things when no BPO:s are collected.
+
+.*: file format elf64-mmix
+
+SYMBOL TABLE:
+0+ l d \.init 0+
+0+10 l d \.text 0+
+20+ l d \.sbss 0+
+2000000000000000 l d \.bss 0+
+0+7e8 l d \.MMIX\.reg_contents 0+
+0+ l d \*ABS\* 0+
+0+ l d \*ABS\* 0+
+0+ l d \*ABS\* 0+
+0+ l \.init 0+ _start
+0+14 g \.text 0+ x
+0+10 g \.text 0+ x2
+2000000000000000 g O \*ABS\* 0+ __bss_start
+2000000000000000 g O \*ABS\* 0+ _edata
+2000000000000000 g O \*ABS\* 0+ _end
+0+10 g O \.text 0+ _start\.
+
+Contents of section \.init:
+ 0000 00000000 0000003d 00000000 0000003a .*
+Contents of section \.text:
+ 0010 232dfe00 232dfd00 .*
+Contents of section \.sbss:
+Contents of section \.bss:
+Contents of section \.MMIX\.reg_contents:
+ 07e8 00000000 0000107c 00000000 0000a420 .*
diff --git a/ld/testsuite/ld-mmix/bpo-9m.d b/ld/testsuite/ld-mmix/bpo-9m.d
new file mode 100644
index 0000000..fa3f97c
--- /dev/null
+++ b/ld/testsuite/ld-mmix/bpo-9m.d
@@ -0,0 +1,22 @@
+#source: start3.s
+#source: bpo-6.s
+#source: bpo-5.s
+#as: -linker-allocated-gregs
+#ld: -m mmo --gc-sections
+#objdump: -st
+
+# Check that GC does not mess up things when no BPO:s are collected.
+# Note that mmo doesn't support GC at the moment; it's a nop.
+
+.*: file format mmo
+
+SYMBOL TABLE:
+0+ g \.text Main
+0+4 g \.text x
+0+ g \.text x2
+
+Contents of section \.text:
+ 0000 232dfe00 232dfd00 00000000 0000002d .*
+ 0010 00000000 0000002a .*
+Contents of section \.MMIX\.reg_contents:
+ 07e8 00000000 0000106c 00000000 0000a410 .*
diff --git a/ld/testsuite/ld-mmix/start3.s b/ld/testsuite/ld-mmix/start3.s
new file mode 100644
index 0000000..1055870
--- /dev/null
+++ b/ld/testsuite/ld-mmix/start3.s
@@ -0,0 +1,7 @@
+# When GC, all sections in each file must be referenced from within a kept
+# section.
+ .section .init,"ax",@progbits
+_start:
+ .quad x+41
+ .quad x2+42
+
diff --git a/ld/testsuite/ld-mmix/start4.s b/ld/testsuite/ld-mmix/start4.s
new file mode 100644
index 0000000..4948d78
--- /dev/null
+++ b/ld/testsuite/ld-mmix/start4.s
@@ -0,0 +1,6 @@
+# When GC, all sections in each file must be referenced from within a kept
+# section (which .init is, which .text isn't). Here, we don't refer to
+# anything so whatever is linked will be discarded.
+ .section .init,"ax",@progbits
+_start:
+ SETL $119,1190