diff options
Diffstat (limited to 'ld/testsuite/ld-mips-elf')
-rw-r--r-- | ld/testsuite/ld-mips-elf/mips-elf.exp | 34 | ||||
-rw-r--r-- | ld/testsuite/ld-mips-elf/relax-offset-umips.dd | 15 | ||||
-rw-r--r-- | ld/testsuite/ld-mips-elf/relax-offset-umips.gd | 11 | ||||
-rw-r--r-- | ld/testsuite/ld-mips-elf/relax-offset.dd | 19 | ||||
-rw-r--r-- | ld/testsuite/ld-mips-elf/relax-offset.gd | 11 | ||||
-rw-r--r-- | ld/testsuite/ld-mips-elf/relax-offset.ld | 16 |
6 files changed, 106 insertions, 0 deletions
diff --git a/ld/testsuite/ld-mips-elf/mips-elf.exp b/ld/testsuite/ld-mips-elf/mips-elf.exp index 66b2ae4..4360b83 100644 --- a/ld/testsuite/ld-mips-elf/mips-elf.exp +++ b/ld/testsuite/ld-mips-elf/mips-elf.exp @@ -1179,3 +1179,37 @@ run_ld_link_tests [list \ # Check that the ISA level is consistently II for the LSI 4010. run_dump_test "lsi-4010-isa" [list [list ld $abi_ldflags(o32)]] + +# PIC branch relaxation with offset tests. We need to use our version +# of `prune_warnings' to get rid of GAS branch relaxation noise. +rename prune_warnings mips_old_prune_warnings +proc prune_warnings { msg } { + set msg1 "Assembler messages:" + set msg2 "Warning: relaxed out-of-range branch into a jump" + set msgx "(?:$msg1|$msg2)" + regsub -all "(^|\[\n\r\]*)\[^\n\r\]*: $msgx\[\n\r\]*" $msg "\\1" msg + return [mips_old_prune_warnings $msg] +} +run_ld_link_tests [list \ + [list \ + "MIPS link PIC branch relaxation with offset" \ + "$abi_ldflags(o32) -shared -T relax-offset.ld" "" \ + "$abi_asflags(o32) -relax-branch -mips2" \ + {../../../gas/testsuite/gas/mips/relax-offset.s} \ + {{objdump \ + {-d --prefix-addresses --show-raw-insn} \ + relax-offset.dd} \ + {readelf -A relax-offset.gd}} \ + "relax-offset"] \ + [list \ + "microMIPS link PIC branch relaxation with offset" \ + "$abi_ldflags(o32) -shared -T relax-offset.ld" "" \ + "$abi_asflags(o32) -relax-branch -mmicromips" \ + {../../../gas/testsuite/gas/mips/relax-offset.s} \ + {{objdump \ + {-d --prefix-addresses --show-raw-insn} \ + relax-offset-umips.dd} \ + {readelf -A relax-offset-umips.gd}} \ + "relax-offset-umips"]] +rename prune_warnings "" +rename mips_old_prune_warnings prune_warnings diff --git a/ld/testsuite/ld-mips-elf/relax-offset-umips.dd b/ld/testsuite/ld-mips-elf/relax-offset-umips.dd new file mode 100644 index 0000000..8e23931 --- /dev/null +++ b/ld/testsuite/ld-mips-elf/relax-offset-umips.dd @@ -0,0 +1,15 @@ +.*: +file format .*mips.* + +Disassembly of section \.text: +00000000 <.*> 41bc 0003 lui gp,0x3 +00000004 <.*> 339c 802f addiu gp,gp,-32721 +00000008 <.*> 033c e150 addu gp,gp,t9 +0000000c <.*> 40a4 0005 bnezc a0,0000001a <.*> +00000010 <.*> fc3c 8018 lw at,-32744\(gp\) +00000014 <.*> 3021 0025 addiu at,at,37 +00000018 <.*> 45a1 jrc at +0000001a <.*> 45bf jrc ra + \.\.\. +00020020 <.*> 0000 8b7c syscall +00020024 <.*> 45bf jrc ra + \.\.\. diff --git a/ld/testsuite/ld-mips-elf/relax-offset-umips.gd b/ld/testsuite/ld-mips-elf/relax-offset-umips.gd new file mode 100644 index 0000000..119667f --- /dev/null +++ b/ld/testsuite/ld-mips-elf/relax-offset-umips.gd @@ -0,0 +1,11 @@ +Primary GOT: + Canonical gp value: 00028030 + + Reserved entries: + Address Access Initial Purpose + 00020040 -32752\(gp\) 00000000 Lazy resolver + 00020044 -32748\(gp\) 80000000 Module pointer \(GNU extension\) + + Local entries: + Address Access Initial + 00020048 -32744\(gp\) 00020000 diff --git a/ld/testsuite/ld-mips-elf/relax-offset.dd b/ld/testsuite/ld-mips-elf/relax-offset.dd new file mode 100644 index 0000000..322a0c9 --- /dev/null +++ b/ld/testsuite/ld-mips-elf/relax-offset.dd @@ -0,0 +1,19 @@ +.*: +file format .*mips.* + +Disassembly of section \.text: +00000000 <.*> 3c1c0003 lui gp,0x3 +00000004 <.*> 279c8040 addiu gp,gp,-32704 +00000008 <.*> 0399e021 addu gp,gp,t9 +0000000c <.*> 14800004 bnez a0,00000020 <.*> +00000010 <.*> 00000000 nop +00000014 <.*> 8f818018 lw at,-32744\(gp\) +00000018 <.*> 24210034 addiu at,at,52 +0000001c <.*> 00200008 jr at +00000020 <.*> 00000000 nop +00000024 <.*> 03e00008 jr ra +00000028 <.*> 00000000 nop + \.\.\. +00020030 <.*> 0000000c syscall +00020034 <.*> 03e00008 jr ra +00020038 <.*> 00000000 nop + \.\.\. diff --git a/ld/testsuite/ld-mips-elf/relax-offset.gd b/ld/testsuite/ld-mips-elf/relax-offset.gd new file mode 100644 index 0000000..41f4af9 --- /dev/null +++ b/ld/testsuite/ld-mips-elf/relax-offset.gd @@ -0,0 +1,11 @@ +Primary GOT: + Canonical gp value: 00028040 + + Reserved entries: + Address Access Initial Purpose + 00020050 -32752\(gp\) 00000000 Lazy resolver + 00020054 -32748\(gp\) 80000000 Module pointer \(GNU extension\) + + Local entries: + Address Access Initial + 00020058 -32744\(gp\) 00020000 diff --git a/ld/testsuite/ld-mips-elf/relax-offset.ld b/ld/testsuite/ld-mips-elf/relax-offset.ld new file mode 100644 index 0000000..39f6367 --- /dev/null +++ b/ld/testsuite/ld-mips-elf/relax-offset.ld @@ -0,0 +1,16 @@ +ENTRY (foo); +SECTIONS +{ + .text : { *(.text) } + HIDDEN (_gp = ALIGN(16) + 0x7ff0); + .got : { *(.got) } + .dynamic : { *(.dynamic) } + .hash : { *(.hash) } + .dynsym : { *(.dynsym) } + .dynstr : { *(.dynstr) } + .pdr : { *(.pdr) } + .shstrtab : { *(.shstrtab) } + .symtab : { *(.symtab) } + .strtab : { *(.strtab) } + /DISCARD/ : { *(*) } +} |