aboutsummaryrefslogtreecommitdiff
path: root/ld/testsuite
diff options
context:
space:
mode:
Diffstat (limited to 'ld/testsuite')
-rw-r--r--ld/testsuite/ChangeLog4
-rw-r--r--ld/testsuite/ld-mmix/a.s5
-rw-r--r--ld/testsuite/ld-mmix/areg-256.s2
-rw-r--r--ld/testsuite/ld-mmix/areg-t.s3
-rw-r--r--ld/testsuite/ld-mmix/aregm.s5
-rw-r--r--ld/testsuite/ld-mmix/b-badfil1.d7
-rw-r--r--ld/testsuite/ld-mmix/b-badfil1.s10
-rw-r--r--ld/testsuite/ld-mmix/b-badfil2.d7
-rw-r--r--ld/testsuite/ld-mmix/b-badfil2.s6
-rw-r--r--ld/testsuite/ld-mmix/b-badfixo.d7
-rw-r--r--ld/testsuite/ld-mmix/b-badfixo.s5
-rw-r--r--ld/testsuite/ld-mmix/b-badloc.d7
-rw-r--r--ld/testsuite/ld-mmix/b-badloc.s5
-rw-r--r--ld/testsuite/ld-mmix/b-badlop.d7
-rw-r--r--ld/testsuite/ld-mmix/b-badlop.s4
-rw-r--r--ld/testsuite/ld-mmix/b-badm.d6
-rw-r--r--ld/testsuite/ld-mmix/b-badm2.s6
-rw-r--r--ld/testsuite/ld-mmix/b-badmain.s7
-rw-r--r--ld/testsuite/ld-mmix/b-badquot.d7
-rw-r--r--ld/testsuite/ld-mmix/b-badquot.s5
-rw-r--r--ld/testsuite/ld-mmix/b-badrx1.d7
-rw-r--r--ld/testsuite/ld-mmix/b-badrx1.s6
-rw-r--r--ld/testsuite/ld-mmix/b-badrx2.d7
-rw-r--r--ld/testsuite/ld-mmix/b-badrx2.s6
-rw-r--r--ld/testsuite/ld-mmix/b-badrx3.d7
-rw-r--r--ld/testsuite/ld-mmix/b-badrx3.s6
-rw-r--r--ld/testsuite/ld-mmix/b-bend.s6
-rw-r--r--ld/testsuite/ld-mmix/b-bend1.d11
-rw-r--r--ld/testsuite/ld-mmix/b-bend2.d10
-rw-r--r--ld/testsuite/ld-mmix/b-bend3.d6
-rw-r--r--ld/testsuite/ld-mmix/b-bstab1.d7
-rw-r--r--ld/testsuite/ld-mmix/b-bstab1.s5
-rw-r--r--ld/testsuite/ld-mmix/b-fixo2.d28
-rw-r--r--ld/testsuite/ld-mmix/b-fixo2.s6
-rw-r--r--ld/testsuite/ld-mmix/b-goodmain.s5
-rw-r--r--ld/testsuite/ld-mmix/b-loc64k.d25
-rw-r--r--ld/testsuite/ld-mmix/b-loc64k.s8
-rw-r--r--ld/testsuite/ld-mmix/b-nosym.d15
-rw-r--r--ld/testsuite/ld-mmix/b-nosym.s6
-rw-r--r--ld/testsuite/ld-mmix/b-post1.s5
-rw-r--r--ld/testsuite/ld-mmix/b-twoinsn.s7
-rw-r--r--ld/testsuite/ld-mmix/b-widec.s7
-rw-r--r--ld/testsuite/ld-mmix/b-widec1.d12
-rw-r--r--ld/testsuite/ld-mmix/b-widec2.d6
-rw-r--r--ld/testsuite/ld-mmix/b-widec2.s7
-rw-r--r--ld/testsuite/ld-mmix/b-widec3.d6
-rw-r--r--ld/testsuite/ld-mmix/b-widec3.s9
-rw-r--r--ld/testsuite/ld-mmix/bspec1.d58
-rw-r--r--ld/testsuite/ld-mmix/bspec1.s3
-rw-r--r--ld/testsuite/ld-mmix/bspec1m.d16
-rw-r--r--ld/testsuite/ld-mmix/bspec2.d68
-rw-r--r--ld/testsuite/ld-mmix/bspec2.s3
-rw-r--r--ld/testsuite/ld-mmix/bspec2m.d22
-rw-r--r--ld/testsuite/ld-mmix/bspec801.s3
-rw-r--r--ld/testsuite/ld-mmix/bspec802.s7
-rw-r--r--ld/testsuite/ld-mmix/bspec803.s9
-rw-r--r--ld/testsuite/ld-mmix/bspec804.s9
-rw-r--r--ld/testsuite/ld-mmix/bspec805.s10
-rw-r--r--ld/testsuite/ld-mmix/bspec806.s10
-rw-r--r--ld/testsuite/ld-mmix/bspec807.s9
-rw-r--r--ld/testsuite/ld-mmix/bspec808.s9
-rw-r--r--ld/testsuite/ld-mmix/bza-1b.d26
-rw-r--r--ld/testsuite/ld-mmix/bza-1f.d26
-rw-r--r--ld/testsuite/ld-mmix/bza-2b.d21
-rw-r--r--ld/testsuite/ld-mmix/bza-2f.d21
-rw-r--r--ld/testsuite/ld-mmix/bza-7b.d26
-rw-r--r--ld/testsuite/ld-mmix/bza-7f.d26
-rw-r--r--ld/testsuite/ld-mmix/bza-8b.d21
-rw-r--r--ld/testsuite/ld-mmix/bza-8f.d21
-rw-r--r--ld/testsuite/ld-mmix/bza.s7
-rw-r--r--ld/testsuite/ld-mmix/data1.s2
-rw-r--r--ld/testsuite/ld-mmix/dloc1.s4
-rw-r--r--ld/testsuite/ld-mmix/dloc2.s3
-rw-r--r--ld/testsuite/ld-mmix/ext1-254.s2
-rw-r--r--ld/testsuite/ld-mmix/ext1.s2
-rw-r--r--ld/testsuite/ld-mmix/ext1g.s2
-rw-r--r--ld/testsuite/ld-mmix/ext1l.s2
-rw-r--r--ld/testsuite/ld-mmix/getaa-1b.d24
-rw-r--r--ld/testsuite/ld-mmix/getaa-1f.d24
-rw-r--r--ld/testsuite/ld-mmix/getaa-2b.d21
-rw-r--r--ld/testsuite/ld-mmix/getaa-2f.d21
-rw-r--r--ld/testsuite/ld-mmix/getaa-4b.d26
-rw-r--r--ld/testsuite/ld-mmix/getaa-4f.d25
-rw-r--r--ld/testsuite/ld-mmix/getaa-6b.d11
-rw-r--r--ld/testsuite/ld-mmix/getaa-6f.d10
-rw-r--r--ld/testsuite/ld-mmix/getaa-7b.d24
-rw-r--r--ld/testsuite/ld-mmix/getaa-7f.d24
-rw-r--r--ld/testsuite/ld-mmix/getaa-8b.d21
-rw-r--r--ld/testsuite/ld-mmix/getaa-8f.d21
-rw-r--r--ld/testsuite/ld-mmix/getaa.s7
-rw-r--r--ld/testsuite/ld-mmix/getaa12b.d26
-rw-r--r--ld/testsuite/ld-mmix/getaa12f.d25
-rw-r--r--ld/testsuite/ld-mmix/getaa14b.d11
-rw-r--r--ld/testsuite/ld-mmix/getaa14f.d10
-rw-r--r--ld/testsuite/ld-mmix/greg-1.d36
-rw-r--r--ld/testsuite/ld-mmix/greg-1.s3
-rw-r--r--ld/testsuite/ld-mmix/greg-10.d25
-rw-r--r--ld/testsuite/ld-mmix/greg-11.d39
-rw-r--r--ld/testsuite/ld-mmix/greg-11b.d32
-rw-r--r--ld/testsuite/ld-mmix/greg-12.d34
-rw-r--r--ld/testsuite/ld-mmix/greg-13.d33
-rw-r--r--ld/testsuite/ld-mmix/greg-14.d32
-rw-r--r--ld/testsuite/ld-mmix/greg-15.d59
-rw-r--r--ld/testsuite/ld-mmix/greg-16.d59
-rw-r--r--ld/testsuite/ld-mmix/greg-17.d37
-rw-r--r--ld/testsuite/ld-mmix/greg-18.d39
-rw-r--r--ld/testsuite/ld-mmix/greg-19.d32
-rw-r--r--ld/testsuite/ld-mmix/greg-2.d50
-rw-r--r--ld/testsuite/ld-mmix/greg-2.s3
-rw-r--r--ld/testsuite/ld-mmix/greg-20.d18
-rw-r--r--ld/testsuite/ld-mmix/greg-3.d45
-rw-r--r--ld/testsuite/ld-mmix/greg-3.s3
-rw-r--r--ld/testsuite/ld-mmix/greg-4.d44
-rw-r--r--ld/testsuite/ld-mmix/greg-4.s2
-rw-r--r--ld/testsuite/ld-mmix/greg-5.d43
-rw-r--r--ld/testsuite/ld-mmix/greg-5.s20
-rw-r--r--ld/testsuite/ld-mmix/greg-6.d292
-rw-r--r--ld/testsuite/ld-mmix/greg-7.d292
-rw-r--r--ld/testsuite/ld-mmix/greg-8.d37
-rw-r--r--ld/testsuite/ld-mmix/greg-9.d39
-rw-r--r--ld/testsuite/ld-mmix/gregbza1.s4
-rw-r--r--ld/testsuite/ld-mmix/gregget1.s4
-rw-r--r--ld/testsuite/ld-mmix/gregget2.s4
-rw-r--r--ld/testsuite/ld-mmix/gregldo1.s6
-rw-r--r--ld/testsuite/ld-mmix/gregpsj1.s4
-rw-r--r--ld/testsuite/ld-mmix/hdr-1.d19
-rw-r--r--ld/testsuite/ld-mmix/jumpa-1b.d25
-rw-r--r--ld/testsuite/ld-mmix/jumpa-1f.d25
-rw-r--r--ld/testsuite/ld-mmix/jumpa-2b.d21
-rw-r--r--ld/testsuite/ld-mmix/jumpa-2f.d21
-rw-r--r--ld/testsuite/ld-mmix/jumpa-3b.d30
-rw-r--r--ld/testsuite/ld-mmix/jumpa-3f.d28
-rw-r--r--ld/testsuite/ld-mmix/jumpa-4b.d26
-rw-r--r--ld/testsuite/ld-mmix/jumpa-4f.d25
-rw-r--r--ld/testsuite/ld-mmix/jumpa-5b.d31
-rw-r--r--ld/testsuite/ld-mmix/jumpa-5f.d29
-rw-r--r--ld/testsuite/ld-mmix/jumpa-6b.d11
-rw-r--r--ld/testsuite/ld-mmix/jumpa-6f.d10
-rw-r--r--ld/testsuite/ld-mmix/jumpa-7b.d25
-rw-r--r--ld/testsuite/ld-mmix/jumpa-7f.d25
-rw-r--r--ld/testsuite/ld-mmix/jumpa-8b.d21
-rw-r--r--ld/testsuite/ld-mmix/jumpa-8f.d21
-rw-r--r--ld/testsuite/ld-mmix/jumpa-9b.d30
-rw-r--r--ld/testsuite/ld-mmix/jumpa-9f.d28
-rw-r--r--ld/testsuite/ld-mmix/jumpa.s7
-rw-r--r--ld/testsuite/ld-mmix/jumpa12b.d26
-rw-r--r--ld/testsuite/ld-mmix/jumpa12f.d25
-rw-r--r--ld/testsuite/ld-mmix/jumpa13b.d31
-rw-r--r--ld/testsuite/ld-mmix/jumpa13f.d29
-rw-r--r--ld/testsuite/ld-mmix/jumpa14b.d11
-rw-r--r--ld/testsuite/ld-mmix/jumpa14f.d10
-rw-r--r--ld/testsuite/ld-mmix/loc1.d28
-rw-r--r--ld/testsuite/ld-mmix/loc1.s4
-rw-r--r--ld/testsuite/ld-mmix/loc1m.d14
-rw-r--r--ld/testsuite/ld-mmix/loc2.d29
-rw-r--r--ld/testsuite/ld-mmix/loc2.s4
-rw-r--r--ld/testsuite/ld-mmix/loc2m.d14
-rw-r--r--ld/testsuite/ld-mmix/loc3.d29
-rw-r--r--ld/testsuite/ld-mmix/loc3m.d14
-rw-r--r--ld/testsuite/ld-mmix/loc4.d35
-rw-r--r--ld/testsuite/ld-mmix/loc4m.d18
-rw-r--r--ld/testsuite/ld-mmix/loc5.d6
-rw-r--r--ld/testsuite/ld-mmix/loc5m.d6
-rw-r--r--ld/testsuite/ld-mmix/loc6.d30
-rw-r--r--ld/testsuite/ld-mmix/loc6m.d19
-rw-r--r--ld/testsuite/ld-mmix/loc7.d6
-rw-r--r--ld/testsuite/ld-mmix/loc7m.d6
-rw-r--r--ld/testsuite/ld-mmix/local1.d65
-rw-r--r--ld/testsuite/ld-mmix/local1.s2
-rw-r--r--ld/testsuite/ld-mmix/local10.d5
-rw-r--r--ld/testsuite/ld-mmix/local10m.d5
-rw-r--r--ld/testsuite/ld-mmix/local11.d6
-rw-r--r--ld/testsuite/ld-mmix/local11m.d6
-rw-r--r--ld/testsuite/ld-mmix/local12.d24
-rw-r--r--ld/testsuite/ld-mmix/local12m.d16
-rw-r--r--ld/testsuite/ld-mmix/local1m.d21
-rw-r--r--ld/testsuite/ld-mmix/local2.d8
-rw-r--r--ld/testsuite/ld-mmix/local2.s2
-rw-r--r--ld/testsuite/ld-mmix/local2m.d8
-rw-r--r--ld/testsuite/ld-mmix/local3.d63
-rw-r--r--ld/testsuite/ld-mmix/local3m.d21
-rw-r--r--ld/testsuite/ld-mmix/local4.d8
-rw-r--r--ld/testsuite/ld-mmix/local4m.d8
-rw-r--r--ld/testsuite/ld-mmix/local5.d64
-rw-r--r--ld/testsuite/ld-mmix/local5m.d21
-rw-r--r--ld/testsuite/ld-mmix/local6.d9
-rw-r--r--ld/testsuite/ld-mmix/local6m.d9
-rw-r--r--ld/testsuite/ld-mmix/local7.d65
-rw-r--r--ld/testsuite/ld-mmix/local7m.d21
-rw-r--r--ld/testsuite/ld-mmix/local8.d28
-rw-r--r--ld/testsuite/ld-mmix/local8m.d28
-rw-r--r--ld/testsuite/ld-mmix/local9.d5
-rw-r--r--ld/testsuite/ld-mmix/local9m.d5
-rw-r--r--ld/testsuite/ld-mmix/locdo-1.d29
-rw-r--r--ld/testsuite/ld-mmix/locdo.s2
-rw-r--r--ld/testsuite/ld-mmix/loct-1.d27
-rw-r--r--ld/testsuite/ld-mmix/loct.s4
-rw-r--r--ld/testsuite/ld-mmix/locto-1.d27
-rw-r--r--ld/testsuite/ld-mmix/locto.s3
-rw-r--r--ld/testsuite/ld-mmix/main1.s5
-rw-r--r--ld/testsuite/ld-mmix/mmix.exp32
-rw-r--r--ld/testsuite/ld-mmix/mmohdr1.ld11
-rw-r--r--ld/testsuite/ld-mmix/mmosec1.ld16
-rw-r--r--ld/testsuite/ld-mmix/mmosec2.ld13
-rw-r--r--ld/testsuite/ld-mmix/nop123.s3
-rw-r--r--ld/testsuite/ld-mmix/pad16.s4
-rw-r--r--ld/testsuite/ld-mmix/pad2p18m32.s4
-rw-r--r--ld/testsuite/ld-mmix/pad2p26m32.s4
-rw-r--r--ld/testsuite/ld-mmix/pad4.s4
-rw-r--r--ld/testsuite/ld-mmix/pushja.s7
-rw-r--r--ld/testsuite/ld-mmix/pushja1b.d25
-rw-r--r--ld/testsuite/ld-mmix/pushja1f.d25
-rw-r--r--ld/testsuite/ld-mmix/pushja2b.d21
-rw-r--r--ld/testsuite/ld-mmix/pushja2f.d21
-rw-r--r--ld/testsuite/ld-mmix/pushja7b.d25
-rw-r--r--ld/testsuite/ld-mmix/pushja7f.d25
-rw-r--r--ld/testsuite/ld-mmix/pushja8b.d21
-rw-r--r--ld/testsuite/ld-mmix/pushja8f.d21
-rw-r--r--ld/testsuite/ld-mmix/reg-1.d7
-rw-r--r--ld/testsuite/ld-mmix/reg-1m.d7
-rw-r--r--ld/testsuite/ld-mmix/reg-2.d7
-rw-r--r--ld/testsuite/ld-mmix/reg-2m.d7
-rw-r--r--ld/testsuite/ld-mmix/regext1.s2
-rw-r--r--ld/testsuite/ld-mmix/sec-1.d32
-rw-r--r--ld/testsuite/ld-mmix/sec-1.s14
-rw-r--r--ld/testsuite/ld-mmix/sec-2.d26
-rw-r--r--ld/testsuite/ld-mmix/sec-2.s2
-rw-r--r--ld/testsuite/ld-mmix/sec-3.d36
-rw-r--r--ld/testsuite/ld-mmix/sec-4.d22
-rw-r--r--ld/testsuite/ld-mmix/sec-5.d21
-rw-r--r--ld/testsuite/ld-mmix/sec-6.d36
-rw-r--r--ld/testsuite/ld-mmix/sec-6.s5
-rw-r--r--ld/testsuite/ld-mmix/sec-6m.d32
-rw-r--r--ld/testsuite/ld-mmix/spec801.d21
-rw-r--r--ld/testsuite/ld-mmix/spec802.d24
-rw-r--r--ld/testsuite/ld-mmix/spec803.d24
-rw-r--r--ld/testsuite/ld-mmix/spec804.d24
-rw-r--r--ld/testsuite/ld-mmix/spec805.d25
-rw-r--r--ld/testsuite/ld-mmix/spec806.d25
-rw-r--r--ld/testsuite/ld-mmix/spec807.d25
-rw-r--r--ld/testsuite/ld-mmix/spec808.d25
-rw-r--r--ld/testsuite/ld-mmix/start-1.d27
-rw-r--r--ld/testsuite/ld-mmix/start-2.d4
-rw-r--r--ld/testsuite/ld-mmix/start.s5
-rw-r--r--ld/testsuite/ld-mmix/start2.s5
-rw-r--r--ld/testsuite/ld-mmix/sym-1.d11
-rw-r--r--ld/testsuite/ld-mmix/sym-2.d142
-rw-r--r--ld/testsuite/ld-mmix/sym-2.s130
-rw-r--r--ld/testsuite/ld-mmix/undef-1.d4
-rw-r--r--ld/testsuite/ld-mmix/undef-1.s1
-rw-r--r--ld/testsuite/ld-mmix/undef-1m.d4
-rw-r--r--ld/testsuite/ld-mmix/undef-2.d5
-rw-r--r--ld/testsuite/ld-mmix/undef-2.s1
-rw-r--r--ld/testsuite/ld-mmix/undef-2m.d5
-rw-r--r--ld/testsuite/ld-mmix/undef-3.d46
-rw-r--r--ld/testsuite/ld-mmix/undef-3m.d20
-rw-r--r--ld/testsuite/ld-mmix/x.s26
-rw-r--r--ld/testsuite/ld-mmix/y.s33
-rw-r--r--ld/testsuite/ld-mmix/zeroeh.ld4
-rw-r--r--ld/testsuite/ld-mmix/zeroehelf.d17
-rw-r--r--ld/testsuite/ld-mmix/zeroehmmo.d16
261 files changed, 5209 insertions, 0 deletions
diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog
index f0d254c..4b760e5 100644
--- a/ld/testsuite/ChangeLog
+++ b/ld/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2001-10-30 Hans-Peter Nilsson <hp@bitrange.com>
+
+ * ld-mmix: New testsuite directory.
+
2001-10-14 Hans-Peter Nilsson <hp@bitrange.com>
* ld-sh/sub2l-1.d, ld-sh/shared-1.d, ld-sh/weak1.d: Only run on
diff --git a/ld/testsuite/ld-mmix/a.s b/ld/testsuite/ld-mmix/a.s
new file mode 100644
index 0000000..20e571b
--- /dev/null
+++ b/ld/testsuite/ld-mmix/a.s
@@ -0,0 +1,5 @@
+* The symbol "a" is found here.
+ .text
+ .global a
+a:
+ SET $253,4
diff --git a/ld/testsuite/ld-mmix/areg-256.s b/ld/testsuite/ld-mmix/areg-256.s
new file mode 100644
index 0000000..21012d8
--- /dev/null
+++ b/ld/testsuite/ld-mmix/areg-256.s
@@ -0,0 +1,2 @@
+ .global areg
+areg IS $255+1
diff --git a/ld/testsuite/ld-mmix/areg-t.s b/ld/testsuite/ld-mmix/areg-t.s
new file mode 100644
index 0000000..364b01c
--- /dev/null
+++ b/ld/testsuite/ld-mmix/areg-t.s
@@ -0,0 +1,3 @@
+ .text
+ .global areg
+areg SWYM 4,8,16
diff --git a/ld/testsuite/ld-mmix/aregm.s b/ld/testsuite/ld-mmix/aregm.s
new file mode 100644
index 0000000..2dacbad
--- /dev/null
+++ b/ld/testsuite/ld-mmix/aregm.s
@@ -0,0 +1,5 @@
+ .global areg
+areg GREG Main+4
+ LDOU $3,areg,16
+ LDOU $3,$7,areg
+ LDOU $5,Main+8
diff --git a/ld/testsuite/ld-mmix/b-badfil1.d b/ld/testsuite/ld-mmix/b-badfil1.d
new file mode 100644
index 0000000..8a945fb
--- /dev/null
+++ b/ld/testsuite/ld-mmix/b-badfil1.d
@@ -0,0 +1,7 @@
+#source: b-twoinsn.s
+#source: b-badfil1.s
+#source: b-post1.s
+#source: b-goodmain.s
+#ld: --oformat binary
+#objcopy_linked_file:
+#error: invalid mmo file: file number 42 `bar.s', was already entered as `foo.s'
diff --git a/ld/testsuite/ld-mmix/b-badfil1.s b/ld/testsuite/ld-mmix/b-badfil1.s
new file mode 100644
index 0000000..256fa78
--- /dev/null
+++ b/ld/testsuite/ld-mmix/b-badfil1.s
@@ -0,0 +1,10 @@
+% The .text contents is supposed to be linked --oformat binary with
+% b-twoinsn.s and b-goodmain.s, and will provide two LOP_FILEs, but
+% specifying the same file number.
+ .text
+ .byte 0x98,06,42,2
+ .ascii "foo.s"
+ .byte 0,0,0
+ .byte 0x98,06,42,2
+ .ascii "bar.s"
+ .byte 0,0,0
diff --git a/ld/testsuite/ld-mmix/b-badfil2.d b/ld/testsuite/ld-mmix/b-badfil2.d
new file mode 100644
index 0000000..3f98a77
--- /dev/null
+++ b/ld/testsuite/ld-mmix/b-badfil2.d
@@ -0,0 +1,7 @@
+#source: b-twoinsn.s
+#source: b-badfil2.s
+#source: b-post1.s
+#source: b-goodmain.s
+#ld: --oformat binary
+#objcopy_linked_file:
+#error: invalid mmo file: file name for number 42 was not specified before use
diff --git a/ld/testsuite/ld-mmix/b-badfil2.s b/ld/testsuite/ld-mmix/b-badfil2.s
new file mode 100644
index 0000000..23d68ba
--- /dev/null
+++ b/ld/testsuite/ld-mmix/b-badfil2.s
@@ -0,0 +1,6 @@
+% The .text contents is supposed to be linked --oformat binary with
+% b-twoinsn.s and b-goodmain.s, and will provide a LOP_FILE for file
+% number 42, without specifying the file name, which an earlier LOP_FILE
+% for the same file number was supposed to have filled in
+ .text
+ .byte 0x98,06,42,0
diff --git a/ld/testsuite/ld-mmix/b-badfixo.d b/ld/testsuite/ld-mmix/b-badfixo.d
new file mode 100644
index 0000000..3cb6088
--- /dev/null
+++ b/ld/testsuite/ld-mmix/b-badfixo.d
@@ -0,0 +1,7 @@
+#source: b-twoinsn.s
+#source: b-badfixo.s
+#source: b-post1.s
+#source: b-goodmain.s
+#ld: --oformat binary
+#objcopy_linked_file:
+#error: invalid mmo file: .* lop_fixo
diff --git a/ld/testsuite/ld-mmix/b-badfixo.s b/ld/testsuite/ld-mmix/b-badfixo.s
new file mode 100644
index 0000000..93cd6d0
--- /dev/null
+++ b/ld/testsuite/ld-mmix/b-badfixo.s
@@ -0,0 +1,5 @@
+% The .text contents is supposed to be linked --oformat binary with
+% b-twoinsn.s and b-goodmain.s, and will provide a LOP_FIXO with invalid;
+% (!= 1, != 2), YZ field.
+ .text
+ .byte 0x98,3,0,3
diff --git a/ld/testsuite/ld-mmix/b-badloc.d b/ld/testsuite/ld-mmix/b-badloc.d
new file mode 100644
index 0000000..dce1ebf
--- /dev/null
+++ b/ld/testsuite/ld-mmix/b-badloc.d
@@ -0,0 +1,7 @@
+#source: b-twoinsn.s
+#source: b-badloc.s
+#source: b-post1.s
+#source: b-goodmain.s
+#ld: --oformat binary
+#objcopy_linked_file:
+#error: invalid mmo file: .* lop_loc
diff --git a/ld/testsuite/ld-mmix/b-badloc.s b/ld/testsuite/ld-mmix/b-badloc.s
new file mode 100644
index 0000000..098098a
--- /dev/null
+++ b/ld/testsuite/ld-mmix/b-badloc.s
@@ -0,0 +1,5 @@
+% The .text contents is supposed to be linked --oformat binary with
+% b-twoinsn.s and b-goodmain.s, and will provide a LOP_LOC with invalid;
+% (!= 1, != 2), YZ field.
+ .text
+ .byte 0x98,1,0,0
diff --git a/ld/testsuite/ld-mmix/b-badlop.d b/ld/testsuite/ld-mmix/b-badlop.d
new file mode 100644
index 0000000..b8c55e5
--- /dev/null
+++ b/ld/testsuite/ld-mmix/b-badlop.d
@@ -0,0 +1,7 @@
+#source: b-twoinsn.s
+#source: b-badlop.s
+#source: b-post1.s
+#source: b-goodmain.s
+#ld: --oformat binary
+#objcopy_linked_file:
+#error: invalid mmo file: unsupported lopcode
diff --git a/ld/testsuite/ld-mmix/b-badlop.s b/ld/testsuite/ld-mmix/b-badlop.s
new file mode 100644
index 0000000..9e13332
--- /dev/null
+++ b/ld/testsuite/ld-mmix/b-badlop.s
@@ -0,0 +1,4 @@
+% The .text contents is supposed to be linked --oformat binary with
+% b-twoinsn.s and b-goodmain.s, and will provide an invalid lopcode.
+ .text
+ .byte 0x98,0xff,0,0
diff --git a/ld/testsuite/ld-mmix/b-badm.d b/ld/testsuite/ld-mmix/b-badm.d
new file mode 100644
index 0000000..39d8ecb
--- /dev/null
+++ b/ld/testsuite/ld-mmix/b-badm.d
@@ -0,0 +1,6 @@
+#source: b-twoinsn.s
+#source: b-post1.s
+#source: b-badmain.s
+#ld: --oformat binary
+#objcopy_linked_file:
+#error: invalid mmo file: initialization value for .255 is not `Main'
diff --git a/ld/testsuite/ld-mmix/b-badm2.s b/ld/testsuite/ld-mmix/b-badm2.s
new file mode 100644
index 0000000..eb94278
--- /dev/null
+++ b/ld/testsuite/ld-mmix/b-badm2.s
@@ -0,0 +1,6 @@
+% The .text contents is supposed to be linked --oformat binary with
+% b-twoinsn.s. It will provide an incorrect LOP_END; its YZ field is not
+% the number of tetras to the preceding LOP_STAB.
+ .text
+ .byte 0x98,0x0b,0x00,0x00,0x20,0x3a,0x30,0x4d,0x20,0x61,0x20,0x69
+ .byte 0x01,0x6e,0x04,0x81,0x01,0x61,0x04,0x82,0x98,0x0c,0x00,0x03
diff --git a/ld/testsuite/ld-mmix/b-badmain.s b/ld/testsuite/ld-mmix/b-badmain.s
new file mode 100644
index 0000000..4736955
--- /dev/null
+++ b/ld/testsuite/ld-mmix/b-badmain.s
@@ -0,0 +1,7 @@
+% The .text contents is supposed to be linked --oformat binary with
+% b-twoinsn.s, and will provide the end of a mmo file with a value of
+% :Main that does not correspond to the address in the initialization of
+% $255 - the start address.
+ .text
+ .byte 0x98,0x0b,0,0,0x20,0x3a,0x30,0x4d,0x20,0x61,0x20,0x69
+ .byte 1,0x6e,0,0x81,1,0x61,4,0x82,0x98,0x0c,0,4
diff --git a/ld/testsuite/ld-mmix/b-badquot.d b/ld/testsuite/ld-mmix/b-badquot.d
new file mode 100644
index 0000000..ae3d095
--- /dev/null
+++ b/ld/testsuite/ld-mmix/b-badquot.d
@@ -0,0 +1,7 @@
+#source: b-twoinsn.s
+#source: b-badquot.s
+#source: b-post1.s
+#source: b-goodmain.s
+#ld: --oformat binary
+#objcopy_linked_file:
+#error: invalid mmo file: .* lop_quote
diff --git a/ld/testsuite/ld-mmix/b-badquot.s b/ld/testsuite/ld-mmix/b-badquot.s
new file mode 100644
index 0000000..77742db
--- /dev/null
+++ b/ld/testsuite/ld-mmix/b-badquot.s
@@ -0,0 +1,5 @@
+% The .text contents is supposed to be linked --oformat binary with
+% b-twoinsn.s and b-goodmain.s, and will provide a LOP_QUOTE with invalid;
+% non-zero, YZ field.
+ .text
+ .byte 0x98,0,0xff,0
diff --git a/ld/testsuite/ld-mmix/b-badrx1.d b/ld/testsuite/ld-mmix/b-badrx1.d
new file mode 100644
index 0000000..1033476
--- /dev/null
+++ b/ld/testsuite/ld-mmix/b-badrx1.d
@@ -0,0 +1,7 @@
+#source: b-twoinsn.s
+#source: b-badrx1.s
+#source: b-post1.s
+#source: b-goodmain.s
+#ld: --oformat binary
+#objcopy_linked_file:
+#error: invalid mmo file: expected y = 0, .* lop_fixrx
diff --git a/ld/testsuite/ld-mmix/b-badrx1.s b/ld/testsuite/ld-mmix/b-badrx1.s
new file mode 100644
index 0000000..dd35763
--- /dev/null
+++ b/ld/testsuite/ld-mmix/b-badrx1.s
@@ -0,0 +1,6 @@
+% The .text contents is supposed to be linked --oformat binary with
+% b-twoinsn.s and b-goodmain.s, and will provide a LOP_FIXRX with invalid
+% (non-zero), Y field.
+ .text
+ .byte 0x98,5,1,0
+ .4byte 0
diff --git a/ld/testsuite/ld-mmix/b-badrx2.d b/ld/testsuite/ld-mmix/b-badrx2.d
new file mode 100644
index 0000000..6e13019
--- /dev/null
+++ b/ld/testsuite/ld-mmix/b-badrx2.d
@@ -0,0 +1,7 @@
+#source: b-twoinsn.s
+#source: b-badrx2.s
+#source: b-post1.s
+#source: b-goodmain.s
+#ld: --oformat binary
+#objcopy_linked_file:
+#error: invalid mmo file: expected z .* lop_fixrx
diff --git a/ld/testsuite/ld-mmix/b-badrx2.s b/ld/testsuite/ld-mmix/b-badrx2.s
new file mode 100644
index 0000000..20def6c
--- /dev/null
+++ b/ld/testsuite/ld-mmix/b-badrx2.s
@@ -0,0 +1,6 @@
+% The .text contents is supposed to be linked --oformat binary with
+% b-twoinsn.s and b-goodmain.s, and will provide a LOP_FIXRX with invalid
+% (!= 16, != 24), Z field.
+ .text
+ .byte 0x98,5,0,8
+ .4byte 0
diff --git a/ld/testsuite/ld-mmix/b-badrx3.d b/ld/testsuite/ld-mmix/b-badrx3.d
new file mode 100644
index 0000000..c1cffed
--- /dev/null
+++ b/ld/testsuite/ld-mmix/b-badrx3.d
@@ -0,0 +1,7 @@
+#source: b-twoinsn.s
+#source: b-badrx3.s
+#source: b-post1.s
+#source: b-goodmain.s
+#ld: --oformat binary
+#objcopy_linked_file:
+#error: invalid mmo file: leading byte of operand word .* lop_fixrx
diff --git a/ld/testsuite/ld-mmix/b-badrx3.s b/ld/testsuite/ld-mmix/b-badrx3.s
new file mode 100644
index 0000000..59cd5cb
--- /dev/null
+++ b/ld/testsuite/ld-mmix/b-badrx3.s
@@ -0,0 +1,6 @@
+% The .text contents is supposed to be linked --oformat binary with
+% b-twoinsn.s and b-goodmain.s, and will provide a LOP_FIXRX with invalid
+% (!= 0, != 1), first byte of the operand word.
+ .text
+ .byte 0x98,5,0,24
+ .byte 2,0,0,0
diff --git a/ld/testsuite/ld-mmix/b-bend.s b/ld/testsuite/ld-mmix/b-bend.s
new file mode 100644
index 0000000..1168ee9
--- /dev/null
+++ b/ld/testsuite/ld-mmix/b-bend.s
@@ -0,0 +1,6 @@
+% The .text contents is supposed to be linked --oformat binary with
+% b-twoinsn.s and b-goodmain.s, and will provide an invalid LOP_END; one
+% not at the end of a file. It also does not in YZ specify a correct
+% number of bytes between it and a preceding lop_stab.
+ .text
+ .byte 0x98,12,0,0
diff --git a/ld/testsuite/ld-mmix/b-bend1.d b/ld/testsuite/ld-mmix/b-bend1.d
new file mode 100644
index 0000000..e747753
--- /dev/null
+++ b/ld/testsuite/ld-mmix/b-bend1.d
@@ -0,0 +1,11 @@
+#source: b-twoinsn.s
+#source: b-bend.s
+#source: b-post1.s
+#source: b-goodmain.s
+#ld: --oformat binary
+#objcopy_linked_file:
+#error: invalid mmo file: lop_end not last item in file
+
+# This test depend on that the non-at-end condition is tested before
+# not-correct-YZ-field and might need tweaking if the implementation
+# changes.
diff --git a/ld/testsuite/ld-mmix/b-bend2.d b/ld/testsuite/ld-mmix/b-bend2.d
new file mode 100644
index 0000000..234b4e5
--- /dev/null
+++ b/ld/testsuite/ld-mmix/b-bend2.d
@@ -0,0 +1,10 @@
+#source: b-twoinsn.s
+#source: b-post1.s
+#source: b-goodmain.s
+#source: b-bend.s
+#ld: --oformat binary
+#objcopy_linked_file:
+#error: invalid mmo file: lop_end not last item in file
+
+# We use the b-bend.s file just to make the correct lop_end in
+# b-goodmain.s not the last one.
diff --git a/ld/testsuite/ld-mmix/b-bend3.d b/ld/testsuite/ld-mmix/b-bend3.d
new file mode 100644
index 0000000..3448c22
--- /dev/null
+++ b/ld/testsuite/ld-mmix/b-bend3.d
@@ -0,0 +1,6 @@
+#source: b-twoinsn.s
+#source: b-post1.s
+#source: b-badm2.s
+#ld: --oformat binary
+#objcopy_linked_file:
+#error: invalid mmo file: YZ of lop_end .* not equal to the number of tetras to the preceding lop_stab
diff --git a/ld/testsuite/ld-mmix/b-bstab1.d b/ld/testsuite/ld-mmix/b-bstab1.d
new file mode 100644
index 0000000..6281f06
--- /dev/null
+++ b/ld/testsuite/ld-mmix/b-bstab1.d
@@ -0,0 +1,7 @@
+#source: b-twoinsn.s
+#source: b-bstab1.s
+#source: b-post1.s
+#source: b-goodmain.s
+#ld: --oformat binary
+#objcopy_linked_file:
+#error: invalid mmo file: fields y and z of lop_stab non-zero, y: 1, z: 2
diff --git a/ld/testsuite/ld-mmix/b-bstab1.s b/ld/testsuite/ld-mmix/b-bstab1.s
new file mode 100644
index 0000000..0210106
--- /dev/null
+++ b/ld/testsuite/ld-mmix/b-bstab1.s
@@ -0,0 +1,5 @@
+% The .text contents is supposed to be linked --oformat binary with
+% b-twoinsn.s and b-goodmain.s, and will provide an invalid LOP_STAB, one
+% with non-zero y and/or z.
+ .text
+ .byte 0x98,11,1,2
diff --git a/ld/testsuite/ld-mmix/b-fixo2.d b/ld/testsuite/ld-mmix/b-fixo2.d
new file mode 100644
index 0000000..62eb013
--- /dev/null
+++ b/ld/testsuite/ld-mmix/b-fixo2.d
@@ -0,0 +1,28 @@
+#source: b-twoinsn.s
+#source: b-fixo2.s
+#source: b-post1.s
+#source: b-goodmain.s
+#ld: --oformat binary
+#objcopy_linked_file:
+#objdump: -sht
+
+# Note that we "optimize" out the high tetrabyte of 0 written to
+# 2068098510aa5560, hence only the low part is left.
+
+.*: file format mmo
+
+Sections:
+Idx Name Size VMA LMA File off Algn
+ 0 \.text 0+8 0+ 0+ 0+ 2\*\*2
+ CONTENTS, ALLOC, LOAD, CODE
+ 1 \.data 0+4 2068098510aa5564 2068098510aa5564 0+ 2\*\*2
+ CONTENTS, ALLOC, LOAD
+SYMBOL TABLE:
+0+4 g \.text Main
+0+4 g \.text a
+
+
+Contents of section \.text:
+ 0000 e3fd0001 e3fd0004 .*
+Contents of section \.data:
+ 10aa5564 00000008 .*
diff --git a/ld/testsuite/ld-mmix/b-fixo2.s b/ld/testsuite/ld-mmix/b-fixo2.s
new file mode 100644
index 0000000..f892999
--- /dev/null
+++ b/ld/testsuite/ld-mmix/b-fixo2.s
@@ -0,0 +1,6 @@
+% The .text contents is supposed to be linked --oformat binary with
+% b-twoinsn.s and b-goodmain.s, and will provide a LOP_FIXO storing the
+% current address at address 0x2068098510aa5560.
+ .text
+ .byte 0x98,3,0x20,2
+ .8byte 0x68098510aa5560
diff --git a/ld/testsuite/ld-mmix/b-goodmain.s b/ld/testsuite/ld-mmix/b-goodmain.s
new file mode 100644
index 0000000..c90063e
--- /dev/null
+++ b/ld/testsuite/ld-mmix/b-goodmain.s
@@ -0,0 +1,5 @@
+% The .text contents is supposed to be linked --oformat binary with
+% b-twoinsn.s, and will provide a valid end of a mmo file.
+ .text
+ .byte 0x98,0x0b,0x00,0x00,0x20,0x3a,0x30,0x4d,0x20,0x61,0x20,0x69
+ .byte 0x01,0x6e,0x04,0x81,0x01,0x61,0x04,0x82,0x98,0x0c,0x00,0x04
diff --git a/ld/testsuite/ld-mmix/b-loc64k.d b/ld/testsuite/ld-mmix/b-loc64k.d
new file mode 100644
index 0000000..bb384e4
--- /dev/null
+++ b/ld/testsuite/ld-mmix/b-loc64k.d
@@ -0,0 +1,25 @@
+#source: b-loc64k.s
+#source: b-goodmain.s
+#ld: --oformat binary
+#objcopy_linked_file:
+#objdump: -dht
+
+.*: file format mmo
+
+Sections:
+Idx Name Size VMA LMA File off Algn
+ 0 \.text 0+10004 0+ 0+ 0+ 2\*\*2
+ CONTENTS, ALLOC, LOAD, CODE
+SYMBOL TABLE:
+0+4 g \.text Main
+0+4 g \.text a
+
+
+Disassembly of section \.text:
+
+0+ <Main-0x4>:
+ 0: e3fd0001 setl \$253,0x1
+
+0+4 <Main>:
+ \.\.\.
+ 10000: e3fd0004 setl \$253,0x4
diff --git a/ld/testsuite/ld-mmix/b-loc64k.s b/ld/testsuite/ld-mmix/b-loc64k.s
new file mode 100644
index 0000000..ea563d2
--- /dev/null
+++ b/ld/testsuite/ld-mmix/b-loc64k.s
@@ -0,0 +1,8 @@
+% The .text contents is supposed to be linked --oformat binary, and will
+% correspond to the start of a mmo file with two instructions, 64k apart.
+% This file ends before the LOP_STAB.
+ .text
+ .byte 0x98,9,1,1,0x3b,0x7f,0x9c,0xe3,0x98,1,0,2,0,0,0,0
+ .byte 0,0,0,0,0xe3,0xfd,0,1,0x98,1,0,2,0,0,0,0
+ .byte 0,1,0,0,0xe3,0xfd,0,4,0x98,0x0a,0,0xff,0,0,0,0
+ .byte 0,0,0,4
diff --git a/ld/testsuite/ld-mmix/b-nosym.d b/ld/testsuite/ld-mmix/b-nosym.d
new file mode 100644
index 0000000..06594a1
--- /dev/null
+++ b/ld/testsuite/ld-mmix/b-nosym.d
@@ -0,0 +1,15 @@
+#source: b-twoinsn.s
+#source: b-post1.s
+#source: b-nosym.s
+#ld: --oformat binary
+#objcopy_linked_file:
+#objdump: -st
+
+.*: file format mmo
+
+SYMBOL TABLE:
+0+4 g \.text Main
+
+
+Contents of section \.text:
+ 0000 e3fd0001 e3fd0004 .*
diff --git a/ld/testsuite/ld-mmix/b-nosym.s b/ld/testsuite/ld-mmix/b-nosym.s
new file mode 100644
index 0000000..5b77f1d
--- /dev/null
+++ b/ld/testsuite/ld-mmix/b-nosym.s
@@ -0,0 +1,6 @@
+% The .text contents is supposed to be linked --oformat binary with
+% b-twoinsn.s, and will provide a valid end of a mmo file but with no
+% symbols (if that is actually valid).
+ .text
+ .byte 0x98,0x0b,0x00,0x00,0x98,0x0c,0x00,0x00
+
diff --git a/ld/testsuite/ld-mmix/b-post1.s b/ld/testsuite/ld-mmix/b-post1.s
new file mode 100644
index 0000000..a60aece
--- /dev/null
+++ b/ld/testsuite/ld-mmix/b-post1.s
@@ -0,0 +1,5 @@
+% The .text contents is supposed to be linked --oformat binary, and will
+% correspond to a LOP_POST for an initialization of $255 with 4. A
+% LOP_STAB, such as in b-goodmain.s should follow.
+ .text
+ .byte 0x98,0x0a,0,0xff,0,0,0,0,0,0,0,4
diff --git a/ld/testsuite/ld-mmix/b-twoinsn.s b/ld/testsuite/ld-mmix/b-twoinsn.s
new file mode 100644
index 0000000..d9e0147
--- /dev/null
+++ b/ld/testsuite/ld-mmix/b-twoinsn.s
@@ -0,0 +1,7 @@
+% The .text contents is supposed to be linked --oformat binary, and will
+% correspond to the start of a mmo file with two instructions. This file
+% ends before the LOP_STAB.
+ .text
+ .byte 0x98,9,1,1,0x3b,0x7f,0x9c,0xe3,0x98,1,0,2,0,0,0,0
+ .byte 0,0,0,0,0xe3,0xfd,0,1,0x98,1,0,2,0,0,0,0
+ .byte 0,0,0,4,0xe3,0xfd,0,4
diff --git a/ld/testsuite/ld-mmix/b-widec.s b/ld/testsuite/ld-mmix/b-widec.s
new file mode 100644
index 0000000..c6f8c30
--- /dev/null
+++ b/ld/testsuite/ld-mmix/b-widec.s
@@ -0,0 +1,7 @@
+% The .text contents is supposed to be linked --oformat binary with
+% b-twoinsn.s, and will provide a valid end of a mmo file, but with the
+% "n" in :Main in wide character format; the widening is with a nil, so it
+% is treated like a normal "n".
+ .text
+ .byte 0x98,0x0b,0x00,0x00,0x20,0x3a,0x30,0x4d,0x20,0x61,0x20,0x69
+ .byte 0x81,0,0x6e,0x04,0x81,0x01,0x61,0x04,0x82,0,0,0,0x98,0x0c,0x00,0x05
diff --git a/ld/testsuite/ld-mmix/b-widec1.d b/ld/testsuite/ld-mmix/b-widec1.d
new file mode 100644
index 0000000..e290ba1
--- /dev/null
+++ b/ld/testsuite/ld-mmix/b-widec1.d
@@ -0,0 +1,12 @@
+#source: b-twoinsn.s
+#source: b-post1.s
+#source: b-widec.s
+#ld: --oformat binary
+#objcopy_linked_file:
+#objdump: -t
+
+.*: file format mmo
+
+SYMBOL TABLE:
+0+4 g \.text Main
+0+4 g \.text a
diff --git a/ld/testsuite/ld-mmix/b-widec2.d b/ld/testsuite/ld-mmix/b-widec2.d
new file mode 100644
index 0000000..4094b59
--- /dev/null
+++ b/ld/testsuite/ld-mmix/b-widec2.d
@@ -0,0 +1,6 @@
+#source: b-twoinsn.s
+#source: b-post1.s
+#source: b-widec2.s
+#ld: --oformat binary
+#objcopy_linked_file:
+#error: unsupported wide character sequence 0xFF 0x6E
diff --git a/ld/testsuite/ld-mmix/b-widec2.s b/ld/testsuite/ld-mmix/b-widec2.s
new file mode 100644
index 0000000..7745365
--- /dev/null
+++ b/ld/testsuite/ld-mmix/b-widec2.s
@@ -0,0 +1,7 @@
+% The .text contents is supposed to be linked --oformat binary with
+% b-twoinsn.s, and will provide a valid end of a mmo file, but with the
+% "n" in :Main in wide character format; the widening is with a 0xff, so it
+% isn't supported, and the file is rejected.
+ .text
+ .byte 0x98,0x0b,0x00,0x00,0x20,0x3a,0x30,0x4d,0x20,0x61,0x20,0x69
+ .byte 0x81,0xff,0x6e,0x04,0x81,0x01,0x61,0x04,0x82,0,0,0,0x98,0x0c,0x00,0x05
diff --git a/ld/testsuite/ld-mmix/b-widec3.d b/ld/testsuite/ld-mmix/b-widec3.d
new file mode 100644
index 0000000..f4cb3b9
--- /dev/null
+++ b/ld/testsuite/ld-mmix/b-widec3.d
@@ -0,0 +1,6 @@
+#source: b-twoinsn.s
+#source: b-post1.s
+#source: b-widec3.s
+#ld: --oformat binary
+#objcopy_linked_file:
+#error: invalid symbol table: duplicate symbol `Main'
diff --git a/ld/testsuite/ld-mmix/b-widec3.s b/ld/testsuite/ld-mmix/b-widec3.s
new file mode 100644
index 0000000..96abcd8
--- /dev/null
+++ b/ld/testsuite/ld-mmix/b-widec3.s
@@ -0,0 +1,9 @@
+% The .text contents is supposed to be linked --oformat binary with
+% b-twoinsn.s, and will provide a valid end of a mmo file, but with the
+% "n" in :Main in wide character format; the widening is with a nil, so it
+% is treated like a normal "n". Also, it provides a normal "n", so the
+% two symbols collide.
+ .text
+ .byte 0x98,0x0b,0x00,0x00,0x20,0x3a,0x30,0x4d,0x20,0x61,0x20,0x69
+ .byte 0x91,0,0x6e,0x04,0x81,0x01,0x6e,0x04,0x83,1,0x01,0x61,0x04,0x82,0,0,0x98,0x0c,0,0x06
+
diff --git a/ld/testsuite/ld-mmix/bspec1.d b/ld/testsuite/ld-mmix/bspec1.d
new file mode 100644
index 0000000..2d6a623
--- /dev/null
+++ b/ld/testsuite/ld-mmix/bspec1.d
@@ -0,0 +1,58 @@
+#source: bspec1.s
+#source: start.s
+#ld: -m elf64mmix
+#readelf: -Ssr -x1 -x5
+
+There are 9 section headers, starting at offset 0x100:
+
+Section Headers:
+ \[Nr\] Name Type Address Offset
+ Size EntSize Flags Link Info Align
+ \[ 0\] NULL 0+ 0+
+ 0+ 0+ 0 0 0
+ \[ 1\] \.text PROGBITS 0+ 0+b0
+ 0+4 0+ AX 0 0 4
+ \[ 2\] \.data PROGBITS 2000000000000000 0+b4
+ 0+ 0+ WA 0 0 1
+ \[ 3\] \.sbss PROGBITS 2000000000000000 0+b4
+ 0+ 0+ W 0 0 1
+ \[ 4\] \.bss NOBITS 2000000000000000 0+b4
+ 0+ 0+ WA 0 0 1
+ \[ 5\] \.MMIX\.spec_data\.2 PROGBITS 0+ 0+b4
+ 0+4 0+ 0 0 4
+ \[ 6\] \.shstrtab STRTAB 0+ 0+b8
+ 0+44 0+ 0 0 1
+ \[ 7\] \.symtab SYMTAB 0+ 0+340
+ 0+168 0+18 8 9 8
+ \[ 8\] \.strtab STRTAB 0+ 0+4a8
+ 0+2d 0+ 0 0 1
+Key to Flags:
+ W \(write\), A \(alloc\), X \(execute\), M \(merge\), S \(strings\)
+ I \(info\), L \(link order\), G \(group\), x \(unknown\)
+ O \(extra OS processing required\) o \(OS specific\), p \(processor specific\)
+
+There are no relocations in this file\.
+
+Symbol table '\.symtab' contains 15 entries:
+ Num: Value Size Type Bind Vis Ndx Name
+ 0: 0+ 0 NOTYPE LOCAL DEFAULT UND
+ 1: 0+ 0 SECTION LOCAL DEFAULT 1
+ 2: 2000000000000000 0 SECTION LOCAL DEFAULT 2
+ 3: 2000000000000000 0 SECTION LOCAL DEFAULT 3
+ 4: 2000000000000000 0 SECTION LOCAL DEFAULT 4
+ 5: 0+ 0 SECTION LOCAL DEFAULT 5
+ 6: 0+ 0 SECTION LOCAL DEFAULT 6
+ 7: 0+ 0 SECTION LOCAL DEFAULT 7
+ 8: 0+ 0 SECTION LOCAL DEFAULT 8
+ 9: 0+ 0 FUNC GLOBAL DEFAULT 1 Main
+ 10: 0+ 0 NOTYPE GLOBAL DEFAULT 1 _start
+ 11: 2000000000000000 0 OBJECT GLOBAL DEFAULT ABS __bss_start
+ 12: 2000000000000000 0 OBJECT GLOBAL DEFAULT ABS _edata
+ 13: 2000000000000000 0 OBJECT GLOBAL DEFAULT ABS _end
+ 14: 0+ 0 OBJECT GLOBAL DEFAULT 1 _start\.
+
+Hex dump of section '\.text':
+ 0x0+ e3fd0001 .*
+
+Hex dump of section '\.MMIX\.spec_data\.2':
+ 0x0+ 0000002a .*
diff --git a/ld/testsuite/ld-mmix/bspec1.s b/ld/testsuite/ld-mmix/bspec1.s
new file mode 100644
index 0000000..0c1707f
--- /dev/null
+++ b/ld/testsuite/ld-mmix/bspec1.s
@@ -0,0 +1,3 @@
+ BSPEC 2
+ TETRA :Main+42
+ ESPEC
diff --git a/ld/testsuite/ld-mmix/bspec1m.d b/ld/testsuite/ld-mmix/bspec1m.d
new file mode 100644
index 0000000..658bb80
--- /dev/null
+++ b/ld/testsuite/ld-mmix/bspec1m.d
@@ -0,0 +1,16 @@
+#source: bspec1.s
+#source: start.s
+#ld: -m mmo
+#objdump: -str
+
+.*: file format mmo
+
+SYMBOL TABLE:
+0+ g \.text Main
+0+ g \.text _start
+
+
+Contents of section \.text:
+ 0+ e3fd0001 .*
+Contents of section \.MMIX\.spec_data\.2:
+ 0000 0000002a .*
diff --git a/ld/testsuite/ld-mmix/bspec2.d b/ld/testsuite/ld-mmix/bspec2.d
new file mode 100644
index 0000000..05aa113
--- /dev/null
+++ b/ld/testsuite/ld-mmix/bspec2.d
@@ -0,0 +1,68 @@
+#source: bspec1.s
+#source: bspec2.s
+#source: bspec1.s
+#source: start.s
+#source: ext1.s
+#ld: -m elf64mmix
+#readelf: -Ssr -x1 -x5 -x6
+
+There are 10 section headers, starting at offset 0x118:
+
+Section Headers:
+ \[Nr\] Name Type Address Offset
+ Size EntSize Flags Link Info Align
+ \[ 0\] NULL 0+ 0+
+ 0+ 0+ 0 0 0
+ \[ 1\] \.text PROGBITS 0+ 0+b0
+ 0+4 0+ AX 0 0 4
+ \[ 2\] \.data PROGBITS 2000000000000000 0+b4
+ 0+ 0+ WA 0 0 1
+ \[ 3\] \.sbss PROGBITS 2000000000000000 0+b4
+ 0+ 0+ W 0 0 1
+ \[ 4\] \.bss NOBITS 2000000000000000 0+b4
+ 0+ 0+ WA 0 0 1
+ \[ 5\] \.MMIX\.spec_data\.2 PROGBITS 0+ 0+b4
+ 0+8 0+ 0 0 4
+ \[ 6\] \.MMIX\.spec_data\.3 PROGBITS 0+ 0+bc
+ 0+4 0+ 0 0 4
+ \[ 7\] \.shstrtab STRTAB 0+ 0+c0
+ 0+56 0+ 0 0 1
+ \[ 8\] \.symtab SYMTAB 0+ 0+398
+ 0+198 0+18 9 a 8
+ \[ 9\] \.strtab STRTAB 0+ 0+530
+ 0+32 0+ 0 0 1
+Key to Flags:
+ W \(write\), A \(alloc\), X \(execute\), M \(merge\), S \(strings\)
+ I \(info\), L \(link order\), G \(group\), x \(unknown\)
+ O \(extra OS processing required\) o \(OS specific\), p \(processor specific\)
+
+There are no relocations in this file\.
+
+Symbol table '\.symtab' contains 17 entries:
+ Num: Value Size Type Bind Vis Ndx Name
+ 0: 0+ 0 NOTYPE LOCAL DEFAULT UND
+ 1: 0+ 0 SECTION LOCAL DEFAULT 1
+ 2: 2000000000000000 0 SECTION LOCAL DEFAULT 2
+ 3: 2000000000000000 0 SECTION LOCAL DEFAULT 3
+ 4: 2000000000000000 0 SECTION LOCAL DEFAULT 4
+ 5: 0+ 0 SECTION LOCAL DEFAULT 5
+ 6: 0+ 0 SECTION LOCAL DEFAULT 6
+ 7: 0+ 0 SECTION LOCAL DEFAULT 7
+ 8: 0+ 0 SECTION LOCAL DEFAULT 8
+ 9: 0+ 0 SECTION LOCAL DEFAULT 9
+ 10: 0+ 0 FUNC GLOBAL DEFAULT 1 Main
+ 11: 0+fc 0 NOTYPE GLOBAL DEFAULT ABS ext1
+ 12: 0+ 0 NOTYPE GLOBAL DEFAULT 1 _start
+ 13: 2000000000000000 0 OBJECT GLOBAL DEFAULT ABS __bss_start
+ 14: 2000000000000000 0 OBJECT GLOBAL DEFAULT ABS _edata
+ 15: 2000000000000000 0 OBJECT GLOBAL DEFAULT ABS _end
+ 16: 0+ 0 OBJECT GLOBAL DEFAULT 1 _start\.
+
+Hex dump of section '\.text':
+ 0x0+ e3fd0001 .*
+
+Hex dump of section '\.MMIX\.spec_data\.2':
+ 0x0+ 0000002a 0000002a .*
+
+Hex dump of section '\.MMIX\.spec_data\.3':
+ 0x0+ 000000fc .*
diff --git a/ld/testsuite/ld-mmix/bspec2.s b/ld/testsuite/ld-mmix/bspec2.s
new file mode 100644
index 0000000..f939d77
--- /dev/null
+++ b/ld/testsuite/ld-mmix/bspec2.s
@@ -0,0 +1,3 @@
+ BSPEC 3
+ TETRA ext1
+ ESPEC
diff --git a/ld/testsuite/ld-mmix/bspec2m.d b/ld/testsuite/ld-mmix/bspec2m.d
new file mode 100644
index 0000000..1ee659e
--- /dev/null
+++ b/ld/testsuite/ld-mmix/bspec2m.d
@@ -0,0 +1,22 @@
+#source: bspec1.s
+#source: bspec2.s
+#source: bspec1.s
+#source: start.s
+#source: ext1.s
+#ld: -m mmo
+#objdump: -str
+
+.*: file format mmo
+
+SYMBOL TABLE:
+0+ g \.text Main
+0+fc g \*ABS\* ext1
+0+ g \.text _start
+
+
+Contents of section \.text:
+ 0+ e3fd0001 .*
+Contents of section \.MMIX\.spec_data\.2:
+ 0000 0000002a 0000002a .*
+Contents of section \.MMIX\.spec_data\.3:
+ 0000 000000fc .*
diff --git a/ld/testsuite/ld-mmix/bspec801.s b/ld/testsuite/ld-mmix/bspec801.s
new file mode 100644
index 0000000..9c62909
--- /dev/null
+++ b/ld/testsuite/ld-mmix/bspec801.s
@@ -0,0 +1,3 @@
+ BSPEC 80
+ TETRA 0x98000001
+ ESPEC
diff --git a/ld/testsuite/ld-mmix/bspec802.s b/ld/testsuite/ld-mmix/bspec802.s
new file mode 100644
index 0000000..13cbec4
--- /dev/null
+++ b/ld/testsuite/ld-mmix/bspec802.s
@@ -0,0 +1,7 @@
+ BSPEC 80
+ TETRA 4 % Decent section length name (in 32-bit words). However...
+ ESPEC % Everything ends here. The next thing is a LOP_LOC for .data, or
+ % an ending LOP-something, hence a non-LOP_QUOTE in the name.
+
+ .data
+ TETRA 0x112233
diff --git a/ld/testsuite/ld-mmix/bspec803.s b/ld/testsuite/ld-mmix/bspec803.s
new file mode 100644
index 0000000..64b5e3b
--- /dev/null
+++ b/ld/testsuite/ld-mmix/bspec803.s
@@ -0,0 +1,9 @@
+ BSPEC 80
+ TETRA 2 % Decent section length name (in 32-bit words). However...
+ BYTE "aaaa"
+ BYTE 0x98,"aaa" # A LOP_QUOTEd part here. And also...
+ ESPEC % Everything ends here. The next thing is a LOP_LOC for .data, or
+ % an ending LOP-something, hence a non-LOP_QUOTE in the section flags.
+
+ .data
+ TETRA 0x112233
diff --git a/ld/testsuite/ld-mmix/bspec804.s b/ld/testsuite/ld-mmix/bspec804.s
new file mode 100644
index 0000000..2c64c0a
--- /dev/null
+++ b/ld/testsuite/ld-mmix/bspec804.s
@@ -0,0 +1,9 @@
+ BSPEC 80
+ TETRA 2 % Decent section length name (in 32-bit words).
+ BYTE "aaaaaaaa"
+ TETRA 0x11 % Flags. However...
+ ESPEC % Everything ends here. The next thing is a LOP_LOC for .data, or
+ % an ending LOP-something, hence a non-LOP_QUOTE in the section
+ % length, high part.
+ .data
+ TETRA 0x112233
diff --git a/ld/testsuite/ld-mmix/bspec805.s b/ld/testsuite/ld-mmix/bspec805.s
new file mode 100644
index 0000000..a5c09e3
--- /dev/null
+++ b/ld/testsuite/ld-mmix/bspec805.s
@@ -0,0 +1,10 @@
+ BSPEC 80
+ TETRA 2 % Decent section length name (in 32-bit words).
+ BYTE "aaaaaaaa"
+ TETRA 0x11 % Flags.
+ TETRA 0 % Decent high-part of section length. However...
+ ESPEC % Everything ends here. The next thing is a LOP_LOC for .data, or
+ % an ending LOP-something, hence a non-LOP_QUOTE in the section
+ % length, high part.
+ .data
+ TETRA 0x112233
diff --git a/ld/testsuite/ld-mmix/bspec806.s b/ld/testsuite/ld-mmix/bspec806.s
new file mode 100644
index 0000000..8f6c75f
--- /dev/null
+++ b/ld/testsuite/ld-mmix/bspec806.s
@@ -0,0 +1,10 @@
+ BSPEC 80
+ TETRA 2 % Decent section length name (in 32-bit words).
+ BYTE "aaaaaaaa"
+ TETRA 0x11 % Flags.
+ OCTA 12 % Decent section length. However...
+ ESPEC % Everything ends here. The next thing is a LOP_LOC for .data, or
+ % an ending LOP-something, hence a non-LOP_QUOTE in the section
+ % length, high part.
+ .data
+ TETRA 0x112233
diff --git a/ld/testsuite/ld-mmix/bspec807.s b/ld/testsuite/ld-mmix/bspec807.s
new file mode 100644
index 0000000..3c16c12
--- /dev/null
+++ b/ld/testsuite/ld-mmix/bspec807.s
@@ -0,0 +1,9 @@
+ BSPEC 80
+ TETRA 2 % Decent section length name (in 32-bit words).
+ BYTE "aaaaaaaa"
+ TETRA 0x11 % Flags.
+ TETRA 0,12 % Decent section length. However...
+ TETRA 0 % Things end stops after the high part of the VMA.
+ ESPEC
+ .data
+ TETRA 0x112233
diff --git a/ld/testsuite/ld-mmix/bspec808.s b/ld/testsuite/ld-mmix/bspec808.s
new file mode 100644
index 0000000..b8fc495
--- /dev/null
+++ b/ld/testsuite/ld-mmix/bspec808.s
@@ -0,0 +1,9 @@
+ BSPEC 80
+ TETRA 2 % Decent section length name (in 32-bit words).
+ BYTE "aaaaaaaa"
+ TETRA 0x11 % Flags.
+ TETRA 0xff00,0 % Indecent section length
+ TETRA 0xff,0 % Decent vma.
+ ESPEC
+ .data
+ TETRA 0x112233
diff --git a/ld/testsuite/ld-mmix/bza-1b.d b/ld/testsuite/ld-mmix/bza-1b.d
new file mode 100644
index 0000000..dcd0313
--- /dev/null
+++ b/ld/testsuite/ld-mmix/bza-1b.d
@@ -0,0 +1,26 @@
+#source: start.s
+#source: a.s
+#source: bza.s
+#as: -x
+#ld: -m elf64mmix
+#objdump: -dr
+
+.*: file format elf64-mmix
+
+Disassembly of section \.text:
+
+0+ <_start>:
+ 0+: e3fd0001 setl \$253,0x1
+
+0+4 <a>:
+ 4: e3fd0004 setl \$253,0x4
+
+0+8 <bza>:
+ 8: e3fd0002 setl \$253,0x2
+ c: 5aea0006 pbnz \$234,24 <bza\+0x1c>
+ 10: e3ff0004 setl \$255,0x4
+ 14: e6ff0000 incml \$255,0x0
+ 18: e5ff0000 incmh \$255,0x0
+ 1c: e4ff0000 inch \$255,0x0
+ 20: 9fffff00 go \$255,\$255,0
+ 24: e3fd0003 setl \$253,0x3
diff --git a/ld/testsuite/ld-mmix/bza-1f.d b/ld/testsuite/ld-mmix/bza-1f.d
new file mode 100644
index 0000000..bc4006f
--- /dev/null
+++ b/ld/testsuite/ld-mmix/bza-1f.d
@@ -0,0 +1,26 @@
+#source: start.s
+#source: bza.s
+#source: a.s
+#as: -x
+#ld: -m elf64mmix
+#objdump: -dr
+
+.*: file format elf64-mmix
+
+Disassembly of section \.text:
+
+0+ <_start>:
+ 0+: e3fd0001 setl \$253,0x1
+
+0+4 <bza>:
+ 4: e3fd0002 setl \$253,0x2
+ 8: 5aea0006 pbnz \$234,20 <bza\+0x1c>
+ c: e3ff0024 setl \$255,0x24
+ 10: e6ff0000 incml \$255,0x0
+ 14: e5ff0000 incmh \$255,0x0
+ 18: e4ff0000 inch \$255,0x0
+ 1c: 9fffff00 go \$255,\$255,0
+ 20: e3fd0003 setl \$253,0x3
+
+0+24 <a>:
+ 24: e3fd0004 setl \$253,0x4
diff --git a/ld/testsuite/ld-mmix/bza-2b.d b/ld/testsuite/ld-mmix/bza-2b.d
new file mode 100644
index 0000000..a5d9b28
--- /dev/null
+++ b/ld/testsuite/ld-mmix/bza-2b.d
@@ -0,0 +1,21 @@
+#source: start.s
+#source: a.s
+#source: bza.s
+#as: -no-expand
+#ld: -m elf64mmix
+#objdump: -dr
+
+.*: file format elf64-mmix
+
+Disassembly of section \.text:
+
+0+ <_start>:
+ 0+: e3fd0001 setl \$253,0x1
+
+0+4 <a>:
+ 4: e3fd0004 setl \$253,0x4
+
+0+8 <bza>:
+ 8: e3fd0002 setl \$253,0x2
+ c: 43eafffe bz \$234,4 <a>
+ 10: e3fd0003 setl \$253,0x3
diff --git a/ld/testsuite/ld-mmix/bza-2f.d b/ld/testsuite/ld-mmix/bza-2f.d
new file mode 100644
index 0000000..21a6ca9
--- /dev/null
+++ b/ld/testsuite/ld-mmix/bza-2f.d
@@ -0,0 +1,21 @@
+#source: start.s
+#source: bza.s
+#source: a.s
+#as: -no-expand
+#ld: -m elf64mmix
+#objdump: -dr
+
+.*: file format elf64-mmix
+
+Disassembly of section \.text:
+
+0+ <_start>:
+ 0: e3fd0001 setl \$253,0x1
+
+0+4 <bza>:
+ 4: e3fd0002 setl \$253,0x2
+ 8: 42ea0002 bz \$234,10 <a>
+ c: e3fd0003 setl \$253,0x3
+
+0+10 <a>:
+ 10: e3fd0004 setl \$253,0x4
diff --git a/ld/testsuite/ld-mmix/bza-7b.d b/ld/testsuite/ld-mmix/bza-7b.d
new file mode 100644
index 0000000..ab98ad3
--- /dev/null
+++ b/ld/testsuite/ld-mmix/bza-7b.d
@@ -0,0 +1,26 @@
+#source: start.s
+#source: a.s
+#source: bza.s
+#as: -x
+#ld: -m mmo
+#objdump: -dr
+
+.*: file format mmo
+
+Disassembly of section \.text:
+
+0+ <(Main|_start)>:
+ 0+: e3fd0001 setl \$253,0x1
+
+0+4 <a>:
+ 4: e3fd0004 setl \$253,0x4
+
+0+8 <bza>:
+ 8: e3fd0002 setl \$253,0x2
+ c: 5aea0006 pbnz \$234,24 <bza\+0x1c>
+ 10: e3ff0004 setl \$255,0x4
+ 14: e6ff0000 incml \$255,0x0
+ 18: e5ff0000 incmh \$255,0x0
+ 1c: e4ff0000 inch \$255,0x0
+ 20: 9fffff00 go \$255,\$255,0
+ 24: e3fd0003 setl \$253,0x3
diff --git a/ld/testsuite/ld-mmix/bza-7f.d b/ld/testsuite/ld-mmix/bza-7f.d
new file mode 100644
index 0000000..be2ea56
--- /dev/null
+++ b/ld/testsuite/ld-mmix/bza-7f.d
@@ -0,0 +1,26 @@
+#source: start.s
+#source: bza.s
+#source: a.s
+#as: -x
+#ld: -m mmo
+#objdump: -dr
+
+.*: file format mmo
+
+Disassembly of section \.text:
+
+0+ <(Main|_start)>:
+ 0+: e3fd0001 setl \$253,0x1
+
+0+4 <bza>:
+ 4: e3fd0002 setl \$253,0x2
+ 8: 5aea0006 pbnz \$234,20 <bza\+0x1c>
+ c: e3ff0024 setl \$255,0x24
+ 10: e6ff0000 incml \$255,0x0
+ 14: e5ff0000 incmh \$255,0x0
+ 18: e4ff0000 inch \$255,0x0
+ 1c: 9fffff00 go \$255,\$255,0
+ 20: e3fd0003 setl \$253,0x3
+
+0+24 <a>:
+ 24: e3fd0004 setl \$253,0x4
diff --git a/ld/testsuite/ld-mmix/bza-8b.d b/ld/testsuite/ld-mmix/bza-8b.d
new file mode 100644
index 0000000..b0eef74
--- /dev/null
+++ b/ld/testsuite/ld-mmix/bza-8b.d
@@ -0,0 +1,21 @@
+#source: start.s
+#source: a.s
+#source: bza.s
+#as: -no-expand
+#ld: -m mmo
+#objdump: -dr
+
+.*: file format mmo
+
+Disassembly of section \.text:
+
+0+ <(Main|_start)>:
+ 0+: e3fd0001 setl \$253,0x1
+
+0+4 <a>:
+ 4: e3fd0004 setl \$253,0x4
+
+0+8 <bza>:
+ 8: e3fd0002 setl \$253,0x2
+ c: 43eafffe bz \$234,4 <a>
+ 10: e3fd0003 setl \$253,0x3
diff --git a/ld/testsuite/ld-mmix/bza-8f.d b/ld/testsuite/ld-mmix/bza-8f.d
new file mode 100644
index 0000000..2d2a521
--- /dev/null
+++ b/ld/testsuite/ld-mmix/bza-8f.d
@@ -0,0 +1,21 @@
+#source: start.s
+#source: bza.s
+#source: a.s
+#as: -no-expand
+#ld: -m mmo
+#objdump: -dr
+
+.*: file format mmo
+
+Disassembly of section \.text:
+
+0+ <(Main|_start)>:
+ 0+: e3fd0001 setl \$253,0x1
+
+0+4 <bza>:
+ 4: e3fd0002 setl \$253,0x2
+ 8: 42ea0002 bz \$234,10 <a>
+ c: e3fd0003 setl \$253,0x3
+
+0+10 <a>:
+ 10: e3fd0004 setl \$253,0x4
diff --git a/ld/testsuite/ld-mmix/bza.s b/ld/testsuite/ld-mmix/bza.s
new file mode 100644
index 0000000..4cf848d
--- /dev/null
+++ b/ld/testsuite/ld-mmix/bza.s
@@ -0,0 +1,7 @@
+* Just BEQs to an external symbol, with some padding.
+ .text
+ .global bza
+bza:
+ SET $253,2
+ BZ $234,a
+ SET $253,3
diff --git a/ld/testsuite/ld-mmix/data1.s b/ld/testsuite/ld-mmix/data1.s
new file mode 100644
index 0000000..0f4baf9
--- /dev/null
+++ b/ld/testsuite/ld-mmix/data1.s
@@ -0,0 +1,2 @@
+ LOC #20 << 56
+xx OCTA Main+44
diff --git a/ld/testsuite/ld-mmix/dloc1.s b/ld/testsuite/ld-mmix/dloc1.s
new file mode 100644
index 0000000..b8b009c
--- /dev/null
+++ b/ld/testsuite/ld-mmix/dloc1.s
@@ -0,0 +1,4 @@
+ LOC #20 << 56 + #200
+dloc1 TETRA 4,5,6
+ .global dloc1
+
diff --git a/ld/testsuite/ld-mmix/dloc2.s b/ld/testsuite/ld-mmix/dloc2.s
new file mode 100644
index 0000000..704da08
--- /dev/null
+++ b/ld/testsuite/ld-mmix/dloc2.s
@@ -0,0 +1,3 @@
+ LOC #20 << 56 + #200
+dloc2 TETRA 7,8,9
+ .global dloc2
diff --git a/ld/testsuite/ld-mmix/ext1-254.s b/ld/testsuite/ld-mmix/ext1-254.s
new file mode 100644
index 0000000..baaf22f
--- /dev/null
+++ b/ld/testsuite/ld-mmix/ext1-254.s
@@ -0,0 +1,2 @@
+ .global ext1
+ext1 IS 254
diff --git a/ld/testsuite/ld-mmix/ext1.s b/ld/testsuite/ld-mmix/ext1.s
new file mode 100644
index 0000000..d69420e
--- /dev/null
+++ b/ld/testsuite/ld-mmix/ext1.s
@@ -0,0 +1,2 @@
+ .global ext1
+ext1 IS 252
diff --git a/ld/testsuite/ld-mmix/ext1g.s b/ld/testsuite/ld-mmix/ext1g.s
new file mode 100644
index 0000000..1a167ab
--- /dev/null
+++ b/ld/testsuite/ld-mmix/ext1g.s
@@ -0,0 +1,2 @@
+ .global ext1
+ext1 GREG
diff --git a/ld/testsuite/ld-mmix/ext1l.s b/ld/testsuite/ld-mmix/ext1l.s
new file mode 100644
index 0000000..b7e6096
--- /dev/null
+++ b/ld/testsuite/ld-mmix/ext1l.s
@@ -0,0 +1,2 @@
+ .global ext1
+ext1 SWYM 4,8,16
diff --git a/ld/testsuite/ld-mmix/getaa-1b.d b/ld/testsuite/ld-mmix/getaa-1b.d
new file mode 100644
index 0000000..84b477d
--- /dev/null
+++ b/ld/testsuite/ld-mmix/getaa-1b.d
@@ -0,0 +1,24 @@
+#source: start.s
+#source: a.s
+#source: getaa.s
+#as: -x
+#ld: -m elf64mmix
+#objdump: -dr
+
+.*: file format elf64-mmix
+
+Disassembly of section \.text:
+
+0+ <_start>:
+ 0+: e3fd0001 setl \$253,0x1
+
+0+4 <a>:
+ 4: e3fd0004 setl \$253,0x4
+
+0+8 <getaa>:
+ 8: e3fd0002 setl \$253,0x2
+ c: e37b0004 setl \$123,0x4
+ 10: e67b0000 incml \$123,0x0
+ 14: e57b0000 incmh \$123,0x0
+ 18: e47b0000 inch \$123,0x0
+ 1c: e3fd0003 setl \$253,0x3
diff --git a/ld/testsuite/ld-mmix/getaa-1f.d b/ld/testsuite/ld-mmix/getaa-1f.d
new file mode 100644
index 0000000..cc628a2
--- /dev/null
+++ b/ld/testsuite/ld-mmix/getaa-1f.d
@@ -0,0 +1,24 @@
+#source: start.s
+#source: getaa.s
+#source: a.s
+#as: -x
+#ld: -m elf64mmix
+#objdump: -dr
+
+.*: file format elf64-mmix
+
+Disassembly of section \.text:
+
+0+ <_start>:
+ 0+: e3fd0001 setl \$253,0x1
+
+0+4 <getaa>:
+ 4: e3fd0002 setl \$253,0x2
+ 8: e37b001c setl \$123,0x1c
+ c: e67b0000 incml \$123,0x0
+ 10: e57b0000 incmh \$123,0x0
+ 14: e47b0000 inch \$123,0x0
+ 18: e3fd0003 setl \$253,0x3
+
+0+1c <a>:
+ 1c: e3fd0004 setl \$253,0x4
diff --git a/ld/testsuite/ld-mmix/getaa-2b.d b/ld/testsuite/ld-mmix/getaa-2b.d
new file mode 100644
index 0000000..4300128
--- /dev/null
+++ b/ld/testsuite/ld-mmix/getaa-2b.d
@@ -0,0 +1,21 @@
+#source: start.s
+#source: a.s
+#source: getaa.s
+#as: -no-expand
+#ld: -m elf64mmix
+#objdump: -dr
+
+.*: file format elf64-mmix
+
+Disassembly of section \.text:
+
+0+ <_start>:
+ 0+: e3fd0001 setl \$253,0x1
+
+0+4 <a>:
+ 4: e3fd0004 setl \$253,0x4
+
+0+8 <getaa>:
+ 8: e3fd0002 setl \$253,0x2
+ c: f57bfffe geta \$123,4 <a>
+ 10: e3fd0003 setl \$253,0x3
diff --git a/ld/testsuite/ld-mmix/getaa-2f.d b/ld/testsuite/ld-mmix/getaa-2f.d
new file mode 100644
index 0000000..fd32834
--- /dev/null
+++ b/ld/testsuite/ld-mmix/getaa-2f.d
@@ -0,0 +1,21 @@
+#source: start.s
+#source: getaa.s
+#source: a.s
+#as: -no-expand
+#ld: -m elf64mmix
+#objdump: -dr
+
+.*: file format elf64-mmix
+
+Disassembly of section \.text:
+
+0+ <_start>:
+ 0+: e3fd0001 setl \$253,0x1
+
+0+4 <getaa>:
+ 4: e3fd0002 setl \$253,0x2
+ 8: f47b0002 geta \$123,10 <a>
+ c: e3fd0003 setl \$253,0x3
+
+0+10 <a>:
+ 10: e3fd0004 setl \$253,0x4
diff --git a/ld/testsuite/ld-mmix/getaa-4b.d b/ld/testsuite/ld-mmix/getaa-4b.d
new file mode 100644
index 0000000..1a3614b
--- /dev/null
+++ b/ld/testsuite/ld-mmix/getaa-4b.d
@@ -0,0 +1,26 @@
+#source: start.s
+#source: a.s
+#source: pad2p18m32.s
+#source: pad16.s
+#source: pad4.s
+#source: pad4.s
+#source: getaa.s
+#as: -no-expand
+#ld: -m elf64mmix
+#objdump: -dr
+
+.*: file format elf64-mmix
+
+Disassembly of section \.text:
+
+0+ <_start>:
+ 0: e3fd0001 setl \$253,0x1
+
+0+4 <a>:
+ 4: e3fd0004 setl \$253,0x4
+ \.\.\.
+
+0+40000 <getaa>:
+ 40000: e3fd0002 setl \$253,0x2
+ 40004: f57b0000 geta \$123,4 <a>
+ 40008: e3fd0003 setl \$253,0x3
diff --git a/ld/testsuite/ld-mmix/getaa-4f.d b/ld/testsuite/ld-mmix/getaa-4f.d
new file mode 100644
index 0000000..30062a6
--- /dev/null
+++ b/ld/testsuite/ld-mmix/getaa-4f.d
@@ -0,0 +1,25 @@
+#source: start.s
+#source: getaa.s
+#source: pad2p18m32.s
+#source: pad16.s
+#source: pad4.s
+#source: a.s
+#as: -no-expand
+#ld: -m elf64mmix
+#objdump: -dr
+
+.*: file format elf64-mmix
+
+Disassembly of section \.text:
+
+0+ <_start>:
+ 0: e3fd0001 setl \$253,0x1
+
+0+4 <getaa>:
+ 4: e3fd0002 setl \$253,0x2
+ 8: f47bffff geta \$123,40004 <a>
+ c: e3fd0003 setl \$253,0x3
+ \.\.\.
+
+0+40004 <a>:
+ 40004: e3fd0004 setl \$253,0x4
diff --git a/ld/testsuite/ld-mmix/getaa-6b.d b/ld/testsuite/ld-mmix/getaa-6b.d
new file mode 100644
index 0000000..072142a
--- /dev/null
+++ b/ld/testsuite/ld-mmix/getaa-6b.d
@@ -0,0 +1,11 @@
+#source: start.s
+#source: a.s
+#source: pad2p18m32.s
+#source: pad16.s
+#source: pad4.s
+#source: pad4.s
+#source: pad4.s
+#source: getaa.s
+#as: -no-expand
+#ld: -m elf64mmix
+#error: relocation truncated to fit: R_MMIX_ADDR19 a$
diff --git a/ld/testsuite/ld-mmix/getaa-6f.d b/ld/testsuite/ld-mmix/getaa-6f.d
new file mode 100644
index 0000000..cfef86c
--- /dev/null
+++ b/ld/testsuite/ld-mmix/getaa-6f.d
@@ -0,0 +1,10 @@
+#source: start.s
+#source: getaa.s
+#source: pad2p18m32.s
+#source: pad16.s
+#source: pad4.s
+#source: pad4.s
+#source: a.s
+#as: -no-expand
+#ld: -m elf64mmix
+#error: relocation truncated to fit: R_MMIX_ADDR19 a$
diff --git a/ld/testsuite/ld-mmix/getaa-7b.d b/ld/testsuite/ld-mmix/getaa-7b.d
new file mode 100644
index 0000000..7a71c31
--- /dev/null
+++ b/ld/testsuite/ld-mmix/getaa-7b.d
@@ -0,0 +1,24 @@
+#source: start.s
+#source: a.s
+#source: getaa.s
+#as: -x
+#ld: -m mmo
+#objdump: -dr
+
+.*: file format mmo
+
+Disassembly of section .text:
+
+0+ <(Main|_start)>:
+ 0+: e3fd0001 setl \$253,0x1
+
+0+4 <a>:
+ 4: e3fd0004 setl \$253,0x4
+
+0+8 <getaa>:
+ 8: e3fd0002 setl \$253,0x2
+ c: e37b0004 setl \$123,0x4
+ 10: e67b0000 incml \$123,0x0
+ 14: e57b0000 incmh \$123,0x0
+ 18: e47b0000 inch \$123,0x0
+ 1c: e3fd0003 setl \$253,0x3
diff --git a/ld/testsuite/ld-mmix/getaa-7f.d b/ld/testsuite/ld-mmix/getaa-7f.d
new file mode 100644
index 0000000..ea831a9
--- /dev/null
+++ b/ld/testsuite/ld-mmix/getaa-7f.d
@@ -0,0 +1,24 @@
+#source: start.s
+#source: getaa.s
+#source: a.s
+#as: -x
+#ld: -m mmo
+#objdump: -dr
+
+.*: file format mmo
+
+Disassembly of section \.text:
+
+0+ <(Main|_start)>:
+ 0+: e3fd0001 setl \$253,0x1
+
+0+4 <getaa>:
+ 4: e3fd0002 setl \$253,0x2
+ 8: e37b001c setl \$123,0x1c
+ c: e67b0000 incml \$123,0x0
+ 10: e57b0000 incmh \$123,0x0
+ 14: e47b0000 inch \$123,0x0
+ 18: e3fd0003 setl \$253,0x3
+
+0+1c <a>:
+ 1c: e3fd0004 setl \$253,0x4
diff --git a/ld/testsuite/ld-mmix/getaa-8b.d b/ld/testsuite/ld-mmix/getaa-8b.d
new file mode 100644
index 0000000..a54cc10
--- /dev/null
+++ b/ld/testsuite/ld-mmix/getaa-8b.d
@@ -0,0 +1,21 @@
+#source: start.s
+#source: a.s
+#source: getaa.s
+#as: -no-expand
+#ld: -m mmo
+#objdump: -dr
+
+.*: file format mmo
+
+Disassembly of section \.text:
+
+0+ <(Main|_start)>:
+ 0+: e3fd0001 setl \$253,0x1
+
+0+4 <a>:
+ 4: e3fd0004 setl \$253,0x4
+
+0+8 <getaa>:
+ 8: e3fd0002 setl \$253,0x2
+ c: f57bfffe geta \$123,4 <a>
+ 10: e3fd0003 setl \$253,0x3
diff --git a/ld/testsuite/ld-mmix/getaa-8f.d b/ld/testsuite/ld-mmix/getaa-8f.d
new file mode 100644
index 0000000..4ba7307
--- /dev/null
+++ b/ld/testsuite/ld-mmix/getaa-8f.d
@@ -0,0 +1,21 @@
+#source: start.s
+#source: getaa.s
+#source: a.s
+#as: -no-expand
+#ld: -m mmo
+#objdump: -dr
+
+.*: file format mmo
+
+Disassembly of section \.text:
+
+0+ <(Main|_start)>:
+ 0+: e3fd0001 setl \$253,0x1
+
+0+4 <getaa>:
+ 4: e3fd0002 setl \$253,0x2
+ 8: f47b0002 geta \$123,10 <a>
+ c: e3fd0003 setl \$253,0x3
+
+0+10 <a>:
+ 10: e3fd0004 setl \$253,0x4
diff --git a/ld/testsuite/ld-mmix/getaa.s b/ld/testsuite/ld-mmix/getaa.s
new file mode 100644
index 0000000..cc4dfb7
--- /dev/null
+++ b/ld/testsuite/ld-mmix/getaa.s
@@ -0,0 +1,7 @@
+* Just geta an external symbol, with some padding.
+ .text
+ .global getaa
+getaa:
+ SET $253,2
+ GETA $123,a
+ SET $253,3
diff --git a/ld/testsuite/ld-mmix/getaa12b.d b/ld/testsuite/ld-mmix/getaa12b.d
new file mode 100644
index 0000000..c4e49e4
--- /dev/null
+++ b/ld/testsuite/ld-mmix/getaa12b.d
@@ -0,0 +1,26 @@
+#source: start.s
+#source: a.s
+#source: pad2p18m32.s
+#source: pad16.s
+#source: pad4.s
+#source: pad4.s
+#source: getaa.s
+#as: -no-expand
+#ld: -m mmo
+#objdump: -dr
+
+.*: file format mmo
+
+Disassembly of section \.text:
+
+0+ <(Main|_start)>:
+ 0: e3fd0001 setl \$253,0x1
+
+0+4 <a>:
+ 4: e3fd0004 setl \$253,0x4
+ \.\.\.
+
+0+40000 <getaa>:
+ 40000: e3fd0002 setl \$253,0x2
+ 40004: f57b0000 geta \$123,4 <a>
+ 40008: e3fd0003 setl \$253,0x3
diff --git a/ld/testsuite/ld-mmix/getaa12f.d b/ld/testsuite/ld-mmix/getaa12f.d
new file mode 100644
index 0000000..d80a39c
--- /dev/null
+++ b/ld/testsuite/ld-mmix/getaa12f.d
@@ -0,0 +1,25 @@
+#source: start.s
+#source: getaa.s
+#source: pad2p18m32.s
+#source: pad16.s
+#source: pad4.s
+#source: a.s
+#as: -no-expand
+#ld: -m mmo
+#objdump: -dr
+
+.*: file format mmo
+
+Disassembly of section \.text:
+
+0+ <(Main|_start)>:
+ 0: e3fd0001 setl \$253,0x1
+
+0+4 <getaa>:
+ 4: e3fd0002 setl \$253,0x2
+ 8: f47bffff geta \$123,40004 <a>
+ c: e3fd0003 setl \$253,0x3
+ \.\.\.
+
+0+40004 <a>:
+ 40004: e3fd0004 setl \$253,0x4
diff --git a/ld/testsuite/ld-mmix/getaa14b.d b/ld/testsuite/ld-mmix/getaa14b.d
new file mode 100644
index 0000000..ca37229
--- /dev/null
+++ b/ld/testsuite/ld-mmix/getaa14b.d
@@ -0,0 +1,11 @@
+#source: start.s
+#source: a.s
+#source: pad2p18m32.s
+#source: pad16.s
+#source: pad4.s
+#source: pad4.s
+#source: pad4.s
+#source: getaa.s
+#as: -no-expand
+#ld: -m mmo
+#error: relocation truncated to fit: R_MMIX_ADDR19 a$
diff --git a/ld/testsuite/ld-mmix/getaa14f.d b/ld/testsuite/ld-mmix/getaa14f.d
new file mode 100644
index 0000000..88a3b7d
--- /dev/null
+++ b/ld/testsuite/ld-mmix/getaa14f.d
@@ -0,0 +1,10 @@
+#source: start.s
+#source: getaa.s
+#source: pad2p18m32.s
+#source: pad16.s
+#source: pad4.s
+#source: pad4.s
+#source: a.s
+#as: -no-expand
+#ld: -m mmo
+#error: relocation truncated to fit: R_MMIX_ADDR19 a$
diff --git a/ld/testsuite/ld-mmix/greg-1.d b/ld/testsuite/ld-mmix/greg-1.d
new file mode 100644
index 0000000..d1d0371
--- /dev/null
+++ b/ld/testsuite/ld-mmix/greg-1.d
@@ -0,0 +1,36 @@
+#source: greg-1.s
+#source: gregldo1.s
+#source: start.s
+#ld: -m elf64mmix
+#objdump: -dt
+
+# Most simple greg usage: relocate to each possible location within an
+# insn.
+
+.*: 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+c 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+c g O \.text 0+ _start\.
+
+Disassembly of section \.text:
+
+0+ <_start-0xc>:
+ 0: 8c0c20fe ldo \$12,\$32,\$254
+ 4: 8d7bfe22 ldo \$123,\$254,34
+ 8: 8dfeea38 ldo \$254,\$234,56
+
+0+c <_start>:
+ c: e3fd0001 setl \$253,0x1
diff --git a/ld/testsuite/ld-mmix/greg-1.s b/ld/testsuite/ld-mmix/greg-1.s
new file mode 100644
index 0000000..821460c
--- /dev/null
+++ b/ld/testsuite/ld-mmix/greg-1.s
@@ -0,0 +1,3 @@
+# Have a single GREG register allocation.
+ .global areg
+areg GREG 123456789101112
diff --git a/ld/testsuite/ld-mmix/greg-10.d b/ld/testsuite/ld-mmix/greg-10.d
new file mode 100644
index 0000000..acc702d
--- /dev/null
+++ b/ld/testsuite/ld-mmix/greg-10.d
@@ -0,0 +1,25 @@
+#source: greg-1.s
+#source: gregldo1.s
+#source: start.s
+#ld: -m mmo
+#objdump: -dt
+
+# Most simple greg usage: relocate to each possible location within an
+# insn; mmo.
+
+.*: file format mmo
+
+SYMBOL TABLE:
+0+c g \.text Main
+0+c g \.text _start
+0+fe g \*REG\* areg
+
+Disassembly of section \.text:
+
+0+ <Main-0xc>:
+ 0: 8c0c20fe ldo \$12,\$32,areg
+ 4: 8d7bfe22 ldo \$123,areg,34
+ 8: 8dfeea38 ldo areg,\$234,56
+
+0+c <(Main|_start)>:
+ c: e3fd0001 setl \$253,0x1
diff --git a/ld/testsuite/ld-mmix/greg-11.d b/ld/testsuite/ld-mmix/greg-11.d
new file mode 100644
index 0000000..5fc474b
--- /dev/null
+++ b/ld/testsuite/ld-mmix/greg-11.d
@@ -0,0 +1,39 @@
+#source: greg-1.s
+#source: gregldo1.s
+#source: gregget2.s
+#source: a.s
+#source: greg-3.s
+#source: start.s
+#source: greg-2.s
+#as: -x
+#ld: -m mmo
+#objdump: -dt
+
+# Have two used gregs and one unused, mmo.
+
+.*: file format mmo
+
+SYMBOL TABLE:
+0+20 g \.text Main
+0+fe g \*REG\* b
+0+20 g \.text _start
+0+fc g \*REG\* areg
+0+fd g \*REG\* c
+0+1c g \.text a
+
+Disassembly of section \.text:
+
+0+ <a-0x1c>:
+ 0: 8c0c20fc ldo \$12,\$32,areg
+ 4: 8d7bfc22 ldo \$123,areg,34
+ 8: 8dfcea38 ldo areg,\$234,56
+ c: e3fe001c setl b,0x1c
+ 10: e6fe0000 incml b,0x0
+ 14: e5fe0000 incmh b,0x0
+ 18: e4fe0000 inch b,0x0
+
+0+1c <a>:
+ 1c: e3fd0004 setl c,0x4
+
+0+20 <(Main|_start)>:
+ 20: e3fd0001 setl c,0x1
diff --git a/ld/testsuite/ld-mmix/greg-11b.d b/ld/testsuite/ld-mmix/greg-11b.d
new file mode 100644
index 0000000..50665d0
--- /dev/null
+++ b/ld/testsuite/ld-mmix/greg-11b.d
@@ -0,0 +1,32 @@
+#source: greg-1.s
+#source: gregldo1.s
+#source: gregget2.s
+#source: a.s
+#source: greg-3.s
+#source: start.s
+#source: greg-2.s
+#as: -x
+#ld: -m mmo
+#objdump: -str
+
+# Have two used gregs and one unused, mmo; display contents to visualize
+# mmo bug with register contents.
+
+.*: file format mmo
+
+SYMBOL TABLE:
+0+20 g \.text Main
+0+fe g \*REG\* b
+0+20 g \.text _start
+0+fc g \*REG\* areg
+0+fd g \*REG\* c
+0+1c g \.text a
+
+
+Contents of section \.text:
+ 0+ 8c0c20fc 8d7bfc22 8dfcea38 e3fe001c .*
+ 0+10 e6fe0000 e5fe0000 e4fe0000 e3fd0004 .*
+ 0+20 e3fd0001 .*
+Contents of section \.MMIX\.reg_contents:
+ 07e0 00007048 860f3a38 00000000 00000042 .*
+ 07f0 007acf50 505a30a2 .*
diff --git a/ld/testsuite/ld-mmix/greg-12.d b/ld/testsuite/ld-mmix/greg-12.d
new file mode 100644
index 0000000..b438632
--- /dev/null
+++ b/ld/testsuite/ld-mmix/greg-12.d
@@ -0,0 +1,34 @@
+#source: greg-1.s
+#source: gregget1.s
+#source: start.s
+#source: a.s
+#as: -x
+#ld: -m mmo
+#objdump: -dt
+
+# A greg usage with an expanding insn. The register reloc must be
+# evaluated before the expanding reloc. Here, it doesn't appear in the
+# wrong order, and it doesn't seem like they would naturally appear in the
+# wrong order, but anyway; mmo.
+
+.*: file format mmo
+
+SYMBOL TABLE:
+0+10 g \.text Main
+0+10 g \.text _start
+0+fe g \*REG\* areg
+0+14 g \.text a
+
+Disassembly of section \.text:
+
+0+ <(Main|_start)-0x10>:
+ 0: e3fe0014 setl areg,0x14
+ 4: e6fe0000 incml areg,0x0
+ 8: e5fe0000 incmh areg,0x0
+ c: e4fe0000 inch areg,0x0
+
+0+10 <(Main|_start)>:
+ 10: e3fd0001 setl \$253,0x1
+
+0+14 <a>:
+ 14: e3fd0004 setl \$253,0x4
diff --git a/ld/testsuite/ld-mmix/greg-13.d b/ld/testsuite/ld-mmix/greg-13.d
new file mode 100644
index 0000000..091cf46
--- /dev/null
+++ b/ld/testsuite/ld-mmix/greg-13.d
@@ -0,0 +1,33 @@
+#source: greg-1.s
+#source: gregbza1.s
+#source: start.s
+#source: a.s
+#as: -x
+#ld: -m mmo
+#objdump: -dt
+
+# Like greg-3, but a different expanding insn, mmo.
+
+.*: file format mmo
+
+SYMBOL TABLE:
+0+18 g \.text Main
+0+18 g \.text _start
+0+fe g \*REG\* areg
+0+1c g \.text a
+
+Disassembly of section \.text:
+
+0+ <(Main|_start)-0x18>:
+ 0: 5afe0006 pbnz areg,18 <(Main|_start)>
+ 4: e3ff001c setl \$255,0x1c
+ 8: e6ff0000 incml \$255,0x0
+ c: e5ff0000 incmh \$255,0x0
+ 10: e4ff0000 inch \$255,0x0
+ 14: 9fffff00 go \$255,\$255,0
+
+0+18 <(Main|_start)>:
+ 18: e3fd0001 setl \$253,0x1
+
+0+1c <a>:
+ 1c: e3fd0004 setl \$253,0x4
diff --git a/ld/testsuite/ld-mmix/greg-14.d b/ld/testsuite/ld-mmix/greg-14.d
new file mode 100644
index 0000000..cacfbd6
--- /dev/null
+++ b/ld/testsuite/ld-mmix/greg-14.d
@@ -0,0 +1,32 @@
+#source: greg-1.s
+#source: gregpsj1.s
+#source: start.s
+#source: a.s
+#as: -x
+#ld: -m mmo
+#objdump: -dt
+
+# Like greg-3, but a different expanding insn.
+
+.*: file format mmo
+
+SYMBOL TABLE:
+0+14 g \.text Main
+0+14 g \.text _start
+0+fe g \*REG\* areg
+0+18 g \.text a
+
+Disassembly of section \.text:
+
+0+ <(Main|_start)-0x14>:
+ 0: e3ff0018 setl \$255,0x18
+ 4: e6ff0000 incml \$255,0x0
+ 8: e5ff0000 incmh \$255,0x0
+ c: e4ff0000 inch \$255,0x0
+ 10: bffeff00 pushgo areg,\$255,0
+
+0+14 <(Main|_start)>:
+ 14: e3fd0001 setl \$253,0x1
+
+0+18 <a>:
+ 18: e3fd0004 setl \$253,0x4
diff --git a/ld/testsuite/ld-mmix/greg-15.d b/ld/testsuite/ld-mmix/greg-15.d
new file mode 100644
index 0000000..4b54153
--- /dev/null
+++ b/ld/testsuite/ld-mmix/greg-15.d
@@ -0,0 +1,59 @@
+#source: gregget1.s
+#source: greg-5.s
+#source: greg-5.s
+#source: greg-5.s
+#source: greg-5.s
+#source: greg-5.s
+#source: greg-5.s
+#source: greg-5.s
+#source: greg-5.s
+#source: greg-5.s
+#source: greg-5.s
+#source: greg-5.s
+#source: greg-5.s
+#source: greg-5.s
+#source: greg-4.s
+#source: greg-4.s
+#source: greg-4.s
+#source: greg-4.s
+#source: greg-4.s
+#source: greg-4.s
+#source: greg-4.s
+#source: greg-4.s
+#source: greg-4.s
+#source: greg-4.s
+#source: greg-4.s
+#source: greg-4.s
+#source: greg-4.s
+#source: greg-4.s
+#source: greg-1.s
+#source: a.s
+#source: start.s
+#as: -x
+#ld: -m mmo
+#objdump: -dt
+
+# Allocating the maximum number of gregs and referring to one at the end
+# still works, mmo.
+
+.*: file format mmo
+
+SYMBOL TABLE:
+0+14 g \.text Main
+0+14 g \.text _start
+0+fe g \*REG\* areg
+0+10 g \.text a
+
+Disassembly of section \.text:
+
+0+ <a-0x10>:
+ 0: e3fe0010 setl areg,0x10
+ 4: e6fe0000 incml areg,0x0
+ 8: e5fe0000 incmh areg,0x0
+ c: e4fe0000 inch areg,0x0
+
+0+10 <a>:
+ 10: e3fd0004 setl \$253,0x4
+
+0+14 <(Main|_start)>:
+ 14: e3fd0001 setl \$253,0x1
diff --git a/ld/testsuite/ld-mmix/greg-16.d b/ld/testsuite/ld-mmix/greg-16.d
new file mode 100644
index 0000000..80b2338
--- /dev/null
+++ b/ld/testsuite/ld-mmix/greg-16.d
@@ -0,0 +1,59 @@
+#source: gregget1.s
+#source: greg-1.s
+#source: greg-5.s
+#source: greg-5.s
+#source: greg-5.s
+#source: greg-5.s
+#source: greg-5.s
+#source: greg-5.s
+#source: greg-5.s
+#source: greg-5.s
+#source: greg-5.s
+#source: greg-5.s
+#source: greg-5.s
+#source: greg-5.s
+#source: greg-5.s
+#source: greg-4.s
+#source: greg-4.s
+#source: greg-4.s
+#source: greg-4.s
+#source: greg-4.s
+#source: greg-4.s
+#source: greg-4.s
+#source: greg-4.s
+#source: greg-4.s
+#source: greg-4.s
+#source: greg-4.s
+#source: greg-4.s
+#source: greg-4.s
+#source: greg-4.s
+#source: a.s
+#source: start.s
+#as: -x
+#ld: -m mmo
+#objdump: -dt
+
+# Allocating the maximum number of gregs and referring to one at the
+# *other* end still works, mmo.
+
+.*: file format mmo
+
+SYMBOL TABLE:
+0+14 g \.text Main
+0+14 g \.text _start
+0+20 g \*REG\* areg
+0+10 g \.text a
+
+Disassembly of section \.text:
+
+0+ <a-0x10>:
+ 0: e3200010 setl areg,0x10
+ 4: e6200000 incml areg,0x0
+ 8: e5200000 incmh areg,0x0
+ c: e4200000 inch areg,0x0
+
+0+10 <a>:
+ 10: e3fd0004 setl \$253,0x4
+
+0+14 <(Main|_start)>:
+ 14: e3fd0001 setl \$253,0x1
diff --git a/ld/testsuite/ld-mmix/greg-17.d b/ld/testsuite/ld-mmix/greg-17.d
new file mode 100644
index 0000000..e1af4b5
--- /dev/null
+++ b/ld/testsuite/ld-mmix/greg-17.d
@@ -0,0 +1,37 @@
+#source: gregget1.s
+#source: greg-1.s
+#source: greg-5.s
+#source: greg-5.s
+#source: greg-5.s
+#source: greg-5.s
+#source: greg-5.s
+#source: greg-5.s
+#source: greg-5.s
+#source: greg-5.s
+#source: greg-5.s
+#source: greg-5.s
+#source: greg-5.s
+#source: greg-5.s
+#source: greg-5.s
+#source: greg-4.s
+#source: greg-4.s
+#source: greg-4.s
+#source: greg-4.s
+#source: greg-4.s
+#source: greg-4.s
+#source: greg-4.s
+#source: greg-4.s
+#source: greg-4.s
+#source: greg-4.s
+#source: greg-4.s
+#source: greg-4.s
+#source: greg-4.s
+#source: greg-4.s
+#source: greg-4.s
+#source: a.s
+#source: start.s
+#as: -x
+#ld: -m mmo
+#error: Too many global registers: 224, max 223
+
+# Allocating the maximum number of gregs *plus one* is an error, mmo.
diff --git a/ld/testsuite/ld-mmix/greg-18.d b/ld/testsuite/ld-mmix/greg-18.d
new file mode 100644
index 0000000..ed1bbaf
--- /dev/null
+++ b/ld/testsuite/ld-mmix/greg-18.d
@@ -0,0 +1,39 @@
+#source: gregget1.s
+#source: greg-5.s
+#source: greg-5.s
+#source: greg-5.s
+#source: greg-5.s
+#source: greg-5.s
+#source: greg-5.s
+#source: greg-5.s
+#source: greg-5.s
+#source: greg-5.s
+#source: greg-5.s
+#source: greg-5.s
+#source: greg-5.s
+#source: greg-5.s
+#source: greg-4.s
+#source: greg-4.s
+#source: greg-4.s
+#source: greg-4.s
+#source: greg-4.s
+#source: greg-4.s
+#source: greg-4.s
+#source: greg-4.s
+#source: greg-4.s
+#source: greg-4.s
+#source: greg-4.s
+#source: greg-4.s
+#source: greg-4.s
+#source: greg-4.s
+#source: greg-4.s
+#source: greg-1.s
+#source: a.s
+#source: start.s
+#as: -x
+#ld: -m mmo
+#objdump: -dt
+#error: Too many global registers: 224, max 223
+
+# Allocating the maximum number of gregs *plus one* is an error; other end
+# of the stick, mmo.
diff --git a/ld/testsuite/ld-mmix/greg-19.d b/ld/testsuite/ld-mmix/greg-19.d
new file mode 100644
index 0000000..6613133
--- /dev/null
+++ b/ld/testsuite/ld-mmix/greg-19.d
@@ -0,0 +1,32 @@
+#source: start.s
+#source: aregm.s
+#source: gregldo1.s
+#ld: -m elf64mmix
+#objdump: -str
+
+.*: 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 F \.text 0+ Main
+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:
+ 0+ e3fd0001 8f03fe10 8e0307fe 8f05fe04 .*
+ 0+10 8c0c20fe 8d7bfe22 8dfeea38 .*
+Contents of section \.data:
+Contents of section \.sbss:
+Contents of section \.MMIX\.reg_contents:
+ 07f0 00000000 00000004 .*
diff --git a/ld/testsuite/ld-mmix/greg-2.d b/ld/testsuite/ld-mmix/greg-2.d
new file mode 100644
index 0000000..0ac34c1
--- /dev/null
+++ b/ld/testsuite/ld-mmix/greg-2.d
@@ -0,0 +1,50 @@
+#source: greg-1.s
+#source: gregldo1.s
+#source: gregget2.s
+#source: a.s
+#source: greg-3.s
+#source: start.s
+#source: greg-2.s
+#as: -x
+#ld: -m elf64mmix
+#objdump: -dt
+
+# Have two used gregs and one unused.
+
+.*: 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+fe g \*REG\* 0+ b
+0+20 g \.text 0+ _start
+0+fc g \*REG\* 0+ areg
+0+fd g \*REG\* 0+ c
+2000000000000000 g O \*ABS\* 0+ __bss_start
+2000000000000000 g O \*ABS\* 0+ _edata
+2000000000000000 g O \*ABS\* 0+ _end
+0+20 g O \.text 0+ _start\.
+0+1c g \.text 0+ a
+
+Disassembly of section \.text:
+
+0+ <a-0x1c>:
+ 0: 8c0c20fc ldo \$12,\$32,\$252
+ 4: 8d7bfc22 ldo \$123,\$252,34
+ 8: 8dfcea38 ldo \$252,\$234,56
+ c: e3fe001c setl \$254,0x1c
+ 10: e6fe0000 incml \$254,0x0
+ 14: e5fe0000 incmh \$254,0x0
+ 18: e4fe0000 inch \$254,0x0
+
+0+1c <a>:
+ 1c: e3fd0004 setl \$253,0x4
+
+0+20 <_start>:
+ 20: e3fd0001 setl \$253,0x1
diff --git a/ld/testsuite/ld-mmix/greg-2.s b/ld/testsuite/ld-mmix/greg-2.s
new file mode 100644
index 0000000..588cbf1
--- /dev/null
+++ b/ld/testsuite/ld-mmix/greg-2.s
@@ -0,0 +1,3 @@
+# Have another GREG register allocation.
+ .global b
+b GREG 34567891011121314
diff --git a/ld/testsuite/ld-mmix/greg-20.d b/ld/testsuite/ld-mmix/greg-20.d
new file mode 100644
index 0000000..10daa08
--- /dev/null
+++ b/ld/testsuite/ld-mmix/greg-20.d
@@ -0,0 +1,18 @@
+#source: start.s
+#source: aregm.s
+#source: gregldo1.s
+#ld: -m mmo
+#objdump: -str
+
+.*: file format mmo
+
+SYMBOL TABLE:
+0+ g \.text Main
+0+ g \.text _start
+0+fe g \*REG\* areg
+
+Contents of section \.text:
+ 0+ e3fd0001 8f03fe10 8e0307fe 8f05fe04 .*
+ 0+10 8c0c20fe 8d7bfe22 8dfeea38 .*
+Contents of section \.MMIX\.reg_contents:
+ 07f0 00000000 00000004 .*
diff --git a/ld/testsuite/ld-mmix/greg-3.d b/ld/testsuite/ld-mmix/greg-3.d
new file mode 100644
index 0000000..0531393
--- /dev/null
+++ b/ld/testsuite/ld-mmix/greg-3.d
@@ -0,0 +1,45 @@
+#source: greg-1.s
+#source: gregget1.s
+#source: start.s
+#source: a.s
+#as: -x
+#ld: -m elf64mmix
+#objdump: -dt
+
+# A greg usage with an expanding insn. The register reloc must be
+# evaluated before the expanding reloc. Here, it doesn't appear in the
+# wrong order, and it doesn't seem like they would naturally appear in the
+# wrong order, but anyway.
+
+.*: 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+10 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+10 g O \.text 0+ _start\.
+0+14 g \.text 0+ a
+
+Disassembly of section \.text:
+
+0+ <_start-0x10>:
+ 0: e3fe0014 setl \$254,0x14
+ 4: e6fe0000 incml \$254,0x0
+ 8: e5fe0000 incmh \$254,0x0
+ c: e4fe0000 inch \$254,0x0
+
+0+10 <_start>:
+ 10: e3fd0001 setl \$253,0x1
+
+0+14 <a>:
+ 14: e3fd0004 setl \$253,0x4
diff --git a/ld/testsuite/ld-mmix/greg-3.s b/ld/testsuite/ld-mmix/greg-3.s
new file mode 100644
index 0000000..5248591
--- /dev/null
+++ b/ld/testsuite/ld-mmix/greg-3.s
@@ -0,0 +1,3 @@
+# Have yet another GREG register allocation.
+ .global c
+c GREG #42
diff --git a/ld/testsuite/ld-mmix/greg-4.d b/ld/testsuite/ld-mmix/greg-4.d
new file mode 100644
index 0000000..c5e74bb
--- /dev/null
+++ b/ld/testsuite/ld-mmix/greg-4.d
@@ -0,0 +1,44 @@
+#source: greg-1.s
+#source: gregbza1.s
+#source: start.s
+#source: a.s
+#as: -x
+#ld: -m elf64mmix
+#objdump: -dt
+
+# Like greg-3, but a different expanding insn.
+
+.*: 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+18 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+18 g O \.text 0+ _start\.
+0+1c g \.text 0+ a
+
+Disassembly of section \.text:
+
+0+ <_start-0x18>:
+ 0: 5afe0006 pbnz \$254,18 <_start>
+ 4: e3ff001c setl \$255,0x1c
+ 8: e6ff0000 incml \$255,0x0
+ c: e5ff0000 incmh \$255,0x0
+ 10: e4ff0000 inch \$255,0x0
+ 14: 9fffff00 go \$255,\$255,0
+
+0+18 <_start>:
+ 18: e3fd0001 setl \$253,0x1
+
+0+1c <a>:
+ 1c: e3fd0004 setl \$253,0x4
diff --git a/ld/testsuite/ld-mmix/greg-4.s b/ld/testsuite/ld-mmix/greg-4.s
new file mode 100644
index 0000000..5e5a30f
--- /dev/null
+++ b/ld/testsuite/ld-mmix/greg-4.s
@@ -0,0 +1,2 @@
+# A single local greg.
+lsym GREG 78
diff --git a/ld/testsuite/ld-mmix/greg-5.d b/ld/testsuite/ld-mmix/greg-5.d
new file mode 100644
index 0000000..4c92607
--- /dev/null
+++ b/ld/testsuite/ld-mmix/greg-5.d
@@ -0,0 +1,43 @@
+#source: greg-1.s
+#source: gregpsj1.s
+#source: start.s
+#source: a.s
+#as: -x
+#ld: -m elf64mmix
+#objdump: -dt
+
+# Like greg-3, but a different expanding insn.
+
+.*: 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+14 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+14 g O \.text 0+ _start\.
+0+18 g \.text 0+ a
+
+Disassembly of section \.text:
+
+0+ <_start-0x14>:
+ 0: e3ff0018 setl \$255,0x18
+ 4: e6ff0000 incml \$255,0x0
+ 8: e5ff0000 incmh \$255,0x0
+ c: e4ff0000 inch \$255,0x0
+ 10: bffeff00 pushgo \$254,\$255,0
+
+0+14 <_start>:
+ 14: e3fd0001 setl \$253,0x1
+
+0+18 <a>:
+ 18: e3fd0004 setl \$253,0x4
diff --git a/ld/testsuite/ld-mmix/greg-5.s b/ld/testsuite/ld-mmix/greg-5.s
new file mode 100644
index 0000000..65400af
--- /dev/null
+++ b/ld/testsuite/ld-mmix/greg-5.s
@@ -0,0 +1,20 @@
+# 16 local gregs.
+A GREG
+B GREG
+C GREG
+D GREG
+
+E GREG
+F GREG
+G GREG
+H GREG
+
+I GREG
+J GREG
+K GREG
+L GREG
+
+M GREG
+N GREG
+O GREG
+P GREG
diff --git a/ld/testsuite/ld-mmix/greg-6.d b/ld/testsuite/ld-mmix/greg-6.d
new file mode 100644
index 0000000..3ec5e4f
--- /dev/null
+++ b/ld/testsuite/ld-mmix/greg-6.d
@@ -0,0 +1,292 @@
+#source: gregget1.s
+#source: greg-5.s
+#source: greg-5.s
+#source: greg-5.s
+#source: greg-5.s
+#source: greg-5.s
+#source: greg-5.s
+#source: greg-5.s
+#source: greg-5.s
+#source: greg-5.s
+#source: greg-5.s
+#source: greg-5.s
+#source: greg-5.s
+#source: greg-5.s
+#source: greg-4.s
+#source: greg-4.s
+#source: greg-4.s
+#source: greg-4.s
+#source: greg-4.s
+#source: greg-4.s
+#source: greg-4.s
+#source: greg-4.s
+#source: greg-4.s
+#source: greg-4.s
+#source: greg-4.s
+#source: greg-4.s
+#source: greg-4.s
+#source: greg-4.s
+#source: greg-1.s
+#source: a.s
+#source: start.s
+#as: -x
+#ld: -m elf64mmix
+#objdump: -dt
+
+# Allocating the maximum number of gregs and referring to one at the end
+# still works.
+
+.*: file format elf64-mmix
+
+SYMBOL TABLE:
+0+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+20 l \*REG\* 0+ P
+0+21 l \*REG\* 0+ O
+0+22 l \*REG\* 0+ N
+0+23 l \*REG\* 0+ M
+0+24 l \*REG\* 0+ L
+0+25 l \*REG\* 0+ K
+0+26 l \*REG\* 0+ J
+0+27 l \*REG\* 0+ I
+0+28 l \*REG\* 0+ H
+0+29 l \*REG\* 0+ G
+0+2a l \*REG\* 0+ F
+0+2b l \*REG\* 0+ E
+0+2c l \*REG\* 0+ D
+0+2d l \*REG\* 0+ C
+0+2e l \*REG\* 0+ B
+0+2f l \*REG\* 0+ A
+0+30 l \*REG\* 0+ P
+0+31 l \*REG\* 0+ O
+0+32 l \*REG\* 0+ N
+0+33 l \*REG\* 0+ M
+0+34 l \*REG\* 0+ L
+0+35 l \*REG\* 0+ K
+0+36 l \*REG\* 0+ J
+0+37 l \*REG\* 0+ I
+0+38 l \*REG\* 0+ H
+0+39 l \*REG\* 0+ G
+0+3a l \*REG\* 0+ F
+0+3b l \*REG\* 0+ E
+0+3c l \*REG\* 0+ D
+0+3d l \*REG\* 0+ C
+0+3e l \*REG\* 0+ B
+0+3f l \*REG\* 0+ A
+0+40 l \*REG\* 0+ P
+0+41 l \*REG\* 0+ O
+0+42 l \*REG\* 0+ N
+0+43 l \*REG\* 0+ M
+0+44 l \*REG\* 0+ L
+0+45 l \*REG\* 0+ K
+0+46 l \*REG\* 0+ J
+0+47 l \*REG\* 0+ I
+0+48 l \*REG\* 0+ H
+0+49 l \*REG\* 0+ G
+0+4a l \*REG\* 0+ F
+0+4b l \*REG\* 0+ E
+0+4c l \*REG\* 0+ D
+0+4d l \*REG\* 0+ C
+0+4e l \*REG\* 0+ B
+0+4f l \*REG\* 0+ A
+0+50 l \*REG\* 0+ P
+0+51 l \*REG\* 0+ O
+0+52 l \*REG\* 0+ N
+0+53 l \*REG\* 0+ M
+0+54 l \*REG\* 0+ L
+0+55 l \*REG\* 0+ K
+0+56 l \*REG\* 0+ J
+0+57 l \*REG\* 0+ I
+0+58 l \*REG\* 0+ H
+0+59 l \*REG\* 0+ G
+0+5a l \*REG\* 0+ F
+0+5b l \*REG\* 0+ E
+0+5c l \*REG\* 0+ D
+0+5d l \*REG\* 0+ C
+0+5e l \*REG\* 0+ B
+0+5f l \*REG\* 0+ A
+0+60 l \*REG\* 0+ P
+0+61 l \*REG\* 0+ O
+0+62 l \*REG\* 0+ N
+0+63 l \*REG\* 0+ M
+0+64 l \*REG\* 0+ L
+0+65 l \*REG\* 0+ K
+0+66 l \*REG\* 0+ J
+0+67 l \*REG\* 0+ I
+0+68 l \*REG\* 0+ H
+0+69 l \*REG\* 0+ G
+0+6a l \*REG\* 0+ F
+0+6b l \*REG\* 0+ E
+0+6c l \*REG\* 0+ D
+0+6d l \*REG\* 0+ C
+0+6e l \*REG\* 0+ B
+0+6f l \*REG\* 0+ A
+0+70 l \*REG\* 0+ P
+0+71 l \*REG\* 0+ O
+0+72 l \*REG\* 0+ N
+0+73 l \*REG\* 0+ M
+0+74 l \*REG\* 0+ L
+0+75 l \*REG\* 0+ K
+0+76 l \*REG\* 0+ J
+0+77 l \*REG\* 0+ I
+0+78 l \*REG\* 0+ H
+0+79 l \*REG\* 0+ G
+0+7a l \*REG\* 0+ F
+0+7b l \*REG\* 0+ E
+0+7c l \*REG\* 0+ D
+0+7d l \*REG\* 0+ C
+0+7e l \*REG\* 0+ B
+0+7f l \*REG\* 0+ A
+0+80 l \*REG\* 0+ P
+0+81 l \*REG\* 0+ O
+0+82 l \*REG\* 0+ N
+0+83 l \*REG\* 0+ M
+0+84 l \*REG\* 0+ L
+0+85 l \*REG\* 0+ K
+0+86 l \*REG\* 0+ J
+0+87 l \*REG\* 0+ I
+0+88 l \*REG\* 0+ H
+0+89 l \*REG\* 0+ G
+0+8a l \*REG\* 0+ F
+0+8b l \*REG\* 0+ E
+0+8c l \*REG\* 0+ D
+0+8d l \*REG\* 0+ C
+0+8e l \*REG\* 0+ B
+0+8f l \*REG\* 0+ A
+0+90 l \*REG\* 0+ P
+0+91 l \*REG\* 0+ O
+0+92 l \*REG\* 0+ N
+0+93 l \*REG\* 0+ M
+0+94 l \*REG\* 0+ L
+0+95 l \*REG\* 0+ K
+0+96 l \*REG\* 0+ J
+0+97 l \*REG\* 0+ I
+0+98 l \*REG\* 0+ H
+0+99 l \*REG\* 0+ G
+0+9a l \*REG\* 0+ F
+0+9b l \*REG\* 0+ E
+0+9c l \*REG\* 0+ D
+0+9d l \*REG\* 0+ C
+0+9e l \*REG\* 0+ B
+0+9f l \*REG\* 0+ A
+0+a0 l \*REG\* 0+ P
+0+a1 l \*REG\* 0+ O
+0+a2 l \*REG\* 0+ N
+0+a3 l \*REG\* 0+ M
+0+a4 l \*REG\* 0+ L
+0+a5 l \*REG\* 0+ K
+0+a6 l \*REG\* 0+ J
+0+a7 l \*REG\* 0+ I
+0+a8 l \*REG\* 0+ H
+0+a9 l \*REG\* 0+ G
+0+aa l \*REG\* 0+ F
+0+ab l \*REG\* 0+ E
+0+ac l \*REG\* 0+ D
+0+ad l \*REG\* 0+ C
+0+ae l \*REG\* 0+ B
+0+af l \*REG\* 0+ A
+0+b0 l \*REG\* 0+ P
+0+b1 l \*REG\* 0+ O
+0+b2 l \*REG\* 0+ N
+0+b3 l \*REG\* 0+ M
+0+b4 l \*REG\* 0+ L
+0+b5 l \*REG\* 0+ K
+0+b6 l \*REG\* 0+ J
+0+b7 l \*REG\* 0+ I
+0+b8 l \*REG\* 0+ H
+0+b9 l \*REG\* 0+ G
+0+ba l \*REG\* 0+ F
+0+bb l \*REG\* 0+ E
+0+bc l \*REG\* 0+ D
+0+bd l \*REG\* 0+ C
+0+be l \*REG\* 0+ B
+0+bf l \*REG\* 0+ A
+0+c0 l \*REG\* 0+ P
+0+c1 l \*REG\* 0+ O
+0+c2 l \*REG\* 0+ N
+0+c3 l \*REG\* 0+ M
+0+c4 l \*REG\* 0+ L
+0+c5 l \*REG\* 0+ K
+0+c6 l \*REG\* 0+ J
+0+c7 l \*REG\* 0+ I
+0+c8 l \*REG\* 0+ H
+0+c9 l \*REG\* 0+ G
+0+ca l \*REG\* 0+ F
+0+cb l \*REG\* 0+ E
+0+cc l \*REG\* 0+ D
+0+cd l \*REG\* 0+ C
+0+ce l \*REG\* 0+ B
+0+cf l \*REG\* 0+ A
+0+d0 l \*REG\* 0+ P
+0+d1 l \*REG\* 0+ O
+0+d2 l \*REG\* 0+ N
+0+d3 l \*REG\* 0+ M
+0+d4 l \*REG\* 0+ L
+0+d5 l \*REG\* 0+ K
+0+d6 l \*REG\* 0+ J
+0+d7 l \*REG\* 0+ I
+0+d8 l \*REG\* 0+ H
+0+d9 l \*REG\* 0+ G
+0+da l \*REG\* 0+ F
+0+db l \*REG\* 0+ E
+0+dc l \*REG\* 0+ D
+0+dd l \*REG\* 0+ C
+0+de l \*REG\* 0+ B
+0+df l \*REG\* 0+ A
+0+e0 l \*REG\* 0+ P
+0+e1 l \*REG\* 0+ O
+0+e2 l \*REG\* 0+ N
+0+e3 l \*REG\* 0+ M
+0+e4 l \*REG\* 0+ L
+0+e5 l \*REG\* 0+ K
+0+e6 l \*REG\* 0+ J
+0+e7 l \*REG\* 0+ I
+0+e8 l \*REG\* 0+ H
+0+e9 l \*REG\* 0+ G
+0+ea l \*REG\* 0+ F
+0+eb l \*REG\* 0+ E
+0+ec l \*REG\* 0+ D
+0+ed l \*REG\* 0+ C
+0+ee l \*REG\* 0+ B
+0+ef l \*REG\* 0+ A
+0+f0 l \*REG\* 0+ lsym
+0+f1 l \*REG\* 0+ lsym
+0+f2 l \*REG\* 0+ lsym
+0+f3 l \*REG\* 0+ lsym
+0+f4 l \*REG\* 0+ lsym
+0+f5 l \*REG\* 0+ lsym
+0+f6 l \*REG\* 0+ lsym
+0+f7 l \*REG\* 0+ lsym
+0+f8 l \*REG\* 0+ lsym
+0+f9 l \*REG\* 0+ lsym
+0+fa l \*REG\* 0+ lsym
+0+fb l \*REG\* 0+ lsym
+0+fc l \*REG\* 0+ lsym
+0+fd l \*REG\* 0+ lsym
+0+14 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+14 g O \.text 0+ _start\.
+0+10 g \.text 0+ a
+
+Disassembly of section \.text:
+
+0+ <a-0x10>:
+ 0: e3fe0010 setl \$254,0x10
+ 4: e6fe0000 incml \$254,0x0
+ 8: e5fe0000 incmh \$254,0x0
+ c: e4fe0000 inch \$254,0x0
+
+0+10 <a>:
+ 10: e3fd0004 setl \$253,0x4
+
+0+14 <_start>:
+ 14: e3fd0001 setl \$253,0x1
diff --git a/ld/testsuite/ld-mmix/greg-7.d b/ld/testsuite/ld-mmix/greg-7.d
new file mode 100644
index 0000000..ea7f152
--- /dev/null
+++ b/ld/testsuite/ld-mmix/greg-7.d
@@ -0,0 +1,292 @@
+#source: gregget1.s
+#source: greg-1.s
+#source: greg-5.s
+#source: greg-5.s
+#source: greg-5.s
+#source: greg-5.s
+#source: greg-5.s
+#source: greg-5.s
+#source: greg-5.s
+#source: greg-5.s
+#source: greg-5.s
+#source: greg-5.s
+#source: greg-5.s
+#source: greg-5.s
+#source: greg-5.s
+#source: greg-4.s
+#source: greg-4.s
+#source: greg-4.s
+#source: greg-4.s
+#source: greg-4.s
+#source: greg-4.s
+#source: greg-4.s
+#source: greg-4.s
+#source: greg-4.s
+#source: greg-4.s
+#source: greg-4.s
+#source: greg-4.s
+#source: greg-4.s
+#source: greg-4.s
+#source: a.s
+#source: start.s
+#as: -x
+#ld: -m elf64mmix
+#objdump: -dt
+
+# Allocating the maximum number of gregs and referring to one at the
+# *other* end still works.
+
+.*: 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+21 l \*REG\* 0+ P
+0+22 l \*REG\* 0+ O
+0+23 l \*REG\* 0+ N
+0+24 l \*REG\* 0+ M
+0+25 l \*REG\* 0+ L
+0+26 l \*REG\* 0+ K
+0+27 l \*REG\* 0+ J
+0+28 l \*REG\* 0+ I
+0+29 l \*REG\* 0+ H
+0+2a l \*REG\* 0+ G
+0+2b l \*REG\* 0+ F
+0+2c l \*REG\* 0+ E
+0+2d l \*REG\* 0+ D
+0+2e l \*REG\* 0+ C
+0+2f l \*REG\* 0+ B
+0+30 l \*REG\* 0+ A
+0+31 l \*REG\* 0+ P
+0+32 l \*REG\* 0+ O
+0+33 l \*REG\* 0+ N
+0+34 l \*REG\* 0+ M
+0+35 l \*REG\* 0+ L
+0+36 l \*REG\* 0+ K
+0+37 l \*REG\* 0+ J
+0+38 l \*REG\* 0+ I
+0+39 l \*REG\* 0+ H
+0+3a l \*REG\* 0+ G
+0+3b l \*REG\* 0+ F
+0+3c l \*REG\* 0+ E
+0+3d l \*REG\* 0+ D
+0+3e l \*REG\* 0+ C
+0+3f l \*REG\* 0+ B
+0+40 l \*REG\* 0+ A
+0+41 l \*REG\* 0+ P
+0+42 l \*REG\* 0+ O
+0+43 l \*REG\* 0+ N
+0+44 l \*REG\* 0+ M
+0+45 l \*REG\* 0+ L
+0+46 l \*REG\* 0+ K
+0+47 l \*REG\* 0+ J
+0+48 l \*REG\* 0+ I
+0+49 l \*REG\* 0+ H
+0+4a l \*REG\* 0+ G
+0+4b l \*REG\* 0+ F
+0+4c l \*REG\* 0+ E
+0+4d l \*REG\* 0+ D
+0+4e l \*REG\* 0+ C
+0+4f l \*REG\* 0+ B
+0+50 l \*REG\* 0+ A
+0+51 l \*REG\* 0+ P
+0+52 l \*REG\* 0+ O
+0+53 l \*REG\* 0+ N
+0+54 l \*REG\* 0+ M
+0+55 l \*REG\* 0+ L
+0+56 l \*REG\* 0+ K
+0+57 l \*REG\* 0+ J
+0+58 l \*REG\* 0+ I
+0+59 l \*REG\* 0+ H
+0+5a l \*REG\* 0+ G
+0+5b l \*REG\* 0+ F
+0+5c l \*REG\* 0+ E
+0+5d l \*REG\* 0+ D
+0+5e l \*REG\* 0+ C
+0+5f l \*REG\* 0+ B
+0+60 l \*REG\* 0+ A
+0+61 l \*REG\* 0+ P
+0+62 l \*REG\* 0+ O
+0+63 l \*REG\* 0+ N
+0+64 l \*REG\* 0+ M
+0+65 l \*REG\* 0+ L
+0+66 l \*REG\* 0+ K
+0+67 l \*REG\* 0+ J
+0+68 l \*REG\* 0+ I
+0+69 l \*REG\* 0+ H
+0+6a l \*REG\* 0+ G
+0+6b l \*REG\* 0+ F
+0+6c l \*REG\* 0+ E
+0+6d l \*REG\* 0+ D
+0+6e l \*REG\* 0+ C
+0+6f l \*REG\* 0+ B
+0+70 l \*REG\* 0+ A
+0+71 l \*REG\* 0+ P
+0+72 l \*REG\* 0+ O
+0+73 l \*REG\* 0+ N
+0+74 l \*REG\* 0+ M
+0+75 l \*REG\* 0+ L
+0+76 l \*REG\* 0+ K
+0+77 l \*REG\* 0+ J
+0+78 l \*REG\* 0+ I
+0+79 l \*REG\* 0+ H
+0+7a l \*REG\* 0+ G
+0+7b l \*REG\* 0+ F
+0+7c l \*REG\* 0+ E
+0+7d l \*REG\* 0+ D
+0+7e l \*REG\* 0+ C
+0+7f l \*REG\* 0+ B
+0+80 l \*REG\* 0+ A
+0+81 l \*REG\* 0+ P
+0+82 l \*REG\* 0+ O
+0+83 l \*REG\* 0+ N
+0+84 l \*REG\* 0+ M
+0+85 l \*REG\* 0+ L
+0+86 l \*REG\* 0+ K
+0+87 l \*REG\* 0+ J
+0+88 l \*REG\* 0+ I
+0+89 l \*REG\* 0+ H
+0+8a l \*REG\* 0+ G
+0+8b l \*REG\* 0+ F
+0+8c l \*REG\* 0+ E
+0+8d l \*REG\* 0+ D
+0+8e l \*REG\* 0+ C
+0+8f l \*REG\* 0+ B
+0+90 l \*REG\* 0+ A
+0+91 l \*REG\* 0+ P
+0+92 l \*REG\* 0+ O
+0+93 l \*REG\* 0+ N
+0+94 l \*REG\* 0+ M
+0+95 l \*REG\* 0+ L
+0+96 l \*REG\* 0+ K
+0+97 l \*REG\* 0+ J
+0+98 l \*REG\* 0+ I
+0+99 l \*REG\* 0+ H
+0+9a l \*REG\* 0+ G
+0+9b l \*REG\* 0+ F
+0+9c l \*REG\* 0+ E
+0+9d l \*REG\* 0+ D
+0+9e l \*REG\* 0+ C
+0+9f l \*REG\* 0+ B
+0+a0 l \*REG\* 0+ A
+0+a1 l \*REG\* 0+ P
+0+a2 l \*REG\* 0+ O
+0+a3 l \*REG\* 0+ N
+0+a4 l \*REG\* 0+ M
+0+a5 l \*REG\* 0+ L
+0+a6 l \*REG\* 0+ K
+0+a7 l \*REG\* 0+ J
+0+a8 l \*REG\* 0+ I
+0+a9 l \*REG\* 0+ H
+0+aa l \*REG\* 0+ G
+0+ab l \*REG\* 0+ F
+0+ac l \*REG\* 0+ E
+0+ad l \*REG\* 0+ D
+0+ae l \*REG\* 0+ C
+0+af l \*REG\* 0+ B
+0+b0 l \*REG\* 0+ A
+0+b1 l \*REG\* 0+ P
+0+b2 l \*REG\* 0+ O
+0+b3 l \*REG\* 0+ N
+0+b4 l \*REG\* 0+ M
+0+b5 l \*REG\* 0+ L
+0+b6 l \*REG\* 0+ K
+0+b7 l \*REG\* 0+ J
+0+b8 l \*REG\* 0+ I
+0+b9 l \*REG\* 0+ H
+0+ba l \*REG\* 0+ G
+0+bb l \*REG\* 0+ F
+0+bc l \*REG\* 0+ E
+0+bd l \*REG\* 0+ D
+0+be l \*REG\* 0+ C
+0+bf l \*REG\* 0+ B
+0+c0 l \*REG\* 0+ A
+0+c1 l \*REG\* 0+ P
+0+c2 l \*REG\* 0+ O
+0+c3 l \*REG\* 0+ N
+0+c4 l \*REG\* 0+ M
+0+c5 l \*REG\* 0+ L
+0+c6 l \*REG\* 0+ K
+0+c7 l \*REG\* 0+ J
+0+c8 l \*REG\* 0+ I
+0+c9 l \*REG\* 0+ H
+0+ca l \*REG\* 0+ G
+0+cb l \*REG\* 0+ F
+0+cc l \*REG\* 0+ E
+0+cd l \*REG\* 0+ D
+0+ce l \*REG\* 0+ C
+0+cf l \*REG\* 0+ B
+0+d0 l \*REG\* 0+ A
+0+d1 l \*REG\* 0+ P
+0+d2 l \*REG\* 0+ O
+0+d3 l \*REG\* 0+ N
+0+d4 l \*REG\* 0+ M
+0+d5 l \*REG\* 0+ L
+0+d6 l \*REG\* 0+ K
+0+d7 l \*REG\* 0+ J
+0+d8 l \*REG\* 0+ I
+0+d9 l \*REG\* 0+ H
+0+da l \*REG\* 0+ G
+0+db l \*REG\* 0+ F
+0+dc l \*REG\* 0+ E
+0+dd l \*REG\* 0+ D
+0+de l \*REG\* 0+ C
+0+df l \*REG\* 0+ B
+0+e0 l \*REG\* 0+ A
+0+e1 l \*REG\* 0+ P
+0+e2 l \*REG\* 0+ O
+0+e3 l \*REG\* 0+ N
+0+e4 l \*REG\* 0+ M
+0+e5 l \*REG\* 0+ L
+0+e6 l \*REG\* 0+ K
+0+e7 l \*REG\* 0+ J
+0+e8 l \*REG\* 0+ I
+0+e9 l \*REG\* 0+ H
+0+ea l \*REG\* 0+ G
+0+eb l \*REG\* 0+ F
+0+ec l \*REG\* 0+ E
+0+ed l \*REG\* 0+ D
+0+ee l \*REG\* 0+ C
+0+ef l \*REG\* 0+ B
+0+f0 l \*REG\* 0+ A
+0+f1 l \*REG\* 0+ lsym
+0+f2 l \*REG\* 0+ lsym
+0+f3 l \*REG\* 0+ lsym
+0+f4 l \*REG\* 0+ lsym
+0+f5 l \*REG\* 0+ lsym
+0+f6 l \*REG\* 0+ lsym
+0+f7 l \*REG\* 0+ lsym
+0+f8 l \*REG\* 0+ lsym
+0+f9 l \*REG\* 0+ lsym
+0+fa l \*REG\* 0+ lsym
+0+fb l \*REG\* 0+ lsym
+0+fc l \*REG\* 0+ lsym
+0+fd l \*REG\* 0+ lsym
+0+fe l \*REG\* 0+ lsym
+0+14 g \.text 0+ _start
+0+20 g \*REG\* 0+ areg
+2000000000000000 g O \*ABS\* 0+ __bss_start
+2000000000000000 g O \*ABS\* 0+ _edata
+2000000000000000 g O \*ABS\* 0+ _end
+0+14 g O \.text 0+ _start\.
+0+10 g \.text 0+ a
+
+Disassembly of section \.text:
+
+0+ <a-0x10>:
+ 0: e3200010 setl \$32,0x10
+ 4: e6200000 incml \$32,0x0
+ 8: e5200000 incmh \$32,0x0
+ c: e4200000 inch \$32,0x0
+
+0+10 <a>:
+ 10: e3fd0004 setl \$253,0x4
+
+0+14 <_start>:
+ 14: e3fd0001 setl \$253,0x1
diff --git a/ld/testsuite/ld-mmix/greg-8.d b/ld/testsuite/ld-mmix/greg-8.d
new file mode 100644
index 0000000..cb6b776
--- /dev/null
+++ b/ld/testsuite/ld-mmix/greg-8.d
@@ -0,0 +1,37 @@
+#source: gregget1.s
+#source: greg-1.s
+#source: greg-5.s
+#source: greg-5.s
+#source: greg-5.s
+#source: greg-5.s
+#source: greg-5.s
+#source: greg-5.s
+#source: greg-5.s
+#source: greg-5.s
+#source: greg-5.s
+#source: greg-5.s
+#source: greg-5.s
+#source: greg-5.s
+#source: greg-5.s
+#source: greg-4.s
+#source: greg-4.s
+#source: greg-4.s
+#source: greg-4.s
+#source: greg-4.s
+#source: greg-4.s
+#source: greg-4.s
+#source: greg-4.s
+#source: greg-4.s
+#source: greg-4.s
+#source: greg-4.s
+#source: greg-4.s
+#source: greg-4.s
+#source: greg-4.s
+#source: greg-4.s
+#source: a.s
+#source: start.s
+#as: -x
+#ld: -m elf64mmix
+#error: Too many global registers: 224, max 223
+
+# Allocating the maximum number of gregs *plus one* is an error.
diff --git a/ld/testsuite/ld-mmix/greg-9.d b/ld/testsuite/ld-mmix/greg-9.d
new file mode 100644
index 0000000..c9d9fcd
--- /dev/null
+++ b/ld/testsuite/ld-mmix/greg-9.d
@@ -0,0 +1,39 @@
+#source: gregget1.s
+#source: greg-5.s
+#source: greg-5.s
+#source: greg-5.s
+#source: greg-5.s
+#source: greg-5.s
+#source: greg-5.s
+#source: greg-5.s
+#source: greg-5.s
+#source: greg-5.s
+#source: greg-5.s
+#source: greg-5.s
+#source: greg-5.s
+#source: greg-5.s
+#source: greg-4.s
+#source: greg-4.s
+#source: greg-4.s
+#source: greg-4.s
+#source: greg-4.s
+#source: greg-4.s
+#source: greg-4.s
+#source: greg-4.s
+#source: greg-4.s
+#source: greg-4.s
+#source: greg-4.s
+#source: greg-4.s
+#source: greg-4.s
+#source: greg-4.s
+#source: greg-4.s
+#source: greg-1.s
+#source: a.s
+#source: start.s
+#as: -x
+#ld: -m elf64mmix
+#objdump: -dt
+#error: Too many global registers: 224, max 223
+
+# Allocating the maximum number of gregs *plus one* is an error; other end
+# of the stick.
diff --git a/ld/testsuite/ld-mmix/gregbza1.s b/ld/testsuite/ld-mmix/gregbza1.s
new file mode 100644
index 0000000..878c66f
--- /dev/null
+++ b/ld/testsuite/ld-mmix/gregbza1.s
@@ -0,0 +1,4 @@
+# Use a symbolic register areg, presumably allocated by greg in another file.
+# The "BZ" will be expanded, and the reloc for areg must be resolved
+# before the other relocs for that insn.
+ BZ areg,a
diff --git a/ld/testsuite/ld-mmix/gregget1.s b/ld/testsuite/ld-mmix/gregget1.s
new file mode 100644
index 0000000..49f97f0
--- /dev/null
+++ b/ld/testsuite/ld-mmix/gregget1.s
@@ -0,0 +1,4 @@
+# Use a symbolic register areg, presumably allocated by greg in another file.
+# The "GETA" will be expanded, and the reloc for areg must be resolved
+# before the other relocs for that insn.
+ GETA areg,a
diff --git a/ld/testsuite/ld-mmix/gregget2.s b/ld/testsuite/ld-mmix/gregget2.s
new file mode 100644
index 0000000..855136c
--- /dev/null
+++ b/ld/testsuite/ld-mmix/gregget2.s
@@ -0,0 +1,4 @@
+# Use a symbolic register b, presumably allocated by greg in another file.
+# The "GETA" will be expanded, and the reloc for b must be resolved before
+# the other relocs for that insn.
+ GETA b,a
diff --git a/ld/testsuite/ld-mmix/gregldo1.s b/ld/testsuite/ld-mmix/gregldo1.s
new file mode 100644
index 0000000..3ea71e7
--- /dev/null
+++ b/ld/testsuite/ld-mmix/gregldo1.s
@@ -0,0 +1,6 @@
+# Use a symbolic register areg, presumably allocated by greg in another file.
+ LDO $12,$32,areg
+ LDO $123,areg,34
+ LDO areg,$234,56
+
+
diff --git a/ld/testsuite/ld-mmix/gregpsj1.s b/ld/testsuite/ld-mmix/gregpsj1.s
new file mode 100644
index 0000000..87b68a3
--- /dev/null
+++ b/ld/testsuite/ld-mmix/gregpsj1.s
@@ -0,0 +1,4 @@
+# Use a symbolic register areg, presumably allocated by greg in another file.
+# The "PUSHJ" will be expanded, and the reloc for areg must be resolved
+# before the other relocs for that insn.
+ PUSHJ areg,a
diff --git a/ld/testsuite/ld-mmix/hdr-1.d b/ld/testsuite/ld-mmix/hdr-1.d
new file mode 100644
index 0000000..3cb8265
--- /dev/null
+++ b/ld/testsuite/ld-mmix/hdr-1.d
@@ -0,0 +1,19 @@
+#source: start.s
+#source: a.s
+#ld: -T $srcdir/$subdir/mmohdr1.ld
+#objdump: -sht
+
+.*: file format mmo
+
+Sections:
+Idx Name Size VMA LMA File off Algn
+ 0 \.text 0+8 0+100 0+100 0+ 2\*\*2
+ CONTENTS, ALLOC, LOAD, CODE
+SYMBOL TABLE:
+0+100 g \.text Main
+0+100 g \.text _start
+0+104 g \.text a
+
+
+Contents of section \.text:
+ 0100 e3fd0001 e3fd0004 .*
diff --git a/ld/testsuite/ld-mmix/jumpa-1b.d b/ld/testsuite/ld-mmix/jumpa-1b.d
new file mode 100644
index 0000000..3baff9b
--- /dev/null
+++ b/ld/testsuite/ld-mmix/jumpa-1b.d
@@ -0,0 +1,25 @@
+#source: start.s
+#source: a.s
+#source: jumpa.s
+#as: -x
+#ld: -m elf64mmix
+#objdump: -dr
+
+.*: file format elf64-mmix
+
+Disassembly of section \.text:
+
+0+ <_start>:
+ 0: e3fd0001 setl \$253,0x1
+
+0+4 <a>:
+ 4: e3fd0004 setl \$253,0x4
+
+0+8 <jumpa>:
+ 8: e3fd0002 setl \$253,0x2
+ c: f1fffffe jmp 4 <a>
+ 10: fd000000 swym 0,0,0
+ 14: fd000000 swym 0,0,0
+ 18: fd000000 swym 0,0,0
+ 1c: fd000000 swym 0,0,0
+ 20: e3fd0003 setl \$253,0x3
diff --git a/ld/testsuite/ld-mmix/jumpa-1f.d b/ld/testsuite/ld-mmix/jumpa-1f.d
new file mode 100644
index 0000000..983d294
--- /dev/null
+++ b/ld/testsuite/ld-mmix/jumpa-1f.d
@@ -0,0 +1,25 @@
+#source: start.s
+#source: jumpa.s
+#source: a.s
+#as: -x
+#ld: -m elf64mmix
+#objdump: -dr
+
+.*: file format elf64-mmix
+
+Disassembly of section \.text:
+
+0+ <_start>:
+ 0: e3fd0001 setl \$253,0x1
+
+0+4 <jumpa>:
+ 4: e3fd0002 setl \$253,0x2
+ 8: f0000006 jmp 20 <a>
+ c: fd000000 swym 0,0,0
+ 10: fd000000 swym 0,0,0
+ 14: fd000000 swym 0,0,0
+ 18: fd000000 swym 0,0,0
+ 1c: e3fd0003 setl \$253,0x3
+
+0+20 <a>:
+ 20: e3fd0004 setl \$253,0x4
diff --git a/ld/testsuite/ld-mmix/jumpa-2b.d b/ld/testsuite/ld-mmix/jumpa-2b.d
new file mode 100644
index 0000000..f594055
--- /dev/null
+++ b/ld/testsuite/ld-mmix/jumpa-2b.d
@@ -0,0 +1,21 @@
+#source: start.s
+#source: a.s
+#source: jumpa.s
+#as: -no-expand
+#ld: -m elf64mmix
+#objdump: -dr
+
+.*: file format elf64-mmix
+
+Disassembly of section \.text:
+
+0+ <_start>:
+ 0: e3fd0001 setl \$253,0x1
+
+0+4 <a>:
+ 4: e3fd0004 setl \$253,0x4
+
+0+8 <jumpa>:
+ 8: e3fd0002 setl \$253,0x2
+ c: f1fffffe jmp 4 <a>
+ 10: e3fd0003 setl \$253,0x3
diff --git a/ld/testsuite/ld-mmix/jumpa-2f.d b/ld/testsuite/ld-mmix/jumpa-2f.d
new file mode 100644
index 0000000..a923e21
--- /dev/null
+++ b/ld/testsuite/ld-mmix/jumpa-2f.d
@@ -0,0 +1,21 @@
+#source: start.s
+#source: jumpa.s
+#source: a.s
+#as: -no-expand
+#ld: -m elf64mmix
+#objdump: -dr
+
+.*: file format elf64-mmix
+
+Disassembly of section \.text:
+
+0+ <_start>:
+ 0: e3fd0001 setl \$253,0x1
+
+0+4 <jumpa>:
+ 4: e3fd0002 setl \$253,0x2
+ 8: f0000002 jmp 10 <a>
+ c: e3fd0003 setl \$253,0x3
+
+0+10 <a>:
+ 10: e3fd0004 setl \$253,0x4
diff --git a/ld/testsuite/ld-mmix/jumpa-3b.d b/ld/testsuite/ld-mmix/jumpa-3b.d
new file mode 100644
index 0000000..d2f1b50
--- /dev/null
+++ b/ld/testsuite/ld-mmix/jumpa-3b.d
@@ -0,0 +1,30 @@
+#source: start.s
+#source: a.s
+#source: pad2p26m32.s
+#source: pad16.s
+#source: pad4.s
+#source: pad4.s
+#source: jumpa.s
+#as: -x
+#ld: -m elf64mmix
+#objdump: -dr
+
+.*: file format elf64-mmix
+
+Disassembly of section \.text:
+
+0+ <_start>:
+ 0: e3fd0001 setl \$253,0x1
+
+0+4 <a>:
+ 4: e3fd0004 setl \$253,0x4
+ \.\.\.
+
+0+4000000 <jumpa>:
+ 4000000: e3fd0002 setl \$253,0x2
+ 4000004: f1000000 jmp 4 <a>
+ 4000008: fd000000 swym 0,0,0
+ 400000c: fd000000 swym 0,0,0
+ 4000010: fd000000 swym 0,0,0
+ 4000014: fd000000 swym 0,0,0
+ 4000018: e3fd0003 setl \$253,0x3
diff --git a/ld/testsuite/ld-mmix/jumpa-3f.d b/ld/testsuite/ld-mmix/jumpa-3f.d
new file mode 100644
index 0000000..4a5e10d
--- /dev/null
+++ b/ld/testsuite/ld-mmix/jumpa-3f.d
@@ -0,0 +1,28 @@
+#source: start.s
+#source: jumpa.s
+#source: pad2p26m32.s
+#source: pad4.s
+#source: a.s
+#as: -x
+#ld: -m elf64mmix
+#objdump: -dr
+
+.*: file format elf64-mmix
+
+Disassembly of section \.text:
+
+0+ <_start>:
+ 0: e3fd0001 setl \$253,0x1
+
+0+4 <jumpa>:
+ 4: e3fd0002 setl \$253,0x2
+ 8: f0ffffff jmp 4000004 <a>
+ c: fd000000 swym 0,0,0
+ 10: fd000000 swym 0,0,0
+ 14: fd000000 swym 0,0,0
+ 18: fd000000 swym 0,0,0
+ 1c: e3fd0003 setl \$253,0x3
+ \.\.\.
+
+0+4000004 <a>:
+ 4000004: e3fd0004 setl \$253,0x4
diff --git a/ld/testsuite/ld-mmix/jumpa-4b.d b/ld/testsuite/ld-mmix/jumpa-4b.d
new file mode 100644
index 0000000..9d35932
--- /dev/null
+++ b/ld/testsuite/ld-mmix/jumpa-4b.d
@@ -0,0 +1,26 @@
+#source: start.s
+#source: a.s
+#source: pad2p26m32.s
+#source: pad16.s
+#source: pad4.s
+#source: pad4.s
+#source: jumpa.s
+#as: -no-expand
+#ld: -m elf64mmix
+#objdump: -dr
+
+.*: file format elf64-mmix
+
+Disassembly of section \.text:
+
+0+ <_start>:
+ 0: e3fd0001 setl \$253,0x1
+
+0+4 <a>:
+ 4: e3fd0004 setl \$253,0x4
+ \.\.\.
+
+0+4000000 <jumpa>:
+ 4000000: e3fd0002 setl \$253,0x2
+ 4000004: f1000000 jmp 4 <a>
+ 4000008: e3fd0003 setl \$253,0x3
diff --git a/ld/testsuite/ld-mmix/jumpa-4f.d b/ld/testsuite/ld-mmix/jumpa-4f.d
new file mode 100644
index 0000000..3c0885b
--- /dev/null
+++ b/ld/testsuite/ld-mmix/jumpa-4f.d
@@ -0,0 +1,25 @@
+#source: start.s
+#source: jumpa.s
+#source: pad2p26m32.s
+#source: pad16.s
+#source: pad4.s
+#source: a.s
+#as: -no-expand
+#ld: -m elf64mmix
+#objdump: -dr
+
+.*: file format elf64-mmix
+
+Disassembly of section \.text:
+
+0+ <_start>:
+ 0: e3fd0001 setl \$253,0x1
+
+0+4 <jumpa>:
+ 4: e3fd0002 setl \$253,0x2
+ 8: f0ffffff jmp 4000004 <a>
+ c: e3fd0003 setl \$253,0x3
+ \.\.\.
+
+0+4000004 <a>:
+ 4000004: e3fd0004 setl \$253,0x4
diff --git a/ld/testsuite/ld-mmix/jumpa-5b.d b/ld/testsuite/ld-mmix/jumpa-5b.d
new file mode 100644
index 0000000..b2fcaf4
--- /dev/null
+++ b/ld/testsuite/ld-mmix/jumpa-5b.d
@@ -0,0 +1,31 @@
+#source: start.s
+#source: a.s
+#source: pad2p26m32.s
+#source: pad16.s
+#source: pad4.s
+#source: pad4.s
+#source: pad4.s
+#source: jumpa.s
+#as: -x
+#ld: -m elf64mmix
+#objdump: -dr
+
+.*: file format elf64-mmix
+
+Disassembly of section \.text:
+
+0+ <_start>:
+ 0: e3fd0001 setl \$253,0x1
+
+0+4 <a>:
+ 4: e3fd0004 setl \$253,0x4
+ \.\.\.
+
+0+4000004 <jumpa>:
+ 4000004: e3fd0002 setl \$253,0x2
+ 4000008: e3ff0004 setl \$255,0x4
+ 400000c: e6ff0000 incml \$255,0x0
+ 4000010: e5ff0000 incmh \$255,0x0
+ 4000014: e4ff0000 inch \$255,0x0
+ 4000018: 9fffff00 go \$255,\$255,0
+ 400001c: e3fd0003 setl \$253,0x3
diff --git a/ld/testsuite/ld-mmix/jumpa-5f.d b/ld/testsuite/ld-mmix/jumpa-5f.d
new file mode 100644
index 0000000..bb91e70
--- /dev/null
+++ b/ld/testsuite/ld-mmix/jumpa-5f.d
@@ -0,0 +1,29 @@
+#source: start.s
+#source: jumpa.s
+#source: pad2p26m32.s
+#source: pad4.s
+#source: pad4.s
+#source: a.s
+#as: -x
+#ld: -m elf64mmix
+#objdump: -dr
+
+.*: file format elf64-mmix
+
+Disassembly of section \.text:
+
+0+ <_start>:
+ 0: e3fd0001 setl \$253,0x1
+
+0+4 <jumpa>:
+ 4: e3fd0002 setl \$253,0x2
+ 8: e3ff0008 setl \$255,0x8
+ c: e6ff0400 incml \$255,0x400
+ 10: e5ff0000 incmh \$255,0x0
+ 14: e4ff0000 inch \$255,0x0
+ 18: 9fffff00 go \$255,\$255,0
+ 1c: e3fd0003 setl \$253,0x3
+ \.\.\.
+
+0+4000008 <a>:
+ 4000008: e3fd0004 setl \$253,0x4
diff --git a/ld/testsuite/ld-mmix/jumpa-6b.d b/ld/testsuite/ld-mmix/jumpa-6b.d
new file mode 100644
index 0000000..e6e6401
--- /dev/null
+++ b/ld/testsuite/ld-mmix/jumpa-6b.d
@@ -0,0 +1,11 @@
+#source: start.s
+#source: a.s
+#source: pad2p26m32.s
+#source: pad16.s
+#source: pad4.s
+#source: pad4.s
+#source: pad4.s
+#source: jumpa.s
+#as: -no-expand
+#ld: -m elf64mmix
+#error: relocation truncated to fit: R_MMIX_ADDR27 a$
diff --git a/ld/testsuite/ld-mmix/jumpa-6f.d b/ld/testsuite/ld-mmix/jumpa-6f.d
new file mode 100644
index 0000000..926efbe
--- /dev/null
+++ b/ld/testsuite/ld-mmix/jumpa-6f.d
@@ -0,0 +1,10 @@
+#source: start.s
+#source: jumpa.s
+#source: pad2p26m32.s
+#source: pad16.s
+#source: pad4.s
+#source: pad4.s
+#source: a.s
+#as: -no-expand
+#ld: -m elf64mmix
+#error: relocation truncated to fit: R_MMIX_ADDR27 a$
diff --git a/ld/testsuite/ld-mmix/jumpa-7b.d b/ld/testsuite/ld-mmix/jumpa-7b.d
new file mode 100644
index 0000000..202d006
--- /dev/null
+++ b/ld/testsuite/ld-mmix/jumpa-7b.d
@@ -0,0 +1,25 @@
+#source: start.s
+#source: a.s
+#source: jumpa.s
+#as: -x
+#ld: -m mmo
+#objdump: -dr
+
+.*: file format mmo
+
+Disassembly of section \.text:
+
+0+ <(Main|_start)>:
+ 0: e3fd0001 setl \$253,0x1
+
+0+4 <a>:
+ 4: e3fd0004 setl \$253,0x4
+
+0+8 <jumpa>:
+ 8: e3fd0002 setl \$253,0x2
+ c: f1fffffe jmp 4 <a>
+ 10: fd000000 swym 0,0,0
+ 14: fd000000 swym 0,0,0
+ 18: fd000000 swym 0,0,0
+ 1c: fd000000 swym 0,0,0
+ 20: e3fd0003 setl \$253,0x3
diff --git a/ld/testsuite/ld-mmix/jumpa-7f.d b/ld/testsuite/ld-mmix/jumpa-7f.d
new file mode 100644
index 0000000..b8345e1
--- /dev/null
+++ b/ld/testsuite/ld-mmix/jumpa-7f.d
@@ -0,0 +1,25 @@
+#source: start.s
+#source: jumpa.s
+#source: a.s
+#as: -x
+#ld: -m mmo
+#objdump: -dr
+
+.*: file format mmo
+
+Disassembly of section \.text:
+
+0+ <(Main|_start)>:
+ 0: e3fd0001 setl \$253,0x1
+
+0+4 <jumpa>:
+ 4: e3fd0002 setl \$253,0x2
+ 8: f0000006 jmp 20 <a>
+ c: fd000000 swym 0,0,0
+ 10: fd000000 swym 0,0,0
+ 14: fd000000 swym 0,0,0
+ 18: fd000000 swym 0,0,0
+ 1c: e3fd0003 setl \$253,0x3
+
+0+20 <a>:
+ 20: e3fd0004 setl \$253,0x4
diff --git a/ld/testsuite/ld-mmix/jumpa-8b.d b/ld/testsuite/ld-mmix/jumpa-8b.d
new file mode 100644
index 0000000..456c949
--- /dev/null
+++ b/ld/testsuite/ld-mmix/jumpa-8b.d
@@ -0,0 +1,21 @@
+#source: start.s
+#source: a.s
+#source: jumpa.s
+#as: -no-expand
+#ld: -m mmo
+#objdump: -dr
+
+.*: file format mmo
+
+Disassembly of section \.text:
+
+0+ <(Main|_start)>:
+ 0: e3fd0001 setl \$253,0x1
+
+0+4 <a>:
+ 4: e3fd0004 setl \$253,0x4
+
+0+8 <jumpa>:
+ 8: e3fd0002 setl \$253,0x2
+ c: f1fffffe jmp 4 <a>
+ 10: e3fd0003 setl \$253,0x3
diff --git a/ld/testsuite/ld-mmix/jumpa-8f.d b/ld/testsuite/ld-mmix/jumpa-8f.d
new file mode 100644
index 0000000..05777ce
--- /dev/null
+++ b/ld/testsuite/ld-mmix/jumpa-8f.d
@@ -0,0 +1,21 @@
+#source: start.s
+#source: jumpa.s
+#source: a.s
+#as: -no-expand
+#ld: -m mmo
+#objdump: -dr
+
+.*: file format mmo
+
+Disassembly of section \.text:
+
+0+ <(Main|_start)>:
+ 0: e3fd0001 setl \$253,0x1
+
+0+4 <jumpa>:
+ 4: e3fd0002 setl \$253,0x2
+ 8: f0000002 jmp 10 <a>
+ c: e3fd0003 setl \$253,0x3
+
+0+10 <a>:
+ 10: e3fd0004 setl \$253,0x4
diff --git a/ld/testsuite/ld-mmix/jumpa-9b.d b/ld/testsuite/ld-mmix/jumpa-9b.d
new file mode 100644
index 0000000..2a639d3
--- /dev/null
+++ b/ld/testsuite/ld-mmix/jumpa-9b.d
@@ -0,0 +1,30 @@
+#source: start.s
+#source: a.s
+#source: pad2p26m32.s
+#source: pad16.s
+#source: pad4.s
+#source: pad4.s
+#source: jumpa.s
+#as: -x
+#ld: -m mmo
+#objdump: -dr
+
+.*: file format mmo
+
+Disassembly of section \.text:
+
+0+ <(Main|_start)>:
+ 0: e3fd0001 setl \$253,0x1
+
+0+4 <a>:
+ 4: e3fd0004 setl \$253,0x4
+ \.\.\.
+
+0+4000000 <jumpa>:
+ 4000000: e3fd0002 setl \$253,0x2
+ 4000004: f1000000 jmp 4 <a>
+ 4000008: fd000000 swym 0,0,0
+ 400000c: fd000000 swym 0,0,0
+ 4000010: fd000000 swym 0,0,0
+ 4000014: fd000000 swym 0,0,0
+ 4000018: e3fd0003 setl \$253,0x3
diff --git a/ld/testsuite/ld-mmix/jumpa-9f.d b/ld/testsuite/ld-mmix/jumpa-9f.d
new file mode 100644
index 0000000..a4a2932
--- /dev/null
+++ b/ld/testsuite/ld-mmix/jumpa-9f.d
@@ -0,0 +1,28 @@
+#source: start.s
+#source: jumpa.s
+#source: pad2p26m32.s
+#source: pad4.s
+#source: a.s
+#as: -x
+#ld: -m mmo
+#objdump: -dr
+
+.*: file format mmo
+
+Disassembly of section \.text:
+
+0+ <(Main|_start)>:
+ 0: e3fd0001 setl \$253,0x1
+
+0+4 <jumpa>:
+ 4: e3fd0002 setl \$253,0x2
+ 8: f0ffffff jmp 4000004 <a>
+ c: fd000000 swym 0,0,0
+ 10: fd000000 swym 0,0,0
+ 14: fd000000 swym 0,0,0
+ 18: fd000000 swym 0,0,0
+ 1c: e3fd0003 setl \$253,0x3
+ \.\.\.
+
+0+4000004 <a>:
+ 4000004: e3fd0004 setl \$253,0x4
diff --git a/ld/testsuite/ld-mmix/jumpa.s b/ld/testsuite/ld-mmix/jumpa.s
new file mode 100644
index 0000000..16ba54b
--- /dev/null
+++ b/ld/testsuite/ld-mmix/jumpa.s
@@ -0,0 +1,7 @@
+* Just jump to an external symbol, with some padding.
+ .text
+ .global jumpa
+jumpa:
+ SET $253,2
+ JMP a
+ SET $253,3
diff --git a/ld/testsuite/ld-mmix/jumpa12b.d b/ld/testsuite/ld-mmix/jumpa12b.d
new file mode 100644
index 0000000..8efe690
--- /dev/null
+++ b/ld/testsuite/ld-mmix/jumpa12b.d
@@ -0,0 +1,26 @@
+#source: start.s
+#source: a.s
+#source: pad2p26m32.s
+#source: pad16.s
+#source: pad4.s
+#source: pad4.s
+#source: jumpa.s
+#as: -no-expand
+#ld: -m mmo
+#objdump: -dr
+
+.*: file format mmo
+
+Disassembly of section \.text:
+
+0+ <(Main|_start)>:
+ 0: e3fd0001 setl \$253,0x1
+
+0+4 <a>:
+ 4: e3fd0004 setl \$253,0x4
+ \.\.\.
+
+0+4000000 <jumpa>:
+ 4000000: e3fd0002 setl \$253,0x2
+ 4000004: f1000000 jmp 4 <a>
+ 4000008: e3fd0003 setl \$253,0x3
diff --git a/ld/testsuite/ld-mmix/jumpa12f.d b/ld/testsuite/ld-mmix/jumpa12f.d
new file mode 100644
index 0000000..6e2968f
--- /dev/null
+++ b/ld/testsuite/ld-mmix/jumpa12f.d
@@ -0,0 +1,25 @@
+#source: start.s
+#source: jumpa.s
+#source: pad2p26m32.s
+#source: pad16.s
+#source: pad4.s
+#source: a.s
+#as: -no-expand
+#ld: -m mmo
+#objdump: -dr
+
+.*: file format mmo
+
+Disassembly of section \.text:
+
+0+ <(Main|_start)>:
+ 0: e3fd0001 setl \$253,0x1
+
+0+4 <jumpa>:
+ 4: e3fd0002 setl \$253,0x2
+ 8: f0ffffff jmp 4000004 <a>
+ c: e3fd0003 setl \$253,0x3
+ \.\.\.
+
+0+4000004 <a>:
+ 4000004: e3fd0004 setl \$253,0x4
diff --git a/ld/testsuite/ld-mmix/jumpa13b.d b/ld/testsuite/ld-mmix/jumpa13b.d
new file mode 100644
index 0000000..bda81e3
--- /dev/null
+++ b/ld/testsuite/ld-mmix/jumpa13b.d
@@ -0,0 +1,31 @@
+#source: start.s
+#source: a.s
+#source: pad2p26m32.s
+#source: pad16.s
+#source: pad4.s
+#source: pad4.s
+#source: pad4.s
+#source: jumpa.s
+#as: -x
+#ld: -m mmo
+#objdump: -dr
+
+.*: file format mmo
+
+Disassembly of section \.text:
+
+0+ <(Main|_start)>:
+ 0: e3fd0001 setl \$253,0x1
+
+0+4 <a>:
+ 4: e3fd0004 setl \$253,0x4
+ \.\.\.
+
+0+4000004 <jumpa>:
+ 4000004: e3fd0002 setl \$253,0x2
+ 4000008: e3ff0004 setl \$255,0x4
+ 400000c: e6ff0000 incml \$255,0x0
+ 4000010: e5ff0000 incmh \$255,0x0
+ 4000014: e4ff0000 inch \$255,0x0
+ 4000018: 9fffff00 go \$255,\$255,0
+ 400001c: e3fd0003 setl \$253,0x3
diff --git a/ld/testsuite/ld-mmix/jumpa13f.d b/ld/testsuite/ld-mmix/jumpa13f.d
new file mode 100644
index 0000000..335d7ab
--- /dev/null
+++ b/ld/testsuite/ld-mmix/jumpa13f.d
@@ -0,0 +1,29 @@
+#source: start.s
+#source: jumpa.s
+#source: pad2p26m32.s
+#source: pad4.s
+#source: pad4.s
+#source: a.s
+#as: -x
+#ld: -m mmo
+#objdump: -dr
+
+.*: file format mmo
+
+Disassembly of section \.text:
+
+0+ <(Main|_start)>:
+ 0: e3fd0001 setl \$253,0x1
+
+0+4 <jumpa>:
+ 4: e3fd0002 setl \$253,0x2
+ 8: e3ff0008 setl \$255,0x8
+ c: e6ff0400 incml \$255,0x400
+ 10: e5ff0000 incmh \$255,0x0
+ 14: e4ff0000 inch \$255,0x0
+ 18: 9fffff00 go \$255,\$255,0
+ 1c: e3fd0003 setl \$253,0x3
+ \.\.\.
+
+0+4000008 <a>:
+ 4000008: e3fd0004 setl \$253,0x4
diff --git a/ld/testsuite/ld-mmix/jumpa14b.d b/ld/testsuite/ld-mmix/jumpa14b.d
new file mode 100644
index 0000000..9cadb11
--- /dev/null
+++ b/ld/testsuite/ld-mmix/jumpa14b.d
@@ -0,0 +1,11 @@
+#source: start.s
+#source: a.s
+#source: pad2p26m32.s
+#source: pad16.s
+#source: pad4.s
+#source: pad4.s
+#source: pad4.s
+#source: jumpa.s
+#as: -no-expand
+#ld: -m mmo
+#error: relocation truncated to fit: R_MMIX_ADDR27 a$
diff --git a/ld/testsuite/ld-mmix/jumpa14f.d b/ld/testsuite/ld-mmix/jumpa14f.d
new file mode 100644
index 0000000..b51b552
--- /dev/null
+++ b/ld/testsuite/ld-mmix/jumpa14f.d
@@ -0,0 +1,10 @@
+#source: start.s
+#source: jumpa.s
+#source: pad2p26m32.s
+#source: pad16.s
+#source: pad4.s
+#source: pad4.s
+#source: a.s
+#as: -no-expand
+#ld: -m mmo
+#error: relocation truncated to fit: R_MMIX_ADDR27 a$
diff --git a/ld/testsuite/ld-mmix/loc1.d b/ld/testsuite/ld-mmix/loc1.d
new file mode 100644
index 0000000..5168512
--- /dev/null
+++ b/ld/testsuite/ld-mmix/loc1.d
@@ -0,0 +1,28 @@
+#source: loc1.s
+#ld: -e loc1 -m elf64mmix
+#objdump: -str
+
+# Single text file.
+
+.*: file format elf64-mmix
+
+SYMBOL TABLE:
+0+1000 l d \.text 0+
+2000000000000000 l d \.data 0+
+2000000000000000 l d \.sbss 0+
+2000000000000000 l d \.bss 0+
+0+ l d \*ABS\* 0+
+0+ l d \*ABS\* 0+
+0+ l d \*ABS\* 0+
+0+1000 g \.text 0+ loc1
+0+1000 g \*ABS\* 0+ __\.MMIX\.start\.\.text
+2000000000000000 g O \*ABS\* 0+ __bss_start
+2000000000000000 g O \*ABS\* 0+ _edata
+2000000000000000 g O \*ABS\* 0+ _end
+0+1000 g O \.text 0+ _start\.
+
+
+Contents of section \.text:
+ 1000 fd030303 .*
+Contents of section \.data:
+Contents of section \.sbss:
diff --git a/ld/testsuite/ld-mmix/loc1.s b/ld/testsuite/ld-mmix/loc1.s
new file mode 100644
index 0000000..1898ae3
--- /dev/null
+++ b/ld/testsuite/ld-mmix/loc1.s
@@ -0,0 +1,4 @@
+ LOC #1000
+loc1 SWYM 3,3,3
+ .global loc1
+
diff --git a/ld/testsuite/ld-mmix/loc1m.d b/ld/testsuite/ld-mmix/loc1m.d
new file mode 100644
index 0000000..9721bcb
--- /dev/null
+++ b/ld/testsuite/ld-mmix/loc1m.d
@@ -0,0 +1,14 @@
+#source: loc1.s
+#ld: -m mmo -e loc1
+#objdump: -str
+
+# err: two locs.
+
+.*: file format mmo
+
+SYMBOL TABLE:
+0+1000 g \.text Main
+0+1000 g \.text loc1
+
+Contents of section \.text:
+ 1000 fd030303 .*
diff --git a/ld/testsuite/ld-mmix/loc2.d b/ld/testsuite/ld-mmix/loc2.d
new file mode 100644
index 0000000..682fa28
--- /dev/null
+++ b/ld/testsuite/ld-mmix/loc2.d
@@ -0,0 +1,29 @@
+#source: loc1.s
+#source: start.s
+#ld: -m elf64mmix
+#objdump: -str
+
+# Two text files.
+
+.*: file format elf64-mmix
+
+SYMBOL TABLE:
+0+1000 l d \.text 0+
+2000000000000000 l d \.data 0+
+2000000000000000 l d \.sbss 0+
+2000000000000000 l d \.bss 0+
+0+ l d \*ABS\* 0+
+0+ l d \*ABS\* 0+
+0+ l d \*ABS\* 0+
+0+1004 g \.text 0+ _start
+0+1000 g \.text 0+ loc1
+0+1000 g \*ABS\* 0+ __\.MMIX\.start\.\.text
+2000000000000000 g O \*ABS\* 0+ __bss_start
+2000000000000000 g O \*ABS\* 0+ _edata
+2000000000000000 g O \*ABS\* 0+ _end
+0+1004 g O \.text 0+ _start\.
+
+Contents of section \.text:
+ 1000 fd030303 e3fd0001 .*
+Contents of section \.data:
+Contents of section .sbss:
diff --git a/ld/testsuite/ld-mmix/loc2.s b/ld/testsuite/ld-mmix/loc2.s
new file mode 100644
index 0000000..fc3988e
--- /dev/null
+++ b/ld/testsuite/ld-mmix/loc2.s
@@ -0,0 +1,4 @@
+ LOC #2000
+loc2 SWYM 3,2,3
+ .global loc2
+
diff --git a/ld/testsuite/ld-mmix/loc2m.d b/ld/testsuite/ld-mmix/loc2m.d
new file mode 100644
index 0000000..4d62b24
--- /dev/null
+++ b/ld/testsuite/ld-mmix/loc2m.d
@@ -0,0 +1,14 @@
+#source: loc1.s
+#source: start.s
+#ld: -m mmo
+#objdump: -str
+
+.*: file format mmo
+
+SYMBOL TABLE:
+0+1004 g \.text Main
+0+1004 g \.text _start
+0+1000 g \.text loc1
+
+Contents of section \.text:
+ 1000 fd030303 e3fd0001 .*
diff --git a/ld/testsuite/ld-mmix/loc3.d b/ld/testsuite/ld-mmix/loc3.d
new file mode 100644
index 0000000..78baf33
--- /dev/null
+++ b/ld/testsuite/ld-mmix/loc3.d
@@ -0,0 +1,29 @@
+#source: start.s
+#source: loc1.s
+#ld: -m elf64mmix
+#objdump: -str
+
+# Two text files in opposite order.
+
+.*: file format elf64-mmix
+
+SYMBOL TABLE:
+0+1000 l d \.text 0+
+2000000000000000 l d \.data 0+
+2000000000000000 l d \.sbss 0+
+2000000000000000 l d \.bss 0+
+0+ l d \*ABS\* 0+
+0+ l d \*ABS\* 0+
+0+ l d \*ABS\* 0+
+0+1000 g \.text 0+ _start
+0+1004 g \.text 0+ loc1
+0+1000 g \*ABS\* 0+ __\.MMIX\.start\.\.text
+2000000000000000 g O \*ABS\* 0+ __bss_start
+2000000000000000 g O \*ABS\* 0+ _edata
+2000000000000000 g O \*ABS\* 0+ _end
+0+1000 g O \.text 0+ _start\.
+
+Contents of section \.text:
+ 1000 e3fd0001 fd030303 .*
+Contents of section \.data:
+Contents of section \.sbss:
diff --git a/ld/testsuite/ld-mmix/loc3m.d b/ld/testsuite/ld-mmix/loc3m.d
new file mode 100644
index 0000000..928ac9e
--- /dev/null
+++ b/ld/testsuite/ld-mmix/loc3m.d
@@ -0,0 +1,14 @@
+#source: start.s
+#source: loc1.s
+#ld: -m mmo
+#objdump: -str
+
+.*: file format mmo
+
+SYMBOL TABLE:
+0+1000 g \.text Main
+0+1000 g \.text _start
+0+1004 g \.text loc1
+
+Contents of section \.text:
+ 1000 e3fd0001 fd030303 .*
diff --git a/ld/testsuite/ld-mmix/loc4.d b/ld/testsuite/ld-mmix/loc4.d
new file mode 100644
index 0000000..3a8fa25
--- /dev/null
+++ b/ld/testsuite/ld-mmix/loc4.d
@@ -0,0 +1,35 @@
+#source: loc1.s
+#source: data1.s
+#source: start.s
+#ld: -m elf64mmix
+#objdump: -str
+
+# Two text files and one data.
+
+.*: file format elf64-mmix
+
+SYMBOL TABLE:
+0+1000 l d \.text 0+
+2000000000000000 l d \.data 0+
+2000000000000008 l d \.sbss 0+
+2000000000000008 l d \.bss 0+
+0+ l d \*ABS\* 0+
+0+ l d \*ABS\* 0+
+0+ l d \*ABS\* 0+
+2000000000000000 l \.data 0+ xx
+0+1004 g F \.text 0+ Main
+2000000000000000 g \*ABS\* 0+ __\.MMIX\.start\.\.data
+0+1004 g \.text 0+ _start
+0+1000 g \.text 0+ loc1
+0+1000 g \*ABS\* 0+ __\.MMIX\.start\.\.text
+2000000000000008 g O \*ABS\* 0+ __bss_start
+2000000000000008 g O \*ABS\* 0+ _edata
+2000000000000008 g O \*ABS\* 0+ _end
+0+1004 g O \.text 0+ _start\.
+
+
+Contents of section \.text:
+ 1000 fd030303 e3fd0001 .*
+Contents of section \.data:
+ 0000 00000000 00001030 .*
+Contents of section \.sbss:
diff --git a/ld/testsuite/ld-mmix/loc4m.d b/ld/testsuite/ld-mmix/loc4m.d
new file mode 100644
index 0000000..0bbd9c0
--- /dev/null
+++ b/ld/testsuite/ld-mmix/loc4m.d
@@ -0,0 +1,18 @@
+#source: loc1.s
+#source: data1.s
+#source: start.s
+#ld: -m mmo
+#objdump: -str
+
+.*: file format mmo
+
+SYMBOL TABLE:
+0+1004 g \.text Main
+0+1004 g \.text _start
+0+1000 g \.text loc1
+
+Contents of section \.text:
+ 1000 fd030303 e3fd0001 .*
+Contents of section \.data:
+ 0004 00001030 .*
+
diff --git a/ld/testsuite/ld-mmix/loc5.d b/ld/testsuite/ld-mmix/loc5.d
new file mode 100644
index 0000000..089c155
--- /dev/null
+++ b/ld/testsuite/ld-mmix/loc5.d
@@ -0,0 +1,6 @@
+#source: loc1.s
+#source: start.s
+#source: loc2.s
+#ld: -m elf64mmix
+#objdump: -str
+#error: multiple definition of `__\.MMIX\.start\.\.text'
diff --git a/ld/testsuite/ld-mmix/loc5m.d b/ld/testsuite/ld-mmix/loc5m.d
new file mode 100644
index 0000000..8fedb1c
--- /dev/null
+++ b/ld/testsuite/ld-mmix/loc5m.d
@@ -0,0 +1,6 @@
+#source: loc1.s
+#source: start.s
+#source: loc2.s
+#ld: -m mmo
+#objdump: -str
+#error: multiple definition of `__\.MMIX\.start\.\.text'
diff --git a/ld/testsuite/ld-mmix/loc6.d b/ld/testsuite/ld-mmix/loc6.d
new file mode 100644
index 0000000..30fb75d
--- /dev/null
+++ b/ld/testsuite/ld-mmix/loc6.d
@@ -0,0 +1,30 @@
+#source: dloc1.s
+#source: start.s
+#ld: -m elf64mmix
+#objdump: -str
+
+# Text files and one loc:ed data at offset.
+
+.*: file format elf64-mmix
+
+SYMBOL TABLE:
+0+ l d \.text 0+
+2000000000000200 l d \.data 0+
+200000000000020c l d \.sbss 0+
+200000000000020c l d \.bss 0+
+0+ l d \*ABS\* 0+
+0+ l d \*ABS\* 0+
+0+ l d \*ABS\* 0+
+2000000000000200 g \.data 0+ dloc1
+2000000000000200 g \*ABS\* 0+ __\.MMIX\.start\.\.data
+0+ g \.text 0+ _start
+200000000000020c g O \*ABS\* 0+ __bss_start
+200000000000020c g O \*ABS\* 0+ _edata
+2000000000000210 g O \*ABS\* 0+ _end
+0+ g O \.text 0+ _start\.
+
+Contents of section \.text:
+ 0000 e3fd0001 .*
+Contents of section \.data:
+ 0200 00000004 00000005 00000006 .*
+Contents of section \.sbss:
diff --git a/ld/testsuite/ld-mmix/loc6m.d b/ld/testsuite/ld-mmix/loc6m.d
new file mode 100644
index 0000000..056e439
--- /dev/null
+++ b/ld/testsuite/ld-mmix/loc6m.d
@@ -0,0 +1,19 @@
+#source: dloc1.s
+#source: start.s
+#ld: -m mmo
+#objdump: -str
+
+# Text files and one loc:ed data at offset.
+
+.*: file format mmo
+
+SYMBOL TABLE:
+0+ g \.text Main
+2000000000000200 g \.data dloc1
+0+ g \.text _start
+
+Contents of section \.text:
+ 0000 e3fd0001 .*
+Contents of section \.data:
+ 0200 00000004 00000005 00000006 .*
+
diff --git a/ld/testsuite/ld-mmix/loc7.d b/ld/testsuite/ld-mmix/loc7.d
new file mode 100644
index 0000000..b980f61
--- /dev/null
+++ b/ld/testsuite/ld-mmix/loc7.d
@@ -0,0 +1,6 @@
+#source: dloc1.s
+#source: start.s
+#source: dloc2.s
+#ld: -m elf64mmix
+#objdump: -str
+#error: multiple definition of `__\.MMIX\.start\.\.data'
diff --git a/ld/testsuite/ld-mmix/loc7m.d b/ld/testsuite/ld-mmix/loc7m.d
new file mode 100644
index 0000000..be8115f
--- /dev/null
+++ b/ld/testsuite/ld-mmix/loc7m.d
@@ -0,0 +1,6 @@
+#source: dloc1.s
+#source: start.s
+#source: dloc2.s
+#ld: -m mmo
+#objdump: -str
+#error: multiple definition of `__\.MMIX\.start\.\.data'
diff --git a/ld/testsuite/ld-mmix/local1.d b/ld/testsuite/ld-mmix/local1.d
new file mode 100644
index 0000000..9954c73
--- /dev/null
+++ b/ld/testsuite/ld-mmix/local1.d
@@ -0,0 +1,65 @@
+#source: greg-4.s
+#source: greg-4.s
+#source: local1.s
+#source: regext1.s
+#source: start.s
+#ld: -m elf64mmix
+#readelf: -Ssx1 -x5
+
+# We check that the externally visible symbol ext1 is a local register
+# (different meaning of "local" than for symbol), which can be seen as
+# somewhat twisted.
+
+There are 9 section headers, starting at offset 0x110:
+
+Section Headers:
+ \[Nr\] Name Type Address Offset
+ Size EntSize Flags Link Info Align
+ \[ 0\] NULL 0+ 0+
+ 0+ 0+ 0 0 0
+ \[ 1\] \.text PROGBITS 0+ 0+b0
+ 0+8 0+ AX 0 0 4
+ \[ 2\] \.data PROGBITS 2000000000000000 0+b8
+ 0+ 0+ WA 0 0 1
+ \[ 3\] \.sbss PROGBITS 2000000000000000 0+b8
+ 0+ 0+ W 0 0 1
+ \[ 4\] \.bss NOBITS 2000000000000000 0+b8
+ 0+ 0+ WA 0 0 1
+ \[ 5\] \.MMIX\.reg_content PROGBITS 0+7e8 0+b8
+ 0+10 0+ W 0 0 1
+ \[ 6\] \.shstrtab STRTAB 0+ 0+c8
+ 0+45 0+ 0 0 1
+ \[ 7\] \.symtab SYMTAB 0+ 0+350
+ 0+198 0+18 8 b 8
+ \[ 8\] \.strtab STRTAB 0+ 0+4e8
+ 0+32 0+ 0 0 1
+Key to Flags:
+ W \(write\), A \(alloc\), X \(execute\), M \(merge\), S \(strings\)
+ I \(info\), L \(link order\), G \(group\), x \(unknown\)
+ O \(extra OS processing required\) o \(OS specific\), p \(processor specific\)
+
+Symbol table '\.symtab' contains 17 entries:
+ Num: Value Size Type Bind Vis Ndx Name
+ 0: 0+ 0 NOTYPE LOCAL DEFAULT UND
+ 1: 0+ 0 SECTION LOCAL DEFAULT 1
+ 2: 20+ 0 SECTION LOCAL DEFAULT 2
+ 3: 2000000000000000 0 SECTION LOCAL DEFAULT 3
+ 4: 2000000000000000 0 SECTION LOCAL DEFAULT 4
+ 5: 0+7e8 0 SECTION LOCAL DEFAULT 5
+ 6: 0+ 0 SECTION LOCAL DEFAULT 6
+ 7: 0+ 0 SECTION LOCAL DEFAULT 7
+ 8: 0+ 0 SECTION LOCAL DEFAULT 8
+ 9: 0+fd 0 NOTYPE LOCAL DEFAULT PRC lsym
+ 10: 0+fe 0 NOTYPE LOCAL DEFAULT PRC lsym
+ 11: 0+fc 0 NOTYPE GLOBAL DEFAULT PRC ext1
+ 12: 0+4 0 NOTYPE GLOBAL DEFAULT 1 _start
+ 13: 2000000000000000 0 OBJECT GLOBAL DEFAULT ABS __bss_start
+ 14: 2000000000000000 0 OBJECT GLOBAL DEFAULT ABS _edata
+ 15: 2000000000000000 0 OBJECT GLOBAL DEFAULT ABS _end
+ 16: 0+4 0 OBJECT GLOBAL DEFAULT 1 _start\.
+
+Hex dump of section '\.text':
+ 0x0+ fd030201 e3fd0001 .*
+
+Hex dump of section '\.MMIX\.reg_contents':
+ 0x0+7e8 00000000 0000004e 00000000 0000004e .*
diff --git a/ld/testsuite/ld-mmix/local1.s b/ld/testsuite/ld-mmix/local1.s
new file mode 100644
index 0000000..47bf390
--- /dev/null
+++ b/ld/testsuite/ld-mmix/local1.s
@@ -0,0 +1,2 @@
+ LOCAL ext1
+ SWYM 3,2,1
diff --git a/ld/testsuite/ld-mmix/local10.d b/ld/testsuite/ld-mmix/local10.d
new file mode 100644
index 0000000..f276405
--- /dev/null
+++ b/ld/testsuite/ld-mmix/local10.d
@@ -0,0 +1,5 @@
+#source: local1.s
+#source: ext1g.s
+#source: start.s
+#ld: -m elf64mmix
+#error: 254 is not a local register
diff --git a/ld/testsuite/ld-mmix/local10m.d b/ld/testsuite/ld-mmix/local10m.d
new file mode 100644
index 0000000..9095d74
--- /dev/null
+++ b/ld/testsuite/ld-mmix/local10m.d
@@ -0,0 +1,5 @@
+#source: local1.s
+#source: ext1g.s
+#source: start.s
+#ld: -m mmo
+#error: 254 is not a local register
diff --git a/ld/testsuite/ld-mmix/local11.d b/ld/testsuite/ld-mmix/local11.d
new file mode 100644
index 0000000..761cea0
--- /dev/null
+++ b/ld/testsuite/ld-mmix/local11.d
@@ -0,0 +1,6 @@
+#source: local1.s
+#source: greg-1.s
+#source: ext1l.s
+#source: start.s
+#ld: -m elf64mmix
+#error: valid only with a register or absolute value
diff --git a/ld/testsuite/ld-mmix/local11m.d b/ld/testsuite/ld-mmix/local11m.d
new file mode 100644
index 0000000..b6952a7
--- /dev/null
+++ b/ld/testsuite/ld-mmix/local11m.d
@@ -0,0 +1,6 @@
+#source: local1.s
+#source: greg-1.s
+#source: ext1l.s
+#source: start.s
+#ld: -m mmo
+#error: valid only with a register or absolute value
diff --git a/ld/testsuite/ld-mmix/local12.d b/ld/testsuite/ld-mmix/local12.d
new file mode 100644
index 0000000..102f448
--- /dev/null
+++ b/ld/testsuite/ld-mmix/local12.d
@@ -0,0 +1,24 @@
+#source: local1.s
+#source: ext1-254.s
+#source: start.s
+#ld: -m elf64mmix
+#objdump: -shr
+
+# Check that 254 is local when we don't have any registers.
+
+.*: file format elf64-mmix
+
+Sections:
+Idx Name Size VMA LMA File off Algn
+ 0 \.text 0+8 0+ 0+ 0+b0 2\*\*2
+ CONTENTS, ALLOC, LOAD, READONLY, CODE
+ 1 \.data 0+ 2000000000000000 2000000000000000 0+b8 2\*\*0
+ CONTENTS, ALLOC, LOAD, DATA
+ 2 \.sbss 0+ 2000000000000000 2000000000000000 0+b8 2\*\*0
+ CONTENTS
+ 3 \.bss 0+ 2000000000000000 2000000000000000 0+b8 2\*\*0
+ ALLOC
+Contents of section \.text:
+ 0000 fd030201 e3fd0001 .*
+Contents of section \.data:
+Contents of section \.sbss:
diff --git a/ld/testsuite/ld-mmix/local12m.d b/ld/testsuite/ld-mmix/local12m.d
new file mode 100644
index 0000000..2cfb701
--- /dev/null
+++ b/ld/testsuite/ld-mmix/local12m.d
@@ -0,0 +1,16 @@
+#source: local1.s
+#source: ext1-254.s
+#source: start.s
+#ld: -m mmo
+#objdump: -shr
+
+# Check that 254 is local when we don't have any registers.
+
+.*: file format mmo
+
+Sections:
+Idx Name Size VMA LMA File off Algn
+ 0 \.text 0+8 0+ 0+ 0+ 2\*\*2
+ CONTENTS, ALLOC, LOAD, CODE
+Contents of section \.text:
+ 0000 fd030201 e3fd0001 .*
diff --git a/ld/testsuite/ld-mmix/local1m.d b/ld/testsuite/ld-mmix/local1m.d
new file mode 100644
index 0000000..db36ac5
--- /dev/null
+++ b/ld/testsuite/ld-mmix/local1m.d
@@ -0,0 +1,21 @@
+#source: greg-4.s
+#source: greg-4.s
+#source: local1.s
+#source: regext1.s
+#source: start.s
+#ld: -m mmo
+#objdump: -str
+
+.*: file format mmo
+
+SYMBOL TABLE:
+0+4 g \.text Main
+0+fc g \*REG\* ext1
+0+4 g \.text _start
+
+
+Contents of section \.text:
+ 0000 fd030201 e3fd0001 .*
+Contents of section \.MMIX\.reg_contents:
+ 07e8 00000000 0000004e 00000000 0000004e .*
+
diff --git a/ld/testsuite/ld-mmix/local2.d b/ld/testsuite/ld-mmix/local2.d
new file mode 100644
index 0000000..e5ad203
--- /dev/null
+++ b/ld/testsuite/ld-mmix/local2.d
@@ -0,0 +1,8 @@
+#source: greg-4.s
+#source: greg-4.s
+#source: greg-4.s
+#source: local1.s
+#source: regext1.s
+#source: start.s
+#ld: -m elf64mmix
+#error: not a local register
diff --git a/ld/testsuite/ld-mmix/local2.s b/ld/testsuite/ld-mmix/local2.s
new file mode 100644
index 0000000..9d2c329
--- /dev/null
+++ b/ld/testsuite/ld-mmix/local2.s
@@ -0,0 +1,2 @@
+ LOCAL 128
+ SWYM 2,2,2
diff --git a/ld/testsuite/ld-mmix/local2m.d b/ld/testsuite/ld-mmix/local2m.d
new file mode 100644
index 0000000..6e88936
--- /dev/null
+++ b/ld/testsuite/ld-mmix/local2m.d
@@ -0,0 +1,8 @@
+#source: greg-4.s
+#source: greg-4.s
+#source: greg-4.s
+#source: local1.s
+#source: regext1.s
+#source: start.s
+#ld: -m mmo
+#error: not a local register
diff --git a/ld/testsuite/ld-mmix/local3.d b/ld/testsuite/ld-mmix/local3.d
new file mode 100644
index 0000000..b51f27f
--- /dev/null
+++ b/ld/testsuite/ld-mmix/local3.d
@@ -0,0 +1,63 @@
+#source: greg-4.s
+#source: greg-4.s
+#source: local1.s
+#source: ext1.s
+#source: start.s
+#ld: -m elf64mmix
+#readelf: -Ssx1 -x5
+
+# Like local1, but ext1 is here a constant, not a global register.
+
+There are 9 section headers, starting at offset 0x110:
+
+Section Headers:
+ \[Nr\] Name Type Address Offset
+ Size EntSize Flags Link Info Align
+ \[ 0\] NULL 0+ 0+
+ 0+ 0+ 0 0 0
+ \[ 1\] \.text PROGBITS 0+ 0+b0
+ 0+8 0+ AX 0 0 4
+ \[ 2\] \.data PROGBITS 2000000000000000 0+b8
+ 0+ 0+ WA 0 0 1
+ \[ 3\] \.sbss PROGBITS 2000000000000000 0+b8
+ 0+ 0+ W 0 0 1
+ \[ 4\] \.bss NOBITS 2000000000000000 0+b8
+ 0+ 0+ WA 0 0 1
+ \[ 5\] \.MMIX\.reg_content PROGBITS 0+7e8 0+b8
+ 0+10 0+ W 0 0 1
+ \[ 6\] \.shstrtab STRTAB 0+ 0+c8
+ 0+45 0+ 0 0 1
+ \[ 7\] \.symtab SYMTAB 0+ 0+350
+ 0+198 0+18 8 b 8
+ \[ 8\] \.strtab STRTAB 0+ 0+4e8
+ 0+32 0+ 0 0 1
+Key to Flags:
+ W \(write\), A \(alloc\), X \(execute\), M \(merge\), S \(strings\)
+ I \(info\), L \(link order\), G \(group\), x \(unknown\)
+ O \(extra OS processing required\) o \(OS specific\), p \(processor specific\)
+
+Symbol table '\.symtab' contains 17 entries:
+ Num: Value Size Type Bind Vis Ndx Name
+ 0: 0+ 0 NOTYPE LOCAL DEFAULT UND
+ 1: 0+ 0 SECTION LOCAL DEFAULT 1
+ 2: 2000000000000000 0 SECTION LOCAL DEFAULT 2
+ 3: 2000000000000000 0 SECTION LOCAL DEFAULT 3
+ 4: 2000000000000000 0 SECTION LOCAL DEFAULT 4
+ 5: 0+7e8 0 SECTION LOCAL DEFAULT 5
+ 6: 0+ 0 SECTION LOCAL DEFAULT 6
+ 7: 0+ 0 SECTION LOCAL DEFAULT 7
+ 8: 0+ 0 SECTION LOCAL DEFAULT 8
+ 9: 0+fd 0 NOTYPE LOCAL DEFAULT PRC lsym
+ 10: 0+fe 0 NOTYPE LOCAL DEFAULT PRC lsym
+ 11: 0+fc 0 NOTYPE GLOBAL DEFAULT ABS ext1
+ 12: 0+4 0 NOTYPE GLOBAL DEFAULT 1 _start
+ 13: 2000000000000000 0 OBJECT GLOBAL DEFAULT ABS __bss_start
+ 14: 2000000000000000 0 OBJECT GLOBAL DEFAULT ABS _edata
+ 15: 2000000000000000 0 OBJECT GLOBAL DEFAULT ABS _end
+ 16: 0+4 0 OBJECT GLOBAL DEFAULT 1 _start\.
+
+Hex dump of section '\.text':
+ 0x0+ fd030201 e3fd0001 .*
+
+Hex dump of section '\.MMIX\.reg_contents':
+ 0x0+7e8 00000000 0000004e 00000000 0000004e .*
diff --git a/ld/testsuite/ld-mmix/local3m.d b/ld/testsuite/ld-mmix/local3m.d
new file mode 100644
index 0000000..ea35d30
--- /dev/null
+++ b/ld/testsuite/ld-mmix/local3m.d
@@ -0,0 +1,21 @@
+#source: greg-4.s
+#source: greg-4.s
+#source: local1.s
+#source: ext1.s
+#source: start.s
+#ld: -m mmo
+#objdump: -str
+
+.*: file format mmo
+
+SYMBOL TABLE:
+0+4 g \.text Main
+0+fc g \*ABS\* ext1
+0+4 g \.text _start
+
+
+Contents of section \.text:
+ 0000 fd030201 e3fd0001 .*
+Contents of section \.MMIX\.reg_contents:
+ 07e8 00000000 0000004e 00000000 0000004e .*
+
diff --git a/ld/testsuite/ld-mmix/local4.d b/ld/testsuite/ld-mmix/local4.d
new file mode 100644
index 0000000..13fa8e6
--- /dev/null
+++ b/ld/testsuite/ld-mmix/local4.d
@@ -0,0 +1,8 @@
+#source: greg-4.s
+#source: greg-4.s
+#source: greg-4.s
+#source: local1.s
+#source: ext1.s
+#source: start.s
+#ld: -m elf64mmix
+#error: not a local register
diff --git a/ld/testsuite/ld-mmix/local4m.d b/ld/testsuite/ld-mmix/local4m.d
new file mode 100644
index 0000000..d18cb20
--- /dev/null
+++ b/ld/testsuite/ld-mmix/local4m.d
@@ -0,0 +1,8 @@
+#source: greg-4.s
+#source: greg-4.s
+#source: greg-4.s
+#source: local1.s
+#source: ext1.s
+#source: start.s
+#ld: -m mmo
+#error: is not a local register
diff --git a/ld/testsuite/ld-mmix/local5.d b/ld/testsuite/ld-mmix/local5.d
new file mode 100644
index 0000000..5e92e99
--- /dev/null
+++ b/ld/testsuite/ld-mmix/local5.d
@@ -0,0 +1,64 @@
+#source: greg-4.s
+#source: greg-4.s
+#source: local2.s
+#source: local1.s
+#source: regext1.s
+#source: start.s
+#ld: -m elf64mmix
+#readelf: -Ssx1 -x5
+
+# Like local1, but with two checks for a local register.
+
+There are 9 section headers, starting at offset 0x118:
+
+Section Headers:
+ \[Nr\] Name Type Address Offset
+ Size EntSize Flags Link Info Align
+ \[ 0\] NULL 0+ 0+
+ 0+ 0+ 0 0 0
+ \[ 1\] \.text PROGBITS 0+ 0+b0
+ 0+c 0+ AX 0 0 4
+ \[ 2\] \.data PROGBITS 2000000000000000 0+bc
+ 0+ 0+ WA 0 0 1
+ \[ 3\] \.sbss PROGBITS 2000000000000000 0+bc
+ 0+ 0+ W 0 0 1
+ \[ 4\] \.bss NOBITS 2000000000000000 0+bc
+ 0+ 0+ WA 0 0 1
+ \[ 5\] \.MMIX\.reg_content PROGBITS 0+7e8 0+bc
+ 0+10 0+ W 0 0 1
+ \[ 6\] \.shstrtab STRTAB 0+ 0+cc
+ 0+45 0+ 0 0 1
+ \[ 7\] \.symtab SYMTAB 0+ 0+358
+ 0+198 0+18 8 b 8
+ \[ 8\] \.strtab STRTAB 0+ 0+4f0
+ 0+32 0+ 0 0 1
+Key to Flags:
+ W \(write\), A \(alloc\), X \(execute\), M \(merge\), S \(strings\)
+ I \(info\), L \(link order\), G \(group\), x \(unknown\)
+ O \(extra OS processing required\) o \(OS specific\), p \(processor specific\)
+
+Symbol table '\.symtab' contains 17 entries:
+ Num: Value Size Type Bind Vis Ndx Name
+ 0: 0+ 0 NOTYPE LOCAL DEFAULT UND
+ 1: 0+ 0 SECTION LOCAL DEFAULT 1
+ 2: 2000000000000000 0 SECTION LOCAL DEFAULT 2
+ 3: 2000000000000000 0 SECTION LOCAL DEFAULT 3
+ 4: 2000000000000000 0 SECTION LOCAL DEFAULT 4
+ 5: 0+7e8 0 SECTION LOCAL DEFAULT 5
+ 6: 0+ 0 SECTION LOCAL DEFAULT 6
+ 7: 0+ 0 SECTION LOCAL DEFAULT 7
+ 8: 0+ 0 SECTION LOCAL DEFAULT 8
+ 9: 0+fd 0 NOTYPE LOCAL DEFAULT PRC lsym
+ 10: 0+fe 0 NOTYPE LOCAL DEFAULT PRC lsym
+ 11: 0+fc 0 NOTYPE GLOBAL DEFAULT PRC ext1
+ 12: 0+8 0 NOTYPE GLOBAL DEFAULT 1 _start
+ 13: 2000000000000000 0 OBJECT GLOBAL DEFAULT ABS __bss_start
+ 14: 2000000000000000 0 OBJECT GLOBAL DEFAULT ABS _edata
+ 15: 2000000000000000 0 OBJECT GLOBAL DEFAULT ABS _end
+ 16: 0+8 0 OBJECT GLOBAL DEFAULT 1 _start\.
+
+Hex dump of section '\.text':
+ 0x0+ fd020202 fd030201 e3fd0001 .*
+
+Hex dump of section '\.MMIX\.reg_contents':
+ 0x0+7e8 00000000 0000004e 00000000 0000004e .*
diff --git a/ld/testsuite/ld-mmix/local5m.d b/ld/testsuite/ld-mmix/local5m.d
new file mode 100644
index 0000000..6b4c89b
--- /dev/null
+++ b/ld/testsuite/ld-mmix/local5m.d
@@ -0,0 +1,21 @@
+#source: greg-4.s
+#source: greg-4.s
+#source: local2.s
+#source: local1.s
+#source: regext1.s
+#source: start.s
+#ld: -m mmo
+#objdump: -str
+
+.*: file format mmo
+
+SYMBOL TABLE:
+0+8 g \.text Main
+0+fc g \*REG\* ext1
+0+8 g \.text _start
+
+
+Contents of section \.text:
+ 0000 fd020202 fd030201 e3fd0001 .*
+Contents of section \.MMIX\.reg_contents:
+ 07e8 00000000 0000004e 00000000 0000004e .*
diff --git a/ld/testsuite/ld-mmix/local6.d b/ld/testsuite/ld-mmix/local6.d
new file mode 100644
index 0000000..b2ed1ed
--- /dev/null
+++ b/ld/testsuite/ld-mmix/local6.d
@@ -0,0 +1,9 @@
+#source: greg-4.s
+#source: greg-4.s
+#source: greg-4.s
+#source: local1.s
+#source: local2.s
+#source: ext1.s
+#source: start.s
+#ld: -m elf64mmix
+#error: not a local register
diff --git a/ld/testsuite/ld-mmix/local6m.d b/ld/testsuite/ld-mmix/local6m.d
new file mode 100644
index 0000000..be64ca2
--- /dev/null
+++ b/ld/testsuite/ld-mmix/local6m.d
@@ -0,0 +1,9 @@
+#source: greg-4.s
+#source: greg-4.s
+#source: greg-4.s
+#source: local1.s
+#source: local2.s
+#source: ext1.s
+#source: start.s
+#ld: -m mmo
+#error: not a local register
diff --git a/ld/testsuite/ld-mmix/local7.d b/ld/testsuite/ld-mmix/local7.d
new file mode 100644
index 0000000..d92b074
--- /dev/null
+++ b/ld/testsuite/ld-mmix/local7.d
@@ -0,0 +1,65 @@
+#source: greg-4.s
+#source: greg-4.s
+#source: local1.s
+#source: local2.s
+#source: ext1.s
+#source: start.s
+#ld: -m elf64mmix
+#readelf: -Ssx1 -x5
+
+# Like local1, but ext1 is here a constant, not a global register and two
+# local-register checks.
+
+There are 9 section headers, starting at offset 0x118:
+
+Section Headers:
+ \[Nr\] Name Type Address Offset
+ Size EntSize Flags Link Info Align
+ \[ 0\] NULL 0+ 0+
+ 0+ 0+ 0 0 0
+ \[ 1\] \.text PROGBITS 0+ 0+b0
+ 0+c 0+ AX 0 0 4
+ \[ 2\] \.data PROGBITS 2000000000000000 0+bc
+ 0+ 0+ WA 0 0 1
+ \[ 3\] \.sbss PROGBITS 2000000000000000 0+bc
+ 0+ 0+ W 0 0 1
+ \[ 4\] \.bss NOBITS 2000000000000000 0+bc
+ 0+ 0+ WA 0 0 1
+ \[ 5\] \.MMIX\.reg_content PROGBITS 0+7e8 0+bc
+ 0+10 0+ W 0 0 1
+ \[ 6\] \.shstrtab STRTAB 0+ 0+cc
+ 0+45 0+ 0 0 1
+ \[ 7\] \.symtab SYMTAB 0+ 0+358
+ 0+198 0+18 8 b 8
+ \[ 8\] \.strtab STRTAB 0+ 0+4f0
+ 0+32 0+ 0 0 1
+Key to Flags:
+ W \(write\), A \(alloc\), X \(execute\), M \(merge\), S \(strings\)
+ I \(info\), L \(link order\), G \(group\), x \(unknown\)
+ O \(extra OS processing required\) o \(OS specific\), p \(processor specific\)
+
+Symbol table '\.symtab' contains 17 entries:
+ Num: Value Size Type Bind Vis Ndx Name
+ 0: 0+ 0 NOTYPE LOCAL DEFAULT UND
+ 1: 0+ 0 SECTION LOCAL DEFAULT 1
+ 2: 2000000000000000 0 SECTION LOCAL DEFAULT 2
+ 3: 2000000000000000 0 SECTION LOCAL DEFAULT 3
+ 4: 2000000000000000 0 SECTION LOCAL DEFAULT 4
+ 5: 0+7e8 0 SECTION LOCAL DEFAULT 5
+ 6: 0+ 0 SECTION LOCAL DEFAULT 6
+ 7: 0+ 0 SECTION LOCAL DEFAULT 7
+ 8: 0+ 0 SECTION LOCAL DEFAULT 8
+ 9: 0+fd 0 NOTYPE LOCAL DEFAULT PRC lsym
+ 10: 0+fe 0 NOTYPE LOCAL DEFAULT PRC lsym
+ 11: 0+fc 0 NOTYPE GLOBAL DEFAULT ABS ext1
+ 12: 0+8 0 NOTYPE GLOBAL DEFAULT 1 _start
+ 13: 2000000000000000 0 OBJECT GLOBAL DEFAULT ABS __bss_start
+ 14: 2000000000000000 0 OBJECT GLOBAL DEFAULT ABS _edata
+ 15: 2000000000000000 0 OBJECT GLOBAL DEFAULT ABS _end
+ 16: 0+8 0 OBJECT GLOBAL DEFAULT 1 _start\.
+
+Hex dump of section '\.text':
+ 0x0+ fd030201 fd020202 e3fd0001 .*
+
+Hex dump of section '\.MMIX\.reg_contents':
+ 0x0+7e8 00000000 0000004e 00000000 0000004e .*
diff --git a/ld/testsuite/ld-mmix/local7m.d b/ld/testsuite/ld-mmix/local7m.d
new file mode 100644
index 0000000..4095f2f
--- /dev/null
+++ b/ld/testsuite/ld-mmix/local7m.d
@@ -0,0 +1,21 @@
+#source: greg-4.s
+#source: greg-4.s
+#source: local1.s
+#source: local2.s
+#source: ext1.s
+#source: start.s
+#ld: -m mmo
+#objdump: -str
+
+.*: file format mmo
+
+SYMBOL TABLE:
+0+8 g \.text Main
+0+fc g \*ABS\* ext1
+0+8 g \.text _start
+
+
+Contents of section \.text:
+ 0000 fd030201 fd020202 e3fd0001 .*
+Contents of section \.MMIX\.reg_contents:
+ 07e8 00000000 0000004e 00000000 0000004e .*
diff --git a/ld/testsuite/ld-mmix/local8.d b/ld/testsuite/ld-mmix/local8.d
new file mode 100644
index 0000000..f82e6d0
--- /dev/null
+++ b/ld/testsuite/ld-mmix/local8.d
@@ -0,0 +1,28 @@
+#source: greg-5.s
+#source: greg-5.s
+#source: greg-5.s
+#source: greg-5.s
+#source: greg-5.s
+#source: greg-5.s
+#source: greg-5.s
+#source: greg-4.s
+#source: greg-4.s
+#source: greg-4.s
+#source: greg-4.s
+#source: greg-4.s
+#source: greg-4.s
+#source: greg-4.s
+#source: greg-4.s
+#source: greg-4.s
+#source: greg-4.s
+#source: greg-4.s
+#source: greg-4.s
+#source: greg-4.s
+#source: greg-4.s
+#source: greg-4.s
+#source: local2.s
+#source: local1.s
+#source: ext1.s
+#source: start.s
+#ld: -m elf64mmix
+#error: 128 is not a local register
diff --git a/ld/testsuite/ld-mmix/local8m.d b/ld/testsuite/ld-mmix/local8m.d
new file mode 100644
index 0000000..4e07afe
--- /dev/null
+++ b/ld/testsuite/ld-mmix/local8m.d
@@ -0,0 +1,28 @@
+#source: greg-5.s
+#source: greg-5.s
+#source: greg-5.s
+#source: greg-5.s
+#source: greg-5.s
+#source: greg-5.s
+#source: greg-5.s
+#source: greg-4.s
+#source: greg-4.s
+#source: greg-4.s
+#source: greg-4.s
+#source: greg-4.s
+#source: greg-4.s
+#source: greg-4.s
+#source: greg-4.s
+#source: greg-4.s
+#source: greg-4.s
+#source: greg-4.s
+#source: greg-4.s
+#source: greg-4.s
+#source: greg-4.s
+#source: greg-4.s
+#source: local2.s
+#source: local1.s
+#source: ext1.s
+#source: start.s
+#ld: -m mmo
+#error: 128 is not a local register
diff --git a/ld/testsuite/ld-mmix/local9.d b/ld/testsuite/ld-mmix/local9.d
new file mode 100644
index 0000000..cc4f8c7
--- /dev/null
+++ b/ld/testsuite/ld-mmix/local9.d
@@ -0,0 +1,5 @@
+#source: local1.s
+#source: ext1l.s
+#source: start.s
+#ld: -m elf64mmix
+#error: valid only with a register or absolute value
diff --git a/ld/testsuite/ld-mmix/local9m.d b/ld/testsuite/ld-mmix/local9m.d
new file mode 100644
index 0000000..7842984
--- /dev/null
+++ b/ld/testsuite/ld-mmix/local9m.d
@@ -0,0 +1,5 @@
+#source: local1.s
+#source: ext1l.s
+#source: start.s
+#ld: -m mmo
+#error: valid only with a register or absolute value
diff --git a/ld/testsuite/ld-mmix/locdo-1.d b/ld/testsuite/ld-mmix/locdo-1.d
new file mode 100644
index 0000000..7b71542
--- /dev/null
+++ b/ld/testsuite/ld-mmix/locdo-1.d
@@ -0,0 +1,29 @@
+#source: locdo.s -globalize-symbols
+#source: start.s
+#ld: -m elf64mmix
+#objdump: -str
+
+.*: file format elf64-mmix
+
+SYMBOL TABLE:
+0+ l d \.text 0+
+2000000000000008 l d \.data 0+
+2000000000000010 l d \.sbss 0+
+2000000000000010 l d \.bss 0+
+0+ l d \*ABS\* 0+
+0+ l d \*ABS\* 0+
+0+ l d \*ABS\* 0+
+2000000000000008 g \*ABS\* 0+ __\.MMIX\.start\.\.data
+2000000000000008 g \.data 0+ od
+0+ g \.text 0+ _start
+2000000000000010 g O \*ABS\* 0+ __bss_start
+2000000000000000 g \*ABS\* 0+ Data_Segment
+2000000000000010 g O \*ABS\* 0+ _edata
+2000000000000010 g O \*ABS\* 0+ _end
+0+ g O \.text 0+ _start\.
+
+Contents of section \.text:
+ 0000 e3fd0001 \.\.\.\.
+Contents of section \.data:
+ 0008 20000000 00000008 \.\.\.\.\.\.\.
+Contents of section \.sbss:
diff --git a/ld/testsuite/ld-mmix/locdo.s b/ld/testsuite/ld-mmix/locdo.s
new file mode 100644
index 0000000..3402445
--- /dev/null
+++ b/ld/testsuite/ld-mmix/locdo.s
@@ -0,0 +1,2 @@
+ LOC Data_Segment+2
+od OCTA od
diff --git a/ld/testsuite/ld-mmix/loct-1.d b/ld/testsuite/ld-mmix/loct-1.d
new file mode 100644
index 0000000..eb121d5
--- /dev/null
+++ b/ld/testsuite/ld-mmix/loct-1.d
@@ -0,0 +1,27 @@
+#source: loct.s
+#source: start.s
+#ld: -m elf64mmix
+#objdump: -str
+
+.*: file format elf64-mmix
+
+SYMBOL TABLE:
+0+1004 l d \.text 0+
+2000000000000000 l d \.data 0+
+2000000000000000 l d \.sbss 0+
+2000000000000000 l d \.bss 0+
+0+ l d \*ABS\* 0+
+0+ l d \*ABS\* 0+
+0+ l d \*ABS\* 0+
+0+1004 l \.text 0+ t
+0+100c g \.text 0+ _start
+0+1004 g \*ABS\* 0+ __\.MMIX\.start\.\.text
+2000000000000000 g O \*ABS\* 0+ __bss_start
+2000000000000000 g O \*ABS\* 0+ _edata
+2000000000000000 g O \*ABS\* 0+ _end
+0+100c g O \.text 0+ _start\.
+
+Contents of section \.text:
+ 1004 fd000000 00001004 e3fd0001 .*
+Contents of section \.data:
+Contents of section \.sbss:
diff --git a/ld/testsuite/ld-mmix/loct.s b/ld/testsuite/ld-mmix/loct.s
new file mode 100644
index 0000000..5bf0973
--- /dev/null
+++ b/ld/testsuite/ld-mmix/loct.s
@@ -0,0 +1,4 @@
+ LOC #1002
+t SWYM
+ TETRA t
+
diff --git a/ld/testsuite/ld-mmix/locto-1.d b/ld/testsuite/ld-mmix/locto-1.d
new file mode 100644
index 0000000..26d817b
--- /dev/null
+++ b/ld/testsuite/ld-mmix/locto-1.d
@@ -0,0 +1,27 @@
+#source: locto.s -globalize-symbols
+#source: start.s
+#ld: -m elf64mmix
+#objdump: -str
+
+.*: file format elf64-mmix
+
+SYMBOL TABLE:
+0+1008 l d \.text 0+
+2000000000000000 l d \.data 0+
+2000000000000000 l d \.sbss 0+
+2000000000000000 l d \.bss 0+
+0+ l d \*ABS\* 0+
+0+ l d \*ABS\* 0+
+0+ l d \*ABS\* 0+
+0+1008 g \.text 0+ od
+0+1010 g \.text 0+ _start
+0+1008 g \*ABS\* 0+ __\.MMIX\.start\.\.text
+2000000000000000 g O \*ABS\* 0+ __bss_start
+2000000000000000 g O \*ABS\* 0+ _edata
+2000000000000000 g O \*ABS\* 0+ _end
+0+1010 g O \.text 0+ _start\.
+
+Contents of section \.text:
+ 1008 00000000 00001008 e3fd0001 .*
+Contents of section \.data:
+Contents of section \.sbss:
diff --git a/ld/testsuite/ld-mmix/locto.s b/ld/testsuite/ld-mmix/locto.s
new file mode 100644
index 0000000..d0b6e0a
--- /dev/null
+++ b/ld/testsuite/ld-mmix/locto.s
@@ -0,0 +1,3 @@
+ LOC #1002
+od OCTA od
+
diff --git a/ld/testsuite/ld-mmix/main1.s b/ld/testsuite/ld-mmix/main1.s
new file mode 100644
index 0000000..212d1ef
--- /dev/null
+++ b/ld/testsuite/ld-mmix/main1.s
@@ -0,0 +1,5 @@
+% For tests regarding the Main symbol and mmo. Most tests use start.s as
+% a base file.
+ .text
+Main:
+ SET $253,1
diff --git a/ld/testsuite/ld-mmix/mmix.exp b/ld/testsuite/ld-mmix/mmix.exp
new file mode 100644
index 0000000..89a23c6
--- /dev/null
+++ b/ld/testsuite/ld-mmix/mmix.exp
@@ -0,0 +1,32 @@
+# Expect script for ld-mmix tests
+# Copyright 2001 Free Software Foundation, Inc.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+# Written by Hans-Peter Nilsson (hp@bitrange.com)
+#
+
+# Test MMIX and mmo object format handling.
+
+if ![istarget mmix-*-*] {
+ return
+}
+
+set rd_test_list [lsort [glob -nocomplain $srcdir/$subdir/*.d]]
+foreach mmixtest $rd_test_list {
+ # We need to strip the ".d", but can leave the dirname.
+ verbose [file rootname $mmixtest]
+ run_dump_test [file rootname $mmixtest]
+}
diff --git a/ld/testsuite/ld-mmix/mmohdr1.ld b/ld/testsuite/ld-mmix/mmohdr1.ld
new file mode 100644
index 0000000..716c3f4
--- /dev/null
+++ b/ld/testsuite/ld-mmix/mmohdr1.ld
@@ -0,0 +1,11 @@
+OUTPUT_ARCH(mmix)
+OUTPUT_FORMAT("mmo")
+ENTRY(Main)
+SECTIONS
+{
+ .text 0x100 + sizeof_headers :
+ { *(.text); Main = _start; }
+
+ .MMIX.reg_contents :
+ { *(.MMIX.reg_contents); }
+}
diff --git a/ld/testsuite/ld-mmix/mmosec1.ld b/ld/testsuite/ld-mmix/mmosec1.ld
new file mode 100644
index 0000000..4e7e799
--- /dev/null
+++ b/ld/testsuite/ld-mmix/mmosec1.ld
@@ -0,0 +1,16 @@
+OUTPUT_ARCH(mmix)
+ENTRY(Main)
+SECTIONS
+{
+ .text 0x100 :
+ { *(.text); Main = _start; }
+
+ .other 0x1000000000000000 :
+ { *(secname); *(anothersec); *(thirdsec); *(.a.fourth.section); }
+
+ .data 0x2000000000000000 :
+ { *(.data); }
+
+ .MMIX.reg_contents :
+ { *(.MMIX.reg_contents); }
+}
diff --git a/ld/testsuite/ld-mmix/mmosec2.ld b/ld/testsuite/ld-mmix/mmosec2.ld
new file mode 100644
index 0000000..57025e2
--- /dev/null
+++ b/ld/testsuite/ld-mmix/mmosec2.ld
@@ -0,0 +1,13 @@
+OUTPUT_ARCH(mmix)
+ENTRY(Main)
+SECTIONS
+{
+ .text 0x1000000000000000 :
+ { *(.text); Main = _start; }
+
+ .data 0x2000000000000000 :
+ { *(.data); }
+
+ .MMIX.reg_contents :
+ { *(.MMIX.reg_contents); }
+}
diff --git a/ld/testsuite/ld-mmix/nop123.s b/ld/testsuite/ld-mmix/nop123.s
new file mode 100644
index 0000000..2d14f43
--- /dev/null
+++ b/ld/testsuite/ld-mmix/nop123.s
@@ -0,0 +1,3 @@
+# A nop to pad with an explicit insn.
+ .text
+ SWYM 1,2,3
diff --git a/ld/testsuite/ld-mmix/pad16.s b/ld/testsuite/ld-mmix/pad16.s
new file mode 100644
index 0000000..7692337
--- /dev/null
+++ b/ld/testsuite/ld-mmix/pad16.s
@@ -0,0 +1,4 @@
+* Padding 16 bytes, suitable for testing relocs together with the larger
+* padding files.
+ .text
+ .space 16,0
diff --git a/ld/testsuite/ld-mmix/pad2p18m32.s b/ld/testsuite/ld-mmix/pad2p18m32.s
new file mode 100644
index 0000000..ede581f
--- /dev/null
+++ b/ld/testsuite/ld-mmix/pad2p18m32.s
@@ -0,0 +1,4 @@
+* Padding (1 << 19)/2 - 32 bytes; that is, suitable for testing the
+* short-range relocs.
+ .text
+ .space (1 << 19)/2 - 32,0
diff --git a/ld/testsuite/ld-mmix/pad2p26m32.s b/ld/testsuite/ld-mmix/pad2p26m32.s
new file mode 100644
index 0000000..05f45c8
--- /dev/null
+++ b/ld/testsuite/ld-mmix/pad2p26m32.s
@@ -0,0 +1,4 @@
+* Padding (1 << 27)/2 - 32 bytes; that is, suitable for testing the
+* long-range relocs.
+ .text
+ .space (1 << 27)/2 - 32,0
diff --git a/ld/testsuite/ld-mmix/pad4.s b/ld/testsuite/ld-mmix/pad4.s
new file mode 100644
index 0000000..49dbe6d
--- /dev/null
+++ b/ld/testsuite/ld-mmix/pad4.s
@@ -0,0 +1,4 @@
+* Padding 16 bytes, suitable for testing relocs together with the larger
+* padding files.
+ .text
+ .space 4,0
diff --git a/ld/testsuite/ld-mmix/pushja.s b/ld/testsuite/ld-mmix/pushja.s
new file mode 100644
index 0000000..857ca9d
--- /dev/null
+++ b/ld/testsuite/ld-mmix/pushja.s
@@ -0,0 +1,7 @@
+* Just PUSHJs to an external symbol, with some padding.
+ .text
+ .global pushja
+pushja:
+ SET $253,2
+ PUSHJ $12,a
+ SET $253,3
diff --git a/ld/testsuite/ld-mmix/pushja1b.d b/ld/testsuite/ld-mmix/pushja1b.d
new file mode 100644
index 0000000..80d1da7
--- /dev/null
+++ b/ld/testsuite/ld-mmix/pushja1b.d
@@ -0,0 +1,25 @@
+#source: start.s
+#source: a.s
+#source: pushja.s
+#as: -x
+#ld: -m elf64mmix
+#objdump: -dr
+
+.*: file format elf64-mmix
+
+Disassembly of section \.text:
+
+0+ <_start>:
+ 0: e3fd0001 setl \$253,0x1
+
+0+4 <a>:
+ 4: e3fd0004 setl \$253,0x4
+
+0+8 <pushja>:
+ 8: e3fd0002 setl \$253,0x2
+ c: e3ff0004 setl \$255,0x4
+ 10: e6ff0000 incml \$255,0x0
+ 14: e5ff0000 incmh \$255,0x0
+ 18: e4ff0000 inch \$255,0x0
+ 1c: bf0cff00 pushgo \$12,\$255,0
+ 20: e3fd0003 setl \$253,0x3
diff --git a/ld/testsuite/ld-mmix/pushja1f.d b/ld/testsuite/ld-mmix/pushja1f.d
new file mode 100644
index 0000000..57879d8
--- /dev/null
+++ b/ld/testsuite/ld-mmix/pushja1f.d
@@ -0,0 +1,25 @@
+#source: start.s
+#source: pushja.s
+#source: a.s
+#as: -x
+#ld: -m elf64mmix
+#objdump: -dr
+
+.*: file format elf64-mmix
+
+Disassembly of section \.text:
+
+0+ <_start>:
+ 0: e3fd0001 setl \$253,0x1
+
+0+4 <pushja>:
+ 4: e3fd0002 setl \$253,0x2
+ 8: e3ff0020 setl \$255,0x20
+ c: e6ff0000 incml \$255,0x0
+ 10: e5ff0000 incmh \$255,0x0
+ 14: e4ff0000 inch \$255,0x0
+ 18: bf0cff00 pushgo \$12,\$255,0
+ 1c: e3fd0003 setl \$253,0x3
+
+0+20 <a>:
+ 20: e3fd0004 setl \$253,0x4
diff --git a/ld/testsuite/ld-mmix/pushja2b.d b/ld/testsuite/ld-mmix/pushja2b.d
new file mode 100644
index 0000000..623754f
--- /dev/null
+++ b/ld/testsuite/ld-mmix/pushja2b.d
@@ -0,0 +1,21 @@
+#source: start.s
+#source: a.s
+#source: pushja.s
+#as: -no-expand
+#ld: -m elf64mmix
+#objdump: -dr
+
+.*: file format elf64-mmix
+
+Disassembly of section \.text:
+
+0+ <_start>:
+ 0: e3fd0001 setl \$253,0x1
+
+0+4 <a>:
+ 4: e3fd0004 setl \$253,0x4
+
+0+8 <pushja>:
+ 8: e3fd0002 setl \$253,0x2
+ c: f30cfffe pushj \$12,4 <a>
+ 10: e3fd0003 setl \$253,0x3
diff --git a/ld/testsuite/ld-mmix/pushja2f.d b/ld/testsuite/ld-mmix/pushja2f.d
new file mode 100644
index 0000000..687d559
--- /dev/null
+++ b/ld/testsuite/ld-mmix/pushja2f.d
@@ -0,0 +1,21 @@
+#source: start.s
+#source: pushja.s
+#source: a.s
+#as: -no-expand
+#ld: -m elf64mmix
+#objdump: -dr
+
+.*: file format elf64-mmix
+
+Disassembly of section \.text:
+
+0+ <_start>:
+ 0: e3fd0001 setl \$253,0x1
+
+0+4 <pushja>:
+ 4: e3fd0002 setl \$253,0x2
+ 8: f20c0002 pushj \$12,10 <a>
+ c: e3fd0003 setl \$253,0x3
+
+0+10 <a>:
+ 10: e3fd0004 setl \$253,0x4
diff --git a/ld/testsuite/ld-mmix/pushja7b.d b/ld/testsuite/ld-mmix/pushja7b.d
new file mode 100644
index 0000000..03c9ea9
--- /dev/null
+++ b/ld/testsuite/ld-mmix/pushja7b.d
@@ -0,0 +1,25 @@
+#source: start.s
+#source: a.s
+#source: pushja.s
+#as: -x
+#ld: -m mmo
+#objdump: -dr
+
+.*: file format mmo
+
+Disassembly of section \.text:
+
+0+ <(Main|_start)>:
+ 0: e3fd0001 setl \$253,0x1
+
+0+4 <a>:
+ 4: e3fd0004 setl \$253,0x4
+
+0+8 <pushja>:
+ 8: e3fd0002 setl \$253,0x2
+ c: e3ff0004 setl \$255,0x4
+ 10: e6ff0000 incml \$255,0x0
+ 14: e5ff0000 incmh \$255,0x0
+ 18: e4ff0000 inch \$255,0x0
+ 1c: bf0cff00 pushgo \$12,\$255,0
+ 20: e3fd0003 setl \$253,0x3
diff --git a/ld/testsuite/ld-mmix/pushja7f.d b/ld/testsuite/ld-mmix/pushja7f.d
new file mode 100644
index 0000000..e4b2c68
--- /dev/null
+++ b/ld/testsuite/ld-mmix/pushja7f.d
@@ -0,0 +1,25 @@
+#source: start.s
+#source: pushja.s
+#source: a.s
+#as: -x
+#ld: -m mmo
+#objdump: -dr
+
+.*: file format mmo
+
+Disassembly of section \.text:
+
+0+ <(Main|_start)>:
+ 0: e3fd0001 setl \$253,0x1
+
+0+4 <pushja>:
+ 4: e3fd0002 setl \$253,0x2
+ 8: e3ff0020 setl \$255,0x20
+ c: e6ff0000 incml \$255,0x0
+ 10: e5ff0000 incmh \$255,0x0
+ 14: e4ff0000 inch \$255,0x0
+ 18: bf0cff00 pushgo \$12,\$255,0
+ 1c: e3fd0003 setl \$253,0x3
+
+0+20 <a>:
+ 20: e3fd0004 setl \$253,0x4
diff --git a/ld/testsuite/ld-mmix/pushja8b.d b/ld/testsuite/ld-mmix/pushja8b.d
new file mode 100644
index 0000000..da1f216
--- /dev/null
+++ b/ld/testsuite/ld-mmix/pushja8b.d
@@ -0,0 +1,21 @@
+#source: start.s
+#source: a.s
+#source: pushja.s
+#as: -no-expand
+#ld: -m mmo
+#objdump: -dr
+
+.*: file format mmo
+
+Disassembly of section \.text:
+
+0+ <(Main|_start)>:
+ 0: e3fd0001 setl \$253,0x1
+
+0+4 <a>:
+ 4: e3fd0004 setl \$253,0x4
+
+0+8 <pushja>:
+ 8: e3fd0002 setl \$253,0x2
+ c: f30cfffe pushj \$12,4 <a>
+ 10: e3fd0003 setl \$253,0x3
diff --git a/ld/testsuite/ld-mmix/pushja8f.d b/ld/testsuite/ld-mmix/pushja8f.d
new file mode 100644
index 0000000..8ae45f9
--- /dev/null
+++ b/ld/testsuite/ld-mmix/pushja8f.d
@@ -0,0 +1,21 @@
+#source: start.s
+#source: pushja.s
+#source: a.s
+#as: -no-expand
+#ld: -m mmo
+#objdump: -dr
+
+.*: file format mmo
+
+Disassembly of section \.text:
+
+0+ <(Main|_start)>:
+ 0: e3fd0001 setl \$253,0x1
+
+0+4 <pushja>:
+ 4: e3fd0002 setl \$253,0x2
+ 8: f20c0002 pushj \$12,10 <a>
+ c: e3fd0003 setl \$253,0x3
+
+0+10 <a>:
+ 10: e3fd0004 setl \$253,0x4
diff --git a/ld/testsuite/ld-mmix/reg-1.d b/ld/testsuite/ld-mmix/reg-1.d
new file mode 100644
index 0000000..f904925
--- /dev/null
+++ b/ld/testsuite/ld-mmix/reg-1.d
@@ -0,0 +1,7 @@
+#source: areg-256.s
+#source: gregget1.s
+#source: start.s
+#source: a.s
+#as: -x
+#ld: -m elf64mmix
+#error: relocation truncated to fit: R_MMIX_REG areg$
diff --git a/ld/testsuite/ld-mmix/reg-1m.d b/ld/testsuite/ld-mmix/reg-1m.d
new file mode 100644
index 0000000..5a1bf6b
--- /dev/null
+++ b/ld/testsuite/ld-mmix/reg-1m.d
@@ -0,0 +1,7 @@
+#source: areg-256.s
+#source: gregget1.s
+#source: start.s
+#source: a.s
+#as: -x
+#ld: -m mmo
+#error: relocation truncated to fit: R_MMIX_REG areg$
diff --git a/ld/testsuite/ld-mmix/reg-2.d b/ld/testsuite/ld-mmix/reg-2.d
new file mode 100644
index 0000000..09b0da4
--- /dev/null
+++ b/ld/testsuite/ld-mmix/reg-2.d
@@ -0,0 +1,7 @@
+#source: areg-t.s
+#source: gregget1.s
+#source: start.s
+#source: a.s
+#as: -x
+#ld: -m elf64mmix
+#error: register relocation against non-register symbol: areg in \.text
diff --git a/ld/testsuite/ld-mmix/reg-2m.d b/ld/testsuite/ld-mmix/reg-2m.d
new file mode 100644
index 0000000..f6edbef
--- /dev/null
+++ b/ld/testsuite/ld-mmix/reg-2m.d
@@ -0,0 +1,7 @@
+#source: areg-t.s
+#source: gregget1.s
+#source: start.s
+#source: a.s
+#as: -x
+#ld: -m mmo
+#error: register relocation against non-register symbol: areg in \.text
diff --git a/ld/testsuite/ld-mmix/regext1.s b/ld/testsuite/ld-mmix/regext1.s
new file mode 100644
index 0000000..7703905
--- /dev/null
+++ b/ld/testsuite/ld-mmix/regext1.s
@@ -0,0 +1,2 @@
+ .global ext1
+ext1 IS $252
diff --git a/ld/testsuite/ld-mmix/sec-1.d b/ld/testsuite/ld-mmix/sec-1.d
new file mode 100644
index 0000000..25faec2
--- /dev/null
+++ b/ld/testsuite/ld-mmix/sec-1.d
@@ -0,0 +1,32 @@
+#source: sec-1.s
+#source: start.s
+#ld: -m elf64mmix
+#objcopy_linked_file: -O mmo
+#objdump: -sh
+
+.*: file format mmo
+
+Sections:
+Idx Name Size VMA LMA File off Algn
+ 0 \.text 0+4 0+ 0+ 0+ 2\*\*2
+ CONTENTS, ALLOC, LOAD, CODE
+ 1 \.a\.fourth\.section 0+10 0+20 0+20 0+ 2\*\*2
+ CONTENTS, ALLOC, LOAD, READONLY, DATA
+ 2 secname 0+1c 0+4 0+4 0+ 2\*\*2
+ CONTENTS, ALLOC, LOAD, READONLY, CODE
+ 3 anothersec 0+14 2000000000000000 2000000000000000 0+ 2\*\*2
+ CONTENTS, ALLOC, LOAD, DATA
+ 4 thirdsec 0+c 0+ 0+ 0+ 2\*\*2
+ CONTENTS, READONLY
+Contents of section \.text:
+ 0000 e3fd0001 .*
+Contents of section \.a\.fourth\.section:
+ 0020 00000000 0087a238 00000000 302a55a8 .*
+Contents of section secname:
+ 0004 00000001 00000002 00000003 00000004 .*
+ 0014 ffffffff fffff827 50000000 .*
+Contents of section anothersec:
+ 0000 0000000a 00000009 00000008 00000007 .*
+ 0010 25272900 .*
+Contents of section thirdsec:
+ 0000 00030d41 000186a2 26280000 .*
diff --git a/ld/testsuite/ld-mmix/sec-1.s b/ld/testsuite/ld-mmix/sec-1.s
new file mode 100644
index 0000000..77e26e3
--- /dev/null
+++ b/ld/testsuite/ld-mmix/sec-1.s
@@ -0,0 +1,14 @@
+ .section secname,"ax"
+ TETRA 1,2,3,4,-1,-2009
+ BYTE 80
+
+ .section anothersec,"aw"
+ TETRA 10,9,8,7
+ BYTE 37,39,41
+
+ .section thirdsec
+ TETRA 200001,100002
+ BYTE 38,40
+
+ .section .a.fourth.section,"a"
+ OCTA 8888888,808080808
diff --git a/ld/testsuite/ld-mmix/sec-2.d b/ld/testsuite/ld-mmix/sec-2.d
new file mode 100644
index 0000000..5bf4033
--- /dev/null
+++ b/ld/testsuite/ld-mmix/sec-2.d
@@ -0,0 +1,26 @@
+#source: sec-1.s
+#source: start.s
+#source: data1.s
+#ld: -m mmo -T $srcdir/$subdir/mmosec1.ld
+#objdump: -sh
+
+.*: file format mmo
+
+Sections:
+Idx Name Size VMA LMA File off Algn
+ 0 \.text 0+4 0+100 0+100 0+ 2\*\*2
+ CONTENTS, ALLOC, LOAD, CODE
+ 1 \.other 0+50 1000000000000000 1000000000000000 0+ 2\*\*2
+ CONTENTS, ALLOC, LOAD, CODE, DATA
+ 2 \.data 0+4 2000000000000004 2000000000000004 0+ 2\*\*2
+ CONTENTS, ALLOC, LOAD
+Contents of section \.text:
+ 0100 e3fd0001 .*
+Contents of section \.other:
+ 0000 00000001 00000002 00000003 00000004 .*
+ 0010 ffffffff fffff827 50000000 0000000a .*
+ 0020 00000009 00000008 00000007 25272900 .*
+ 0030 00030d41 000186a2 26280000 00000000 .*
+ 0040 00000000 0087a238 00000000 302a55a8 .*
+Contents of section \.data:
+ 0004 0000012c .*
diff --git a/ld/testsuite/ld-mmix/sec-2.s b/ld/testsuite/ld-mmix/sec-2.s
new file mode 100644
index 0000000..3ac0555
--- /dev/null
+++ b/ld/testsuite/ld-mmix/sec-2.s
@@ -0,0 +1,2 @@
+ .section .other,"ax"
+ TETRA 12,34,1
diff --git a/ld/testsuite/ld-mmix/sec-3.d b/ld/testsuite/ld-mmix/sec-3.d
new file mode 100644
index 0000000..84b6db5
--- /dev/null
+++ b/ld/testsuite/ld-mmix/sec-3.d
@@ -0,0 +1,36 @@
+#source: sec-1.s
+#source: start.s
+#source: data1.s
+#ld: -m mmo
+#objdump: -sh
+
+.*: file format mmo
+
+Sections:
+Idx Name Size VMA LMA File off Algn
+ 0 \.text 0+4 0+ 0+ 0+ 2\*\*2
+ CONTENTS, ALLOC, LOAD, CODE
+ 1 secname 0+1c 0+4 0+4 0+ 2\*\*2
+ CONTENTS, ALLOC, LOAD, READONLY, CODE
+ 2 \.a\.fourth\.section 0+10 0+20 0+20 0+ 2\*\*2
+ CONTENTS, ALLOC, LOAD, READONLY, DATA
+ 3 \.data 0+4 2000000000000004 2000000000000004 0+ 2\*\*2
+ CONTENTS, ALLOC, LOAD
+ 4 anothersec 0+14 2000000000000008 2000000000000008 0+ 2\*\*2
+ CONTENTS, ALLOC, LOAD, DATA
+ 5 thirdsec 0+c 200000000000001c 200000000000001c 0+ 2\*\*2
+ CONTENTS, READONLY
+Contents of section \.text:
+ 0000 e3fd0001 .*
+Contents of section secname:
+ 0004 00000001 00000002 00000003 00000004 .*
+ 0014 ffffffff fffff827 50000000 .*
+Contents of section \.a\.fourth\.section:
+ 0020 00000000 0087a238 00000000 302a55a8 .*
+Contents of section \.data:
+ 0004 0000002c .*
+Contents of section anothersec:
+ 0008 0000000a 00000009 00000008 00000007 .*
+ 0018 25272900 .*
+Contents of section thirdsec:
+ 001c 00030d41 000186a2 26280000 .*
diff --git a/ld/testsuite/ld-mmix/sec-4.d b/ld/testsuite/ld-mmix/sec-4.d
new file mode 100644
index 0000000..7979865
--- /dev/null
+++ b/ld/testsuite/ld-mmix/sec-4.d
@@ -0,0 +1,22 @@
+#source: sec-2.s
+#source: start.s
+#source: data1.s
+#ld: -m mmo -T $srcdir/$subdir/mmosec1.ld
+#objdump: -sh
+
+.*: file format mmo
+
+Sections:
+Idx Name Size VMA LMA File off Algn
+ 0 \.text 0+4 0+100 0+100 0+ 2\*\*2
+ CONTENTS, ALLOC, LOAD, CODE
+ 1 \.data 0+4 2000000000000004 2000000000000004 0+ 2\*\*2
+ CONTENTS, ALLOC, LOAD
+ 2 \.other 0+c 1000000000000000 1000000000000000 0+ 2\*\*2
+ CONTENTS, ALLOC, LOAD, READONLY, CODE
+Contents of section \.text:
+ 0100 e3fd0001 .*
+Contents of section \.data:
+ 0004 0000012c .*
+Contents of section \.other:
+ 0000 0000000c 00000022 00000001 .*
diff --git a/ld/testsuite/ld-mmix/sec-5.d b/ld/testsuite/ld-mmix/sec-5.d
new file mode 100644
index 0000000..caeabaf
--- /dev/null
+++ b/ld/testsuite/ld-mmix/sec-5.d
@@ -0,0 +1,21 @@
+#source: start.s
+#ld: -m mmo -T $srcdir/$subdir/mmosec2.ld
+#objdump: -sh
+
+# Check that sections are automatically created to cope with contents at
+# unexpected addresses. We do this by linking .text at an unexpected
+# address. As .text (like .data) does not get a section descriptor, the
+# output gets a LOP_LOC at an unexpected address, and a unique section is
+# created. This test will have to be changed if .text gets a section
+# descriptor if linked to an unexpected address.
+
+.*: file format mmo
+
+Sections:
+Idx Name Size VMA LMA File off Algn
+ 0 \.text 0+ 0+ 0+ 0+ 2\*\*2
+
+ 1 \.MMIX\.sec\.0 0+4 1000000000000000 1000000000000000 0+ 2\*\*2
+ CONTENTS, ALLOC, LOAD
+Contents of section \.MMIX\.sec\.0:
+ 0000 e3fd0001 .*
diff --git a/ld/testsuite/ld-mmix/sec-6.d b/ld/testsuite/ld-mmix/sec-6.d
new file mode 100644
index 0000000..ea4f6bc
--- /dev/null
+++ b/ld/testsuite/ld-mmix/sec-6.d
@@ -0,0 +1,36 @@
+#source: start.s
+#source: sec-6.s
+#source: a.s
+#as: -x
+#ld: -m elf64mmix
+#objcopy_linked_file: -O mmo
+#objdump: -xs
+
+# A non-loaded section with relocs would have the SEC_RELOC bit set in the
+# output if we didn't clear it. For reference, here's the ELF copied to
+# mmo, so we make sure no spurious flags are introduced.
+
+.*: file format mmo
+.*
+architecture: mmix, flags 0x0+10:
+HAS_SYMS
+start address 0x0+
+
+Sections:
+Idx Name Size VMA LMA File off Algn
+ 0 \.text 0+8 0+ 0+ 0+ 2\*\*2
+ CONTENTS, ALLOC, LOAD, CODE
+ 1 \.debug_frame 0+10 0+ 0+ 0+ 2\*\*2
+ CONTENTS, READONLY, DEBUGGING
+SYMBOL TABLE:
+0+ g \.text _start
+0+8 g \.text debugb
+2000000000000000 g \*ABS\* __bss_start
+2000000000000000 g \*ABS\* _edata
+2000000000000000 g \*ABS\* _end
+0+4 g \.text a
+
+Contents of section \.text:
+ 0000 e3fd0001 e3fd0004 .*
+Contents of section \.debug_frame:
+ 0000 00000000 00000004 00000000 00000008 .*
diff --git a/ld/testsuite/ld-mmix/sec-6.s b/ld/testsuite/ld-mmix/sec-6.s
new file mode 100644
index 0000000..7d83883
--- /dev/null
+++ b/ld/testsuite/ld-mmix/sec-6.s
@@ -0,0 +1,5 @@
+ .global debugb
+ .section .debug_frame,"",@progbits
+ .8byte a
+debugb:
+ .8byte debugb
diff --git a/ld/testsuite/ld-mmix/sec-6m.d b/ld/testsuite/ld-mmix/sec-6m.d
new file mode 100644
index 0000000..8d12cfb
--- /dev/null
+++ b/ld/testsuite/ld-mmix/sec-6m.d
@@ -0,0 +1,32 @@
+#source: start.s
+#source: sec-6.s
+#source: a.s
+#as: -x
+#ld: -m mmo
+#objdump: -xs
+
+# A non-loaded section with relocs would have the SEC_RELOC bit set in the
+# output if we didn't clear it.
+
+.*: file format mmo
+.*
+architecture: mmix, flags 0x0+10:
+HAS_SYMS
+start address 0x0+
+
+Sections:
+Idx Name Size VMA LMA File off Algn
+ 0 \.text 0+8 0+ 0+ 0+ 2\*\*2
+ CONTENTS, ALLOC, LOAD, CODE
+ 1 \.debug_frame 0+10 0+ 0+ 0+ 2\*\*2
+ CONTENTS, READONLY, DEBUGGING
+SYMBOL TABLE:
+0+ g \.text Main
+0+ g \.text _start
+0+8 g \.text debugb
+0+4 g \.text a
+
+Contents of section \.text:
+ 0000 e3fd0001 e3fd0004 .*
+Contents of section \.debug_frame:
+ 0000 00000000 00000004 00000000 00000008 .*
diff --git a/ld/testsuite/ld-mmix/spec801.d b/ld/testsuite/ld-mmix/spec801.d
new file mode 100644
index 0000000..27918e9
--- /dev/null
+++ b/ld/testsuite/ld-mmix/spec801.d
@@ -0,0 +1,21 @@
+#source: bspec801.s
+#source: start.s
+#ld: -m mmo
+#objdump: -sh
+
+# Check exceptional cases for LOP_SPEC 80, which we parse according to a
+# specific format: see documentation and mmo.c
+# #1: name length has LOP_QUOTE.
+
+.*: file format mmo
+
+Sections:
+Idx Name Size VMA LMA File off Algn
+ 0 \.text 00000004 0000000000000000 0000000000000000 00000000 2\*\*2
+ CONTENTS, ALLOC, LOAD, CODE
+ 1 \.MMIX\.spec_data\.80 00000004 0000000000000000 0000000000000000 00000000 2\*\*2
+ CONTENTS
+Contents of section \.text:
+ 0000 e3fd0001 .*
+Contents of section \.MMIX\.spec_data\.80:
+ 0000 98000001 .*
diff --git a/ld/testsuite/ld-mmix/spec802.d b/ld/testsuite/ld-mmix/spec802.d
new file mode 100644
index 0000000..d5c8f4e
--- /dev/null
+++ b/ld/testsuite/ld-mmix/spec802.d
@@ -0,0 +1,24 @@
+#source: bspec802.s
+#source: start.s
+#ld: -m mmo
+#objdump: -sh
+
+# See spec801.d.
+# #2: non-quote LOP in name.
+
+.*: file format mmo
+
+Sections:
+Idx Name Size VMA LMA File off Algn
+ 0 \.text 0+4 0+ 0+ 0+ 2\*\*2
+ CONTENTS, ALLOC, LOAD, CODE
+ 1 \.data 0+4 2000000000000000 2000000000000000 0+ 2\*\*2
+ CONTENTS, ALLOC, LOAD
+ 2 \.MMIX\.spec_data\.80 0+4 0+ 0+ 0+ 2\*\*2
+ CONTENTS
+Contents of section \.text:
+ 0000 e3fd0001 .*
+Contents of section \.data:
+ 0000 00112233 .*
+Contents of section \.MMIX\.spec_data\.80:
+ 0000 00000004 .*
diff --git a/ld/testsuite/ld-mmix/spec803.d b/ld/testsuite/ld-mmix/spec803.d
new file mode 100644
index 0000000..d81d5a6
--- /dev/null
+++ b/ld/testsuite/ld-mmix/spec803.d
@@ -0,0 +1,24 @@
+#source: bspec803.s
+#source: start.s
+#ld: -m mmo
+#objdump: -sh
+
+# See spec801.d.
+# #3: LOP_QUOTE in name and non-quote LOP in section flags.
+
+.*: file format mmo
+
+Sections:
+Idx Name Size VMA LMA File off Algn
+ 0 \.text 0+4 0+ 0+ 0+ 2\*\*2
+ CONTENTS, ALLOC, LOAD, CODE
+ 1 \.data 0+4 2000000000000000 2000000000000000 0+ 2\*\*2
+ CONTENTS, ALLOC, LOAD
+ 2 \.MMIX\.spec_data\.80 0+c 0+ 0+ 0+ 2\*\*2
+ CONTENTS
+Contents of section \.text:
+ 0000 e3fd0001 .*
+Contents of section \.data:
+ 0000 00112233 .*
+Contents of section \.MMIX\.spec_data\.80:
+ 0000 00000002 61616161 98616161 .*
diff --git a/ld/testsuite/ld-mmix/spec804.d b/ld/testsuite/ld-mmix/spec804.d
new file mode 100644
index 0000000..db13299
--- /dev/null
+++ b/ld/testsuite/ld-mmix/spec804.d
@@ -0,0 +1,24 @@
+#source: bspec804.s
+#source: start.s
+#ld: -m mmo
+#objdump: -sh
+
+# See spec801.d.
+# #4: non-quote LOP in section length, high part.
+
+.*: file format mmo
+
+Sections:
+Idx Name Size VMA LMA File off Algn
+ 0 \.text 0+4 0+ 0+ 0+ 2\*\*2
+ CONTENTS, ALLOC, LOAD, CODE
+ 1 \.data 0+4 2000000000000000 2000000000000000 0+ 2\*\*2
+ CONTENTS, ALLOC, LOAD
+ 2 \.MMIX\.spec_data\.80 0+10 0+ 0+ 0+ 2\*\*2
+ CONTENTS
+Contents of section \.text:
+ 0000 e3fd0001 .*
+Contents of section \.data:
+ 0000 00112233 .*
+Contents of section \.MMIX\.spec_data\.80:
+ 0000 00000002 61616161 61616161 00000011 .*
diff --git a/ld/testsuite/ld-mmix/spec805.d b/ld/testsuite/ld-mmix/spec805.d
new file mode 100644
index 0000000..fd47e1c
--- /dev/null
+++ b/ld/testsuite/ld-mmix/spec805.d
@@ -0,0 +1,25 @@
+#source: bspec805.s
+#source: start.s
+#ld: -m mmo
+#objdump: -sh
+
+# See spec801.d.
+# #5: non-quote LOP in section length, low part.
+
+.*: file format mmo
+
+Sections:
+Idx Name Size VMA LMA File off Algn
+ 0 \.text 0+4 0+ 0+ 0+ 2\*\*2
+ CONTENTS, ALLOC, LOAD, CODE
+ 1 \.data 0+4 2000000000000000 2000000000000000 0+ 2\*\*2
+ CONTENTS, ALLOC, LOAD
+ 2 \.MMIX\.spec_data\.80 0+14 0+ 0+ 0+ 2\*\*2
+ CONTENTS
+Contents of section \.text:
+ 0000 e3fd0001 .*
+Contents of section \.data:
+ 0000 00112233 .*
+Contents of section \.MMIX\.spec_data\.80:
+ 0000 00000002 61616161 61616161 00000011 .*
+ 0010 00000000 .*
diff --git a/ld/testsuite/ld-mmix/spec806.d b/ld/testsuite/ld-mmix/spec806.d
new file mode 100644
index 0000000..5679c73
--- /dev/null
+++ b/ld/testsuite/ld-mmix/spec806.d
@@ -0,0 +1,25 @@
+#source: bspec806.s
+#source: start.s
+#ld: -m mmo
+#objdump: -sh
+
+# See spec801.d.
+# #6: non-quote LOP in section vma, high part.
+
+.*: file format mmo
+
+Sections:
+Idx Name Size VMA LMA File off Algn
+ 0 \.text 0+4 0+ 0+ 0+ 2\*\*2
+ CONTENTS, ALLOC, LOAD, CODE
+ 1 \.data 0+4 2000000000000000 2000000000000000 0+ 2\*\*2
+ CONTENTS, ALLOC, LOAD
+ 2 \.MMIX\.spec_data\.80 0+18 0+ 0+ 0+ 2\*\*2
+ CONTENTS
+Contents of section \.text:
+ 0000 e3fd0001 .*
+Contents of section \.data:
+ 0000 00112233 .*
+Contents of section \.MMIX\.spec_data\.80:
+ 0000 00000002 61616161 61616161 00000011 .*
+ 0010 00000000 0000000c .*
diff --git a/ld/testsuite/ld-mmix/spec807.d b/ld/testsuite/ld-mmix/spec807.d
new file mode 100644
index 0000000..1cfdf9e
--- /dev/null
+++ b/ld/testsuite/ld-mmix/spec807.d
@@ -0,0 +1,25 @@
+#source: bspec807.s
+#source: start.s
+#ld: -m mmo
+#objdump: -sh
+
+# See spec801.d.
+# #7: non-quote LOP in section vma, low part.
+
+.*: file format mmo
+
+Sections:
+Idx Name Size VMA LMA File off Algn
+ 0 \.text 0+4 0+ 0+ 0+ 2\*\*2
+ CONTENTS, ALLOC, LOAD, CODE
+ 1 \.data 0+4 2000000000000000 2000000000000000 0+ 2\*\*2
+ CONTENTS, ALLOC, LOAD
+ 2 \.MMIX\.spec_data\.80 0+1c 0+ 0+ 0+ 2\*\*2
+ CONTENTS
+Contents of section \.text:
+ 0000 e3fd0001 .*
+Contents of section \.data:
+ 0000 00112233 .*
+Contents of section \.MMIX\.spec_data\.80:
+ 0000 00000002 61616161 61616161 00000011 .*
+ 0010 00000000 0000000c 00000000 .*
diff --git a/ld/testsuite/ld-mmix/spec808.d b/ld/testsuite/ld-mmix/spec808.d
new file mode 100644
index 0000000..fb2ccd1
--- /dev/null
+++ b/ld/testsuite/ld-mmix/spec808.d
@@ -0,0 +1,25 @@
+#source: bspec808.s
+#source: start.s
+#ld: -m mmo
+#objdump: -sh
+
+# See spec801.d.
+# #8: Indecent section length.
+
+.*: file format mmo
+
+Sections:
+Idx Name Size VMA LMA File off Algn
+ 0 \.text 0+4 0+ 0+ 0+ 2\*\*2
+ CONTENTS, ALLOC, LOAD, CODE
+ 1 \.data 0+4 2000000000000000 2000000000000000 0+ 2\*\*2
+ CONTENTS, ALLOC, LOAD
+ 2 \.MMIX\.spec_data\.80 0+20 0+ 0+ 0+ 2\*\*2
+ CONTENTS
+Contents of section \.text:
+ 0000 e3fd0001 .*
+Contents of section \.data:
+ 0000 00112233 .*
+Contents of section \.MMIX\.spec_data\.80:
+ 0000 00000002 61616161 61616161 00000011 .*
+ 0010 0000ff00 00000000 000000ff 00000000 .*
diff --git a/ld/testsuite/ld-mmix/start-1.d b/ld/testsuite/ld-mmix/start-1.d
new file mode 100644
index 0000000..8a7162f
--- /dev/null
+++ b/ld/testsuite/ld-mmix/start-1.d
@@ -0,0 +1,27 @@
+#source: start2.s
+#ld: -m elf64mmix
+#objdump: -td
+
+.*: 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+ l d \*ABS\* 0+
+0+ l d \*ABS\* 0+
+0+ l d \*ABS\* 0+
+0+4 g \.text 0+ _start
+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\.
+
+Disassembly of section \.text:
+
+0+ <_start-0x4>:
+ 0: fd000001 swym 0,0,1
+
+0+4 <_start>:
+ 4: fd000002 swym 0,0,2
diff --git a/ld/testsuite/ld-mmix/start-2.d b/ld/testsuite/ld-mmix/start-2.d
new file mode 100644
index 0000000..e380dc0
--- /dev/null
+++ b/ld/testsuite/ld-mmix/start-2.d
@@ -0,0 +1,4 @@
+#source: main1.s
+#source: a.s
+#ld: -m mmo -e a
+#error: Bad symbol definition: `Main' set to
diff --git a/ld/testsuite/ld-mmix/start.s b/ld/testsuite/ld-mmix/start.s
new file mode 100644
index 0000000..b2e3c85
--- /dev/null
+++ b/ld/testsuite/ld-mmix/start.s
@@ -0,0 +1,5 @@
+* Just a start symbol and some non-NOP padding.
+ .text
+ .global _start
+_start:
+ SET $253,1
diff --git a/ld/testsuite/ld-mmix/start2.s b/ld/testsuite/ld-mmix/start2.s
new file mode 100644
index 0000000..3398788
--- /dev/null
+++ b/ld/testsuite/ld-mmix/start2.s
@@ -0,0 +1,5 @@
+ .text
+ SWYM 1
+ .global _start
+_start:
+ SWYM 2
diff --git a/ld/testsuite/ld-mmix/sym-1.d b/ld/testsuite/ld-mmix/sym-1.d
new file mode 100644
index 0000000..64d6376
--- /dev/null
+++ b/ld/testsuite/ld-mmix/sym-1.d
@@ -0,0 +1,11 @@
+#source: start.s
+#source: a.s
+#ld: -m mmo
+#nm: -n
+
+# Test that nm can grok a simple mmo symbol table (or that mmo lets nm
+# grok it).
+
+0+ T Main
+0+ T _start
+0+4 T a
diff --git a/ld/testsuite/ld-mmix/sym-2.d b/ld/testsuite/ld-mmix/sym-2.d
new file mode 100644
index 0000000..61bae32
--- /dev/null
+++ b/ld/testsuite/ld-mmix/sym-2.d
@@ -0,0 +1,142 @@
+#source: start.s
+#source: sym-2.s
+#source: a.s
+#as: -globalize-symbols
+#ld: -m mmo
+#objcopy_linked_file:
+#objdump: -t
+
+.*: file format mmo
+
+SYMBOL TABLE:
+0+ g[ ]+\.text Main
+0+4 g[ ]+\.text a40
+0+4 g[ ]+\.text a33
+0+4 g[ ]+\.text a45
+0+4 g[ ]+\.text a21
+0+4 g[ ]+\.text a99
+0+4 g[ ]+\.text a114
+0+4 g[ ]+\.text a122
+0+4 g[ ]+\.text a73
+0+4 g[ ]+\.text a111
+0+4 g[ ]+\.text a109
+0+4 g[ ]+\.text a65
+0+4 g[ ]+\.text a28
+0+4 g[ ]+\.text a30
+0+4 g[ ]+\.text a10
+0+4 g[ ]+\.text a103
+0+4 g[ ]+\.text a42
+0+4 g[ ]+\.text a62
+0+4 g[ ]+\.text a25
+0+4 g[ ]+\.text a128
+0+4 g[ ]+\.text a9
+0+4 g[ ]+\.text a11
+0+4 g[ ]+\.text a81
+0+4 g[ ]+\.text a55
+0+4 g[ ]+\.text a88
+0+4 g[ ]+\.text a100
+0+4 g[ ]+\.text a104
+0+4 g[ ]+\.text a8
+0+4 g[ ]+\.text a86
+0+4 g[ ]+\.text a91
+0+4 g[ ]+\.text a1
+0+4 g[ ]+\.text a49
+0+4 g[ ]+\.text a43
+0+4 g[ ]+\.text a56
+0+4 g[ ]+\.text a116
+0+4 g[ ]+\.text a124
+0+4 g[ ]+\.text a98
+0+4 g[ ]+\.text a117
+0+4 g[ ]+\.text a80
+0+4 g[ ]+\.text a121
+0+4 g[ ]+\.text a36
+0+4 g[ ]+\.text a75
+0+4 g[ ]+\.text a48
+0+4 g[ ]+\.text a3
+0+4 g[ ]+\.text a63
+0+4 g[ ]+\.text a26
+0+4 g[ ]+\.text a78
+0+4 g[ ]+\.text a61
+0+4 g[ ]+\.text a24
+0+4 g[ ]+\.text a64
+0+4 g[ ]+\.text a27
+0+4 g[ ]+\.text a83
+0+4 g[ ]+\.text a57
+0+4 g[ ]+\.text a123
+0+4 g[ ]+\.text a34
+0+4 g[ ]+\.text a12
+0+4 g[ ]+\.text a14
+0+4 g[ ]+\.text a70
+0+4 g[ ]+\.text a39
+0+4 g[ ]+\.text a82
+0+4 g[ ]+\.text a102
+0+4 g[ ]+\.text a106
+0+4 g[ ]+\.text a110
+0+ g[ ]+\.text _start
+0+4 g[ ]+\.text a41
+0+4 g[ ]+\.text a85
+0+4 g[ ]+\.text a58
+0+4 g[ ]+\.text a89
+0+4 g[ ]+\.text a54
+0+4 g[ ]+\.text a19
+0+4 g[ ]+\.text a93
+0+4 g[ ]+\.text a126
+0+4 g[ ]+\.text a22
+0+4 g[ ]+\.text a96
+0+4 g[ ]+\.text a7
+0+4 g[ ]+\.text a35
+0+4 g[ ]+\.text a31
+0+4 g[ ]+\.text a5
+0+4 g[ ]+\.text a44
+0+4 g[ ]+\.text a105
+0+4 g[ ]+\.text a90
+0+4 g[ ]+\.text a97
+0+4 g[ ]+\.text a92
+0+4 g[ ]+\.text a2
+0+4 g[ ]+\.text a120
+0+4 g[ ]+\.text a113
+0+4 g[ ]+\.text a77
+0+4 g[ ]+\.text a125
+0+4 g[ ]+\.text a118
+0+4 g[ ]+\.text a32
+0+4 g[ ]+\.text a108
+0+4 g[ ]+\.text a47
+0+4 g[ ]+\.text a112
+0+4 g[ ]+\.text a59
+0+4 g[ ]+\.text a87
+0+4 g[ ]+\.text a94
+0+4 g[ ]+\.text a20
+0+4 g[ ]+\.text a51
+0+4 g[ ]+\.text a16
+0+4 g[ ]+\.text a53
+0+4 g[ ]+\.text a18
+0+4 g[ ]+\.text a66
+0+4 g[ ]+\.text a29
+0+4 g[ ]+\.text a72
+0+4 g[ ]+\.text a79
+0+4 g[ ]+\.text a74
+0+4 g[ ]+\.text a68
+0+4 g[ ]+\.text a95
+0+4 g[ ]+\.text a60
+0+4 g[ ]+\.text a23
+0+4 g[ ]+\.text a67
+0+4 g[ ]+\.text a
+0+4 g[ ]+\.text a38
+0+4 g[ ]+\.text a107
+0+4 g[ ]+\.text a127
+0+4 g[ ]+\.text a101
+0+4 g[ ]+\.text a115
+0+4 g[ ]+\.text a71
+0+4 g[ ]+\.text a84
+0+4 g[ ]+\.text a69
+0+4 g[ ]+\.text a37
+0+4 g[ ]+\.text a76
+0+4 g[ ]+\.text a52
+0+4 g[ ]+\.text a17
+0+4 g[ ]+\.text a13
+0+4 g[ ]+\.text a50
+0+4 g[ ]+\.text a15
+0+4 g[ ]+\.text a119
+0+4 g[ ]+\.text a6
+0+4 g[ ]+\.text a46
+0+4 g[ ]+\.text a4
diff --git a/ld/testsuite/ld-mmix/sym-2.s b/ld/testsuite/ld-mmix/sym-2.s
new file mode 100644
index 0000000..c8df27e
--- /dev/null
+++ b/ld/testsuite/ld-mmix/sym-2.s
@@ -0,0 +1,130 @@
+% Just 128 symbols to test that we can handle it in mmo. Assemble it with
+% -globalize-symbols.
+a1:
+a2:
+a3:
+a4:
+a5:
+a6:
+a7:
+a8:
+a9:
+a10:
+a11:
+a12:
+a13:
+a14:
+a15:
+a16:
+a17:
+a18:
+a19:
+a20:
+a21:
+a22:
+a23:
+a24:
+a25:
+a26:
+a27:
+a28:
+a29:
+a30:
+a31:
+a32:
+a33:
+a34:
+a35:
+a36:
+a37:
+a38:
+a39:
+a40:
+a41:
+a42:
+a43:
+a44:
+a45:
+a46:
+a47:
+a48:
+a49:
+a50:
+a51:
+a52:
+a53:
+a54:
+a55:
+a56:
+a57:
+a58:
+a59:
+a60:
+a61:
+a62:
+a63:
+a64:
+a65:
+a66:
+a67:
+a68:
+a69:
+a70:
+a71:
+a72:
+a73:
+a74:
+a75:
+a76:
+a77:
+a78:
+a79:
+a80:
+a81:
+a82:
+a83:
+a84:
+a85:
+a86:
+a87:
+a88:
+a89:
+a90:
+a91:
+a92:
+a93:
+a94:
+a95:
+a96:
+a97:
+a98:
+a99:
+a100:
+a101:
+a102:
+a103:
+a104:
+a105:
+a106:
+a107:
+a108:
+a109:
+a110:
+a111:
+a112:
+a113:
+a114:
+a115:
+a116:
+a117:
+a118:
+a119:
+a120:
+a121:
+a122:
+a123:
+a124:
+a125:
+a126:
+a127:
+a128:
diff --git a/ld/testsuite/ld-mmix/undef-1.d b/ld/testsuite/ld-mmix/undef-1.d
new file mode 100644
index 0000000..fb8c7ee
--- /dev/null
+++ b/ld/testsuite/ld-mmix/undef-1.d
@@ -0,0 +1,4 @@
+#source: undef-1.s
+#source: start.s
+#ld: -m elf64mmix
+#error: undefined reference to `regvar'
diff --git a/ld/testsuite/ld-mmix/undef-1.s b/ld/testsuite/ld-mmix/undef-1.s
new file mode 100644
index 0000000..668cd15
--- /dev/null
+++ b/ld/testsuite/ld-mmix/undef-1.s
@@ -0,0 +1 @@
+ ADDU regvar,$8,$9
diff --git a/ld/testsuite/ld-mmix/undef-1m.d b/ld/testsuite/ld-mmix/undef-1m.d
new file mode 100644
index 0000000..001d7f6
--- /dev/null
+++ b/ld/testsuite/ld-mmix/undef-1m.d
@@ -0,0 +1,4 @@
+#source: undef-1.s
+#source: start.s
+#ld: -m mmo
+#error: undefined reference to `regvar'
diff --git a/ld/testsuite/ld-mmix/undef-2.d b/ld/testsuite/ld-mmix/undef-2.d
new file mode 100644
index 0000000..52844db
--- /dev/null
+++ b/ld/testsuite/ld-mmix/undef-2.d
@@ -0,0 +1,5 @@
+#source: undef-2.s
+#source: start.s
+#as: -x
+#ld: -m elf64mmix
+#error: undefined reference to `undefd'
diff --git a/ld/testsuite/ld-mmix/undef-2.s b/ld/testsuite/ld-mmix/undef-2.s
new file mode 100644
index 0000000..d912b15
--- /dev/null
+++ b/ld/testsuite/ld-mmix/undef-2.s
@@ -0,0 +1 @@
+ PUSHJ $5,undefd
diff --git a/ld/testsuite/ld-mmix/undef-2m.d b/ld/testsuite/ld-mmix/undef-2m.d
new file mode 100644
index 0000000..aa0becc
--- /dev/null
+++ b/ld/testsuite/ld-mmix/undef-2m.d
@@ -0,0 +1,5 @@
+#source: undef-2.s
+#source: start.s
+#as: -x
+#ld: -m mmo
+#error: undefined reference to `undefd'
diff --git a/ld/testsuite/ld-mmix/undef-3.d b/ld/testsuite/ld-mmix/undef-3.d
new file mode 100644
index 0000000..35ec2e6
--- /dev/null
+++ b/ld/testsuite/ld-mmix/undef-3.d
@@ -0,0 +1,46 @@
+#source: start.s
+#ld: -u undefd -m elf64mmix
+#readelf: -S -s
+
+There are 8 section headers, starting at offset 0xe8:
+
+Section Headers:
+ \[Nr\] Name Type Address Offset
+ Size EntSize Flags Link Info Align
+ \[ 0\] NULL 0+ 0+
+ 0+ 0+ 0 0 0
+ \[ 1\] \.text PROGBITS 0+ 0+b0
+ 0+4 0+ AX 0 0 4
+ \[ 2\] \.data PROGBITS 20+ 0+b4
+ 0+ 0+ WA 0 0 1
+ \[ 3\] \.sbss PROGBITS 2000000000000000 0+b4
+ 0+ 0+ W 0 0 1
+ \[ 4\] \.bss NOBITS 2000000000000000 0+b4
+ 0+ 0+ WA 0 0 1
+ \[ 5\] \.shstrtab STRTAB 0+ 0+b4
+ 0+32 0+ 0 0 1
+ \[ 6\] \.symtab SYMTAB 0+ 0+2e8
+ 0+150 0+18 7 8 8
+ \[ 7\] \.strtab STRTAB 0+ 0+438
+ 0+2f 0+ 0 0 1
+Key to Flags:
+ W \(write\), A \(alloc\), X \(execute\), M \(merge\), S \(strings\)
+ I \(info\), L \(link order\), G \(group\), x \(unknown\)
+ O \(extra OS processing required\) o \(OS specific\), p \(processor specific\)
+
+Symbol table '\.symtab' contains 14 entries:
+ Num: Value Size Type Bind Vis Ndx Name
+ 0: 0+ 0 NOTYPE LOCAL DEFAULT UND
+ 1: 0+ 0 SECTION LOCAL DEFAULT 1
+ 2: 2000000000000000 0 SECTION LOCAL DEFAULT 2
+ 3: 2000000000000000 0 SECTION LOCAL DEFAULT 3
+ 4: 2000000000000000 0 SECTION LOCAL DEFAULT 4
+ 5: 0+ 0 SECTION LOCAL DEFAULT 5
+ 6: 0+ 0 SECTION LOCAL DEFAULT 6
+ 7: 0+ 0 SECTION LOCAL DEFAULT 7
+ 8: 0+ 0 NOTYPE GLOBAL DEFAULT UND undefd
+ 9: 0+ 0 NOTYPE GLOBAL DEFAULT 1 _start
+ 10: 2000000000000000 0 OBJECT GLOBAL DEFAULT ABS __bss_start
+ 11: 2000000000000000 0 OBJECT GLOBAL DEFAULT ABS _edata
+ 12: 2000000000000000 0 OBJECT GLOBAL DEFAULT ABS _end
+ 13: 0+ 0 OBJECT GLOBAL DEFAULT 1 _start\.
diff --git a/ld/testsuite/ld-mmix/undef-3m.d b/ld/testsuite/ld-mmix/undef-3m.d
new file mode 100644
index 0000000..60752dc
--- /dev/null
+++ b/ld/testsuite/ld-mmix/undef-3m.d
@@ -0,0 +1,20 @@
+#source: start.s
+#ld: -m mmo -u undefd
+#objdump: -x
+
+.*: file format mmo
+.*
+architecture: mmix, flags 0x0+10:
+HAS_SYMS
+start address 0x0+
+
+Sections:
+Idx Name Size VMA LMA File off Algn
+ 0 \.text 0+4 0+ 0+ 0+ 2\*\*2
+ CONTENTS, ALLOC, LOAD, CODE
+SYMBOL TABLE:
+0+ g \.text Main
+0+ g \*UND\* undefd
+0+ g \.text _start
+
+
diff --git a/ld/testsuite/ld-mmix/x.s b/ld/testsuite/ld-mmix/x.s
new file mode 100644
index 0000000..faf4073
--- /dev/null
+++ b/ld/testsuite/ld-mmix/x.s
@@ -0,0 +1,26 @@
+;# Main file, x.s, with the program (_start) referring to two
+;# linkonce functions fn and fn2. The functions fn and fn2 are
+;# supposed to be equivalent of C++ template instantiations; the
+;# main file instantiates fn. There's the equivalent of an FDE
+;# entry in .eh_frame, referring to fn via a local label.
+
+ .text
+ .global _start
+_start:
+ .long fn
+ .long fn2
+
+ .section .gnu.linkonce.t.fn,"ax",@progbits
+ .weak fn
+ .type fn,@function
+fn:
+L:a:
+ .long 1
+ .long 2
+L:b:
+ .size fn,L:b-L:a
+
+ .section .eh_frame,"aw",@progbits
+ .long 2
+ .long L:a
+ .long L:b-L:a
diff --git a/ld/testsuite/ld-mmix/y.s b/ld/testsuite/ld-mmix/y.s
new file mode 100644
index 0000000..fcfcd35
--- /dev/null
+++ b/ld/testsuite/ld-mmix/y.s
@@ -0,0 +1,33 @@
+;# Library file y.s has linkonce entries for fn and fn2. Note
+;# that this version of fn has different code, as if compiled
+;# with different optimization flags than the one in x.s (not
+;# important for this test, though). The reference from
+;# .eh_frame to the linkonce-excluded fn2 must be zero, or g++
+;# EH will not work.
+
+ .section .gnu.linkonce.t.fn2,"ax",@progbits
+ .weak fn2
+ .type fn2,@function
+fn2:
+L:c:
+ .long 3
+L:d:
+ .size fn2,L:d-L:c
+
+ .section .gnu.linkonce.t.fn,"ax",@progbits
+ .weak fn
+ .type fn,@function
+fn:
+L:e:
+ .long 4
+L:f:
+ .size fn,L:f-L:e
+
+ .section .eh_frame,"aw",@progbits
+ .long 7
+ .long L:c
+ .long L:d-L:c
+
+ .long 0x6066
+ .long L:e
+ .long L:f-L:e
diff --git a/ld/testsuite/ld-mmix/zeroeh.ld b/ld/testsuite/ld-mmix/zeroeh.ld
new file mode 100644
index 0000000..6550c17
--- /dev/null
+++ b/ld/testsuite/ld-mmix/zeroeh.ld
@@ -0,0 +1,4 @@
+SECTIONS {
+ .text 0xa00 : { *(.text); *(.gnu.linkonce.t.*) }
+ .eh_frame 0x2000 : { *(.eh_frame) }
+}
diff --git a/ld/testsuite/ld-mmix/zeroehelf.d b/ld/testsuite/ld-mmix/zeroehelf.d
new file mode 100644
index 0000000..ba17314
--- /dev/null
+++ b/ld/testsuite/ld-mmix/zeroehelf.d
@@ -0,0 +1,17 @@
+#source: x.s
+#source: y.s
+#ld: -m elf64mmix -Ttext 0xa00 -T $srcdir/$subdir/zeroeh.ld
+#objdump: -s
+
+# The word at address 201c, for the linkonce-excluded section, must be zero.
+
+.*: file format elf64-mmix
+
+Contents of section \.text:
+ 0a00 00000a08 00000a10 00000001 00000002 .*
+ 0a10 00000003 .*
+Contents of section \.eh_frame:
+ 2000 00000002 00000a08 00000008 00000007 .*
+ 2010 00000a10 00000004 00006066 00000000 .*
+ 2020 00000004 .*
+#pass
diff --git a/ld/testsuite/ld-mmix/zeroehmmo.d b/ld/testsuite/ld-mmix/zeroehmmo.d
new file mode 100644
index 0000000..2c47ff1
--- /dev/null
+++ b/ld/testsuite/ld-mmix/zeroehmmo.d
@@ -0,0 +1,16 @@
+#source: x.s
+#source: y.s
+#ld: -m mmo -Ttext 0xa00 -T $srcdir/$subdir/zeroeh.ld
+#objdump: -s
+
+# The word at address 201c, for the linkonce-excluded section, must be zero.
+
+.*: file format mmo
+
+Contents of section \.text:
+ 0a00 00000a08 00000a10 00000001 00000002 .*
+ 0a10 00000003 .*
+Contents of section \.eh_frame:
+ 2000 00000002 00000a08 00000008 00000007 .*
+ 2010 00000a10 00000004 00006066 00000000 .*
+ 2020 00000004 .*