+2002-02-04 Hans-Peter Nilsson <hp@bitrange.com>
+
+ * gas/mmix/basep-8.d, gas/mmix/basep-9.s, gas/mmix/basep-9.d,
+ gas/mmix/err-bpo6.s, gas/mmix/basep-8.s, gas/mmix/basep-10.d,
+ gas/mmix/basep-10.s, gas/mmix/basep-11.s, gas/mmix/basep-11.d: New
+ tests for base-plus-offset relocations and global register
+ allocations for weak and common symbols.
+
2002-02-02 Alan Modra <amodra@bigpond.net.au>
* gas/elf/elf.exp: Don't special case v850.
--- /dev/null
+#as: -linker-allocated-gregs
+#objdump: -srt
+
+.*: file format elf64-mmix
+
+SYMBOL TABLE:
+0+ l d \.text 0+
+0+ l d \.data 0+
+0+ l d \.bss 0+
+0+4 l \.text 0+ w4
+0+10 l \.text 0+ w2
+0+ l d \.MMIX\.reg_contents 0+
+0+c w \.text 0+ w1
+0+8 w \.text 0+ w3
+
+
+RELOCATION RECORDS FOR \[\.text\]:
+OFFSET TYPE VALUE
+0+6 R_MMIX_BASE_PLUS_OFFSET w1
+0+a R_MMIX_REG \.MMIX\.reg_contents
+0+e R_MMIX_REG \.MMIX\.reg_contents\+0x0+8
+0+12 R_MMIX_REG \.MMIX\.reg_contents\+0x0+8
+
+RELOCATION RECORDS FOR \[\.MMIX\.reg_contents\]:
+OFFSET TYPE VALUE
+0+ R_MMIX_64 w3
+0+8 R_MMIX_64 \.text\+0x0+4
+
+Contents of section \.text:
+ 0000 fd000000 232a0000 232b0000 232c000c .*
+ 0010 232d0000 .*
+Contents of section \.data:
+Contents of section \.MMIX\.reg_contents:
+ 0000 00000000 00000000 00000000 00000000 .*
--- /dev/null
+# Test that we handle weak symbols with base-plus-offset relocs mixed with
+# GREG defs.
+ .weak w1
+ .weak w3
+ GREG w4
+ GREG w3
+ SWYM
+w4:
+ LDA $42,w1
+w3:
+ LDA $43,w3
+w1:
+ LDA $44,w2
+w2:
+ LDA $45,w4
+
--- /dev/null
+#as: -linker-allocated-gregs
+#objdump: -srt
+
+.*: file format elf64-mmix
+
+SYMBOL TABLE:
+0+ l d \.text 0+
+0+ l d \.data 0+
+0+ l d \.bss 0+
+0+4 l \.text 0+ w4
+0+10 l \.text 0+ w2
+0+c w \.text 0+ w1
+0+8 w \.text 0+ w3
+
+RELOCATION RECORDS FOR \[\.text\]:
+OFFSET TYPE VALUE
+0+6 R_MMIX_BASE_PLUS_OFFSET w1
+0+a R_MMIX_BASE_PLUS_OFFSET w3
+0+e R_MMIX_BASE_PLUS_OFFSET \.text\+0x0+10
+0+12 R_MMIX_BASE_PLUS_OFFSET \.text\+0x0+4
+
+Contents of section \.text:
+ 0000 fd000000 232a0000 232b0000 232c0000 .*
+ 0010 232d0000 .*
+Contents of section \.data:
--- /dev/null
+# Test that we handle weak symbols with base-plus-offset relocs.
+ .weak w1
+ .weak w3
+ SWYM
+w4:
+ LDA $42,w1
+w3:
+ LDA $43,w3
+w1:
+ LDA $44,w2
+w2:
+ LDA $45,w4
+
--- /dev/null
+#as: -linker-allocated-gregs
+#objdump: -drt
+
+# Since we don't merge BPO-relocs until linking with
+# -linker-allocated-gregs, we automatically correctly handle the two
+# seemingly neighboring comm-symbols that don't merge well at
+# assembly-time.
+
+.*: file format elf64-mmix
+
+SYMBOL TABLE:
+0+ l d \.text 0+
+0+ l d \.data 0+
+0+ l d \.bss 0+
+0+ l \.bss 0+4 comm_symbol3
+0+4 l \.bss 0+4 comm_symbol4
+0+4 O \*COM\* 0+4 comm_symbol1
+0+4 O \*COM\* 0+4 comm_symbol2
+
+Disassembly of section \.text:
+
+0+ <\.text>:
+ 0: 232a0000 addu \$42,\$0,0
+ 2: R_MMIX_BASE_PLUS_OFFSET comm_symbol1
+ 4: 232b0000 addu \$43,\$0,0
+ 6: R_MMIX_BASE_PLUS_OFFSET comm_symbol2
+ 8: 232c0000 addu \$44,\$0,0
+ a: R_MMIX_BASE_PLUS_OFFSET \.bss
+ c: 232d0000 addu \$45,\$0,0
+ e: R_MMIX_BASE_PLUS_OFFSET \.bss\+0x4
--- /dev/null
+# Test that we handle COMM-type symbols with base-plus-offset relocs.
+ .comm comm_symbol1,4,4
+ .lcomm comm_symbol3,4
+ LDA $42,comm_symbol1
+ LDA $43,comm_symbol2
+ LDA $44,comm_symbol3
+ LDA $45,comm_symbol4
+ .comm comm_symbol2,4,4
+ .lcomm comm_symbol4,4
--- /dev/null
+#objdump: -srt
+
+.*: file format elf64-mmix
+
+SYMBOL TABLE:
+0+ l d \.text 0+
+0+ l d \.data 0+
+0+ l d \.bss 0+
+0+ l \.bss 0+4 comm_symbol3
+0+4 l \.bss 0+4 comm_symbol4
+0+ l d \.MMIX\.reg_contents 0+
+0+4 O \*COM\* 0+4 comm_symbol1
+
+RELOCATION RECORDS FOR \[\.text\]:
+OFFSET TYPE VALUE
+0+2 R_MMIX_REG \.MMIX\.reg_contents\+0x0+8
+0+6 R_MMIX_REG \.MMIX\.reg_contents
+0+a R_MMIX_REG \.MMIX\.reg_contents
+
+RELOCATION RECORDS FOR \[\.MMIX\.reg_contents\]:
+OFFSET TYPE VALUE
+0+ R_MMIX_64 \.bss
+0+8 R_MMIX_64 comm_symbol1
+
+Contents of section \.text:
+ 0000 232a0000 232c0000 232d0004 .*
+Contents of section \.data:
+Contents of section \.MMIX\.reg_contents:
+ 0000 00000000 00000000 00000000 00000000 .*
--- /dev/null
+# Test that we handle COMM-type symbols with base-plus-offset relocs.
+ .comm comm_symbol1,4,4
+ .lcomm comm_symbol3,4
+ GREG comm_symbol1
+ GREG comm_symbol3
+ LDA $42,comm_symbol1
+ LDA $44,comm_symbol3
+ LDA $45,comm_symbol4
+ .lcomm comm_symbol4,4
--- /dev/null
+% { dg-do assemble { target mmix-*-* } }
+
+# Test that we handle COMM-type symbols with base-plus-offset relocs, but
+# that we don't merge ones that may be separately merged with other
+# symbols at link-time. Likewise for weak symbols.
+ .comm comm_symbol1,4,4
+ .lcomm comm_symbol3,4
+ GREG comm_symbol1
+ GREG comm_symbol3
+ GREG xx
+ .weak xx
+xx:
+ LDA $47,yy % { dg-error "no suitable GREG definition" "" }
+ LDA $46,xx
+ LDA $42,comm_symbol1
+ LDA $43,comm_symbol2 % { dg-error "no suitable GREG definition" "" }
+ LDA $44,comm_symbol3
+ LDA $45,comm_symbol4
+yy:
+ .comm comm_symbol2,4,4
+ .lcomm comm_symbol4,4