From 17a6716ad03a8b735c7b8afb36aa3b00665d6f34 Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Thu, 8 Jul 2004 15:43:00 +0000 Subject: [PATCH] * ld-mips-elf/reloc-merge-lo16.{s,d,ld}: New test. * ld-mips-elf/mips-elf.exp: Run it. --- ld/testsuite/ChangeLog | 5 ++++ ld/testsuite/ld-mips-elf/mips-elf.exp | 1 + ld/testsuite/ld-mips-elf/reloc-merge-lo16.d | 16 +++++++++++ ld/testsuite/ld-mips-elf/reloc-merge-lo16.ld | 9 +++++++ ld/testsuite/ld-mips-elf/reloc-merge-lo16.s | 28 ++++++++++++++++++++ 5 files changed, 59 insertions(+) create mode 100644 ld/testsuite/ld-mips-elf/reloc-merge-lo16.d create mode 100644 ld/testsuite/ld-mips-elf/reloc-merge-lo16.ld create mode 100644 ld/testsuite/ld-mips-elf/reloc-merge-lo16.s diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog index 8aa98f296e..4069b4b556 100644 --- a/ld/testsuite/ChangeLog +++ b/ld/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2004-07-08 Maciej W. Rozycki + + * ld-mips-elf/reloc-merge-lo16.{s,d,ld}: New test. + * ld-mips-elf/mips-elf.exp: Run it. + 2004-07-02 Kaz Kojima * ld-elf/frame.exp: Don't run on sh*-*-elf*. diff --git a/ld/testsuite/ld-mips-elf/mips-elf.exp b/ld/testsuite/ld-mips-elf/mips-elf.exp index 36fae9b642..f0c2b84aa0 100644 --- a/ld/testsuite/ld-mips-elf/mips-elf.exp +++ b/ld/testsuite/ld-mips-elf/mips-elf.exp @@ -74,3 +74,4 @@ if $has_newabi { } } run_dump_test "reloc-2" +run_dump_test "reloc-merge-lo16" diff --git a/ld/testsuite/ld-mips-elf/reloc-merge-lo16.d b/ld/testsuite/ld-mips-elf/reloc-merge-lo16.d new file mode 100644 index 0000000000..f6e7ef8230 --- /dev/null +++ b/ld/testsuite/ld-mips-elf/reloc-merge-lo16.d @@ -0,0 +1,16 @@ +#name: MIPS ELF lo16 merge +#source: reloc-merge-lo16.s +#ld: -Treloc-merge-lo16.ld +#objdump: -td --prefix-addresses --show-raw-insn + +# Test lo16 reloc calculation with string merging. + +.*: +file format .*mips.* +#... +0+80fe70 l .rodata 0+000000 g +0+400000 g F .text 0+000000 __start +#... +0+400000 <[^>]*> 3c020081 lui v0,0x81 +0+400004 <[^>]*> 2443fe70 addiu v1,v0,-400 +0+400008 <[^>]*> 2442fe70 addiu v0,v0,-400 + \.\.\. diff --git a/ld/testsuite/ld-mips-elf/reloc-merge-lo16.ld b/ld/testsuite/ld-mips-elf/reloc-merge-lo16.ld new file mode 100644 index 0000000000..4d487dd5fd --- /dev/null +++ b/ld/testsuite/ld-mips-elf/reloc-merge-lo16.ld @@ -0,0 +1,9 @@ +ENTRY(__start) +SECTIONS +{ + . = 0x0400000; + .text : { *(.text) } + . = 0x0800000; + .rodata : { *(.rodata.*) } + /DISCARD/ : { *(*) } +} diff --git a/ld/testsuite/ld-mips-elf/reloc-merge-lo16.s b/ld/testsuite/ld-mips-elf/reloc-merge-lo16.s new file mode 100644 index 0000000000..33158b12b7 --- /dev/null +++ b/ld/testsuite/ld-mips-elf/reloc-merge-lo16.s @@ -0,0 +1,28 @@ + .section .rodata.str1.4,"aMS", @progbits, 1 + .macro fillstr char + .rept 0x3fff - \char + .byte \char + .endr + .byte 0 + .endm + fillstr 'a' + fillstr 'h' + fillstr 'c' + fillstr 'd' + fillstr 'g' + fillstr 'f' +g: + fillstr 'g' + fillstr 'h' + + .text + .globl __start + .ent __start + .type __start, @function +__start: + lui $2, %hi(g) + addiu $3, $2, %lo(g) + addiu $2, $2, %lo(g) + .end __start + + .space 16