From 71e26daa02e32c957fe29d463018ca8d72ea6ba9 Mon Sep 17 00:00:00 2001 From: cgd Date: Wed, 2 Jan 2002 18:59:30 +0000 Subject: [PATCH] 2002-01-02 Chris Demetriou * ld-mips-elf/empic1-ln.d: New file to test basic linking of R_MIPS_GNU_REL_HI16 and R_MIPS_GNU_REL_LO16 relocations. * ld-mips-elf/empic1-lp.d: Likewise. * ld-mips-elf/empic1-mn.d: Likewise. * ld-mips-elf/empic1-mp.d: Likewise. * ld-mips-elf/empic1-sn.d: Likewise. * ld-mips-elf/empic1-sp.d: Likewise. * ld-mips-elf/empic1-ref.s: Likewise. * ld-mips-elf/empic1-space.s: Likewise. * ld-mips-elf/empic1-tgt.s: Likewise. * ld-mips-elf/empic2-fwd-0.d: New file to test R_MIPS_GNU_REL_HI16 and R_MIPS_GNU_REL_LO16 relocation edge cases. * ld-mips-elf/empic2-fwd-1.d: Likewise. * ld-mips-elf/empic2-rev-0.d: Likewise. * ld-mips-elf/empic2-rev-1.d: Likewise. * ld-mips-elf/empic2-ref.s: Likewise. * ld-mips-elf/empic2-space.s: Likewise. * ld-mips-elf/empic2-fwd-tgt.s: Likewise. * ld-mips-elf/empic2-rev-tgt.s: Likewise. * ld-mips-elf/mips-elf.exp: New file to run MIPS 32-bit ELF tests (including those above). --- gas/testsuite/ChangeLog | 11 ++++++++ gas/testsuite/gas/mips/empic3_e.d | 47 +++++++++++++++++++++++++++++++ gas/testsuite/gas/mips/empic3_e.s | 46 ++++++++++++++++++++++++++++++ gas/testsuite/gas/mips/empic3_g1.d | 47 +++++++++++++++++++++++++++++++ gas/testsuite/gas/mips/empic3_g1.s | 46 ++++++++++++++++++++++++++++++ gas/testsuite/gas/mips/empic3_g2.d | 47 +++++++++++++++++++++++++++++++ gas/testsuite/gas/mips/empic3_g2.s | 46 ++++++++++++++++++++++++++++++ gas/testsuite/gas/mips/mips.exp | 3 ++ ld/testsuite/ChangeLog | 25 ++++++++++++++++ ld/testsuite/ld-mips-elf/empic1-ln.d | 27 ++++++++++++++++++ ld/testsuite/ld-mips-elf/empic1-lp.d | 26 +++++++++++++++++ ld/testsuite/ld-mips-elf/empic1-mn.d | 25 ++++++++++++++++ ld/testsuite/ld-mips-elf/empic1-mp.d | 25 ++++++++++++++++ ld/testsuite/ld-mips-elf/empic1-ref.s | 9 ++++++ ld/testsuite/ld-mips-elf/empic1-sn.d | 23 +++++++++++++++ ld/testsuite/ld-mips-elf/empic1-sp.d | 23 +++++++++++++++ ld/testsuite/ld-mips-elf/empic1-space.s | 5 ++++ ld/testsuite/ld-mips-elf/empic1-tgt.s | 8 ++++++ ld/testsuite/ld-mips-elf/empic2-fwd-0.d | 20 +++++++++++++ ld/testsuite/ld-mips-elf/empic2-fwd-1.d | 21 ++++++++++++++ ld/testsuite/ld-mips-elf/empic2-fwd-tgt.s | 7 +++++ ld/testsuite/ld-mips-elf/empic2-ref.s | 6 ++++ ld/testsuite/ld-mips-elf/empic2-rev-0.d | 22 +++++++++++++++ ld/testsuite/ld-mips-elf/empic2-rev-1.d | 24 ++++++++++++++++ ld/testsuite/ld-mips-elf/empic2-rev-tgt.s | 8 ++++++ ld/testsuite/ld-mips-elf/empic2-space.s | 5 ++++ ld/testsuite/ld-mips-elf/mips-elf.exp | 38 +++++++++++++++++++++++++ 27 files changed, 640 insertions(+) create mode 100644 gas/testsuite/gas/mips/empic3_e.d create mode 100644 gas/testsuite/gas/mips/empic3_e.s create mode 100644 gas/testsuite/gas/mips/empic3_g1.d create mode 100644 gas/testsuite/gas/mips/empic3_g1.s create mode 100644 gas/testsuite/gas/mips/empic3_g2.d create mode 100644 gas/testsuite/gas/mips/empic3_g2.s create mode 100644 ld/testsuite/ld-mips-elf/empic1-ln.d create mode 100644 ld/testsuite/ld-mips-elf/empic1-lp.d create mode 100644 ld/testsuite/ld-mips-elf/empic1-mn.d create mode 100644 ld/testsuite/ld-mips-elf/empic1-mp.d create mode 100644 ld/testsuite/ld-mips-elf/empic1-ref.s create mode 100644 ld/testsuite/ld-mips-elf/empic1-sn.d create mode 100644 ld/testsuite/ld-mips-elf/empic1-sp.d create mode 100644 ld/testsuite/ld-mips-elf/empic1-space.s create mode 100644 ld/testsuite/ld-mips-elf/empic1-tgt.s create mode 100644 ld/testsuite/ld-mips-elf/empic2-fwd-0.d create mode 100644 ld/testsuite/ld-mips-elf/empic2-fwd-1.d create mode 100644 ld/testsuite/ld-mips-elf/empic2-fwd-tgt.s create mode 100644 ld/testsuite/ld-mips-elf/empic2-ref.s create mode 100644 ld/testsuite/ld-mips-elf/empic2-rev-0.d create mode 100644 ld/testsuite/ld-mips-elf/empic2-rev-1.d create mode 100644 ld/testsuite/ld-mips-elf/empic2-rev-tgt.s create mode 100644 ld/testsuite/ld-mips-elf/empic2-space.s create mode 100644 ld/testsuite/ld-mips-elf/mips-elf.exp diff --git a/gas/testsuite/ChangeLog b/gas/testsuite/ChangeLog index daa30510a7..7fdf423a73 100644 --- a/gas/testsuite/ChangeLog +++ b/gas/testsuite/ChangeLog @@ -1,3 +1,14 @@ +2002-01-02 Chris Demetriou + + * gas/mips/empic3_e.d: New file to test -membedded-pic + R_MIPS_GNU_REL_HI16 and R_MIPS_GNU_REL_LO16 relocations. + * gas/mips/empic3_e.s: Likewise. + * gas/mips/empic3_g1.d: Likewise. + * gas/mips/empic3_g1.s: Likewise. + * gas/mips/empic3_g2.d: Likewise. + * gas/mips/empic3_g2.s: Likewise. + * gas/mips/mips.exp: Run the new tests. + 2001-12-21 Anders Norlander * gas/all/incbin.dat: New [binary] file. diff --git a/gas/testsuite/gas/mips/empic3_e.d b/gas/testsuite/gas/mips/empic3_e.d new file mode 100644 index 0000000000..24ec944ab2 --- /dev/null +++ b/gas/testsuite/gas/mips/empic3_e.d @@ -0,0 +1,47 @@ +#objdump: --prefix-addresses -dr --show-raw-insn -mmips:4000 +#name: MIPS empic3 (external) +#as: -membedded-pic -mips3 + +# Check PC-relative HI/LO relocs relocs for -membedded-pic when HI and +# LO are split over a 32K boundary. + +.*: +file format elf.*mips.* + +Disassembly of section .text: + ... + ... +0000fffc <[^>]*> 3c020001 lui v0,0x1 +[ ]*fffc: R_MIPS_GNU_REL_HI16 ext +00010000 <[^>]*> 64428000 daddiu v0,v0,-32768 +[ ]*10000: R_MIPS_GNU_REL_LO16 ext + ... +00017ffc <[^>]*> 3c020001 lui v0,0x1 +[ ]*17ffc: R_MIPS_GNU_REL_HI16 ext +00018000 <[^>]*> 64420000 daddiu v0,v0,0 +[ ]*18000: R_MIPS_GNU_REL_LO16 ext + ... +0001fffc <[^>]*> 3c020002 lui v0,0x2 +[ ]*1fffc: R_MIPS_GNU_REL_HI16 ext +00020000 <[^>]*> 0043102d daddu v0,v0,v1 +00020004 <[^>]*> 64428004 daddiu v0,v0,-32764 +[ ]*20004: R_MIPS_GNU_REL_LO16 ext + ... +00027ffc <[^>]*> 3c020002 lui v0,0x2 +[ ]*27ffc: R_MIPS_GNU_REL_HI16 ext +00028000 <[^>]*> 0043102d daddu v0,v0,v1 +00028004 <[^>]*> 64420004 daddiu v0,v0,4 +[ ]*28004: R_MIPS_GNU_REL_LO16 ext + ... +0002fff8 <[^>]*> 3c020003 lui v0,0x3 +[ ]*2fff8: R_MIPS_GNU_REL_HI16 ext +0002fffc <[^>]*> 0043102d daddu v0,v0,v1 +00030000 <[^>]*> 64428000 daddiu v0,v0,-32768 +[ ]*30000: R_MIPS_GNU_REL_LO16 ext + ... +00037ff8 <[^>]*> 3c020003 lui v0,0x3 +[ ]*37ff8: R_MIPS_GNU_REL_HI16 ext +00037ffc <[^>]*> 0043102d daddu v0,v0,v1 +00038000 <[^>]*> 64420000 daddiu v0,v0,0 +[ ]*38000: R_MIPS_GNU_REL_LO16 ext + ... + ... diff --git a/gas/testsuite/gas/mips/empic3_e.s b/gas/testsuite/gas/mips/empic3_e.s new file mode 100644 index 0000000000..7a8d21aa2a --- /dev/null +++ b/gas/testsuite/gas/mips/empic3_e.s @@ -0,0 +1,46 @@ +# Check PC-relative HI/LO relocs relocs for -membedded-pic when HI and +# LO are split over a 32K boundary. + + .text + .set noreorder + + SYM_TO_TEST = ext + + .globl ext + + .org 0x00000 + .globl g1 +g1: +l1: + + .org 0x08000 + .globl fn + .ent fn +fn: + .org (0x10000 - 4) + la $2, SYM_TO_TEST - fn # expands to 2 instructions + + .org (0x18000 - 4) + la $2, SYM_TO_TEST - fn # expands to 2 instructions + + .org (0x20000 - 4) + la $2, (SYM_TO_TEST - fn)($3) # expands to 3 instructions + + .org (0x28000 - 4) + la $2, (SYM_TO_TEST - fn)($3) # expands to 3 instructions + + .org (0x30000 - 8) + la $2, (SYM_TO_TEST - fn)($3) # expands to 3 instructions + + .org (0x38000 - 8) + la $2, (SYM_TO_TEST - fn)($3) # expands to 3 instructions + + .end fn + + .org 0x40000 + .globl g2 +g2: +l2: + +# Force at least 8 (non-delay-slot) zero bytes, to make 'objdump' print ... + .space 8 diff --git a/gas/testsuite/gas/mips/empic3_g1.d b/gas/testsuite/gas/mips/empic3_g1.d new file mode 100644 index 0000000000..3e0f5baa32 --- /dev/null +++ b/gas/testsuite/gas/mips/empic3_g1.d @@ -0,0 +1,47 @@ +#objdump: --prefix-addresses -dr --show-raw-insn -mmips:4000 +#name: MIPS empic3 (global, negative) +#as: -membedded-pic -mips3 + +# Check PC-relative HI/LO relocs relocs for -membedded-pic when HI and +# LO are split over a 32K boundary. + +.*: +file format elf.*mips.* + +Disassembly of section .text: + ... + ... +0000fffc <[^>]*> 3c020001 lui v0,0x1 +[ ]*fffc: R_MIPS_GNU_REL_HI16 .text +00010000 <[^>]*> 64428000 daddiu v0,v0,-32768 +[ ]*10000: R_MIPS_GNU_REL_LO16 .text + ... +00017ffc <[^>]*> 3c020001 lui v0,0x1 +[ ]*17ffc: R_MIPS_GNU_REL_HI16 .text +00018000 <[^>]*> 64420000 daddiu v0,v0,0 +[ ]*18000: R_MIPS_GNU_REL_LO16 .text + ... +0001fffc <[^>]*> 3c020002 lui v0,0x2 +[ ]*1fffc: R_MIPS_GNU_REL_HI16 .text +00020000 <[^>]*> 0043102d daddu v0,v0,v1 +00020004 <[^>]*> 64428004 daddiu v0,v0,-32764 +[ ]*20004: R_MIPS_GNU_REL_LO16 .text + ... +00027ffc <[^>]*> 3c020002 lui v0,0x2 +[ ]*27ffc: R_MIPS_GNU_REL_HI16 .text +00028000 <[^>]*> 0043102d daddu v0,v0,v1 +00028004 <[^>]*> 64420004 daddiu v0,v0,4 +[ ]*28004: R_MIPS_GNU_REL_LO16 .text + ... +0002fff8 <[^>]*> 3c020003 lui v0,0x3 +[ ]*2fff8: R_MIPS_GNU_REL_HI16 .text +0002fffc <[^>]*> 0043102d daddu v0,v0,v1 +00030000 <[^>]*> 64428000 daddiu v0,v0,-32768 +[ ]*30000: R_MIPS_GNU_REL_LO16 .text + ... +00037ff8 <[^>]*> 3c020003 lui v0,0x3 +[ ]*37ff8: R_MIPS_GNU_REL_HI16 .text +00037ffc <[^>]*> 0043102d daddu v0,v0,v1 +00038000 <[^>]*> 64420000 daddiu v0,v0,0 +[ ]*38000: R_MIPS_GNU_REL_LO16 .text + ... + ... diff --git a/gas/testsuite/gas/mips/empic3_g1.s b/gas/testsuite/gas/mips/empic3_g1.s new file mode 100644 index 0000000000..cf1df44a8c --- /dev/null +++ b/gas/testsuite/gas/mips/empic3_g1.s @@ -0,0 +1,46 @@ +# Check PC-relative HI/LO relocs relocs for -membedded-pic when HI and +# LO are split over a 32K boundary. + + .text + .set noreorder + + SYM_TO_TEST = g1 + + .globl ext + + .org 0x00000 + .globl g1 +g1: +l1: + + .org 0x08000 + .globl fn + .ent fn +fn: + .org (0x10000 - 4) + la $2, SYM_TO_TEST - fn # expands to 2 instructions + + .org (0x18000 - 4) + la $2, SYM_TO_TEST - fn # expands to 2 instructions + + .org (0x20000 - 4) + la $2, (SYM_TO_TEST - fn)($3) # expands to 3 instructions + + .org (0x28000 - 4) + la $2, (SYM_TO_TEST - fn)($3) # expands to 3 instructions + + .org (0x30000 - 8) + la $2, (SYM_TO_TEST - fn)($3) # expands to 3 instructions + + .org (0x38000 - 8) + la $2, (SYM_TO_TEST - fn)($3) # expands to 3 instructions + + .end fn + + .org 0x40000 + .globl g2 +g2: +l2: + +# Force at least 8 (non-delay-slot) zero bytes, to make 'objdump' print ... + .space 8 diff --git a/gas/testsuite/gas/mips/empic3_g2.d b/gas/testsuite/gas/mips/empic3_g2.d new file mode 100644 index 0000000000..2a6a452f9c --- /dev/null +++ b/gas/testsuite/gas/mips/empic3_g2.d @@ -0,0 +1,47 @@ +#objdump: --prefix-addresses -dr --show-raw-insn -mmips:4000 +#name: MIPS empic3 (global, positive) +#as: -membedded-pic -mips3 + +# Check PC-relative HI/LO relocs relocs for -membedded-pic when HI and +# LO are split over a 32K boundary. + +.*: +file format elf.*mips.* + +Disassembly of section .text: + ... + ... +0000fffc <[^>]*> 3c020005 lui v0,0x5 +[ ]*fffc: R_MIPS_GNU_REL_HI16 .text +00010000 <[^>]*> 64428000 daddiu v0,v0,-32768 +[ ]*10000: R_MIPS_GNU_REL_LO16 .text + ... +00017ffc <[^>]*> 3c020005 lui v0,0x5 +[ ]*17ffc: R_MIPS_GNU_REL_HI16 .text +00018000 <[^>]*> 64420000 daddiu v0,v0,0 +[ ]*18000: R_MIPS_GNU_REL_LO16 .text + ... +0001fffc <[^>]*> 3c020006 lui v0,0x6 +[ ]*1fffc: R_MIPS_GNU_REL_HI16 .text +00020000 <[^>]*> 0043102d daddu v0,v0,v1 +00020004 <[^>]*> 64428004 daddiu v0,v0,-32764 +[ ]*20004: R_MIPS_GNU_REL_LO16 .text + ... +00027ffc <[^>]*> 3c020006 lui v0,0x6 +[ ]*27ffc: R_MIPS_GNU_REL_HI16 .text +00028000 <[^>]*> 0043102d daddu v0,v0,v1 +00028004 <[^>]*> 64420004 daddiu v0,v0,4 +[ ]*28004: R_MIPS_GNU_REL_LO16 .text + ... +0002fff8 <[^>]*> 3c020007 lui v0,0x7 +[ ]*2fff8: R_MIPS_GNU_REL_HI16 .text +0002fffc <[^>]*> 0043102d daddu v0,v0,v1 +00030000 <[^>]*> 64428000 daddiu v0,v0,-32768 +[ ]*30000: R_MIPS_GNU_REL_LO16 .text + ... +00037ff8 <[^>]*> 3c020007 lui v0,0x7 +[ ]*37ff8: R_MIPS_GNU_REL_HI16 .text +00037ffc <[^>]*> 0043102d daddu v0,v0,v1 +00038000 <[^>]*> 64420000 daddiu v0,v0,0 +[ ]*38000: R_MIPS_GNU_REL_LO16 .text + ... + ... diff --git a/gas/testsuite/gas/mips/empic3_g2.s b/gas/testsuite/gas/mips/empic3_g2.s new file mode 100644 index 0000000000..4c070ee04a --- /dev/null +++ b/gas/testsuite/gas/mips/empic3_g2.s @@ -0,0 +1,46 @@ +# Check PC-relative HI/LO relocs relocs for -membedded-pic when HI and +# LO are split over a 32K boundary. + + .text + .set noreorder + + SYM_TO_TEST = g2 + + .globl ext + + .org 0x00000 + .globl g1 +g1: +l1: + + .org 0x08000 + .globl fn + .ent fn +fn: + .org (0x10000 - 4) + la $2, SYM_TO_TEST - fn # expands to 2 instructions + + .org (0x18000 - 4) + la $2, SYM_TO_TEST - fn # expands to 2 instructions + + .org (0x20000 - 4) + la $2, (SYM_TO_TEST - fn)($3) # expands to 3 instructions + + .org (0x28000 - 4) + la $2, (SYM_TO_TEST - fn)($3) # expands to 3 instructions + + .org (0x30000 - 8) + la $2, (SYM_TO_TEST - fn)($3) # expands to 3 instructions + + .org (0x38000 - 8) + la $2, (SYM_TO_TEST - fn)($3) # expands to 3 instructions + + .end fn + + .org 0x40000 + .globl g2 +g2: +l2: + +# Force at least 8 (non-delay-slot) zero bytes, to make 'objdump' print ... + .space 8 diff --git a/gas/testsuite/gas/mips/mips.exp b/gas/testsuite/gas/mips/mips.exp index 8c3621618c..f5cccc1ac7 100644 --- a/gas/testsuite/gas/mips/mips.exp +++ b/gas/testsuite/gas/mips/mips.exp @@ -163,6 +163,9 @@ if { [istarget mips*-*-*] } then { run_dump_test "elf-rel5" run_dump_test "${tmips}${el}empic" run_dump_test "empic2" + run_dump_test "empic3_e" + run_dump_test "empic3_g1" + run_dump_test "empic3_g2" if { !$no_mips16 } { run_dump_test "${tmips}mips${el}16-e" run_dump_test "${tmips}mips${el}16-f" diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog index 42a495e81f..17f8157945 100644 --- a/ld/testsuite/ChangeLog +++ b/ld/testsuite/ChangeLog @@ -1,3 +1,28 @@ +2002-01-02 Chris Demetriou + + * ld-mips-elf/empic1-ln.d: New file to test basic linking of + R_MIPS_GNU_REL_HI16 and R_MIPS_GNU_REL_LO16 relocations. + * ld-mips-elf/empic1-lp.d: Likewise. + * ld-mips-elf/empic1-mn.d: Likewise. + * ld-mips-elf/empic1-mp.d: Likewise. + * ld-mips-elf/empic1-sn.d: Likewise. + * ld-mips-elf/empic1-sp.d: Likewise. + * ld-mips-elf/empic1-ref.s: Likewise. + * ld-mips-elf/empic1-space.s: Likewise. + * ld-mips-elf/empic1-tgt.s: Likewise. + * ld-mips-elf/empic2-fwd-0.d: New file to test + R_MIPS_GNU_REL_HI16 and R_MIPS_GNU_REL_LO16 relocation edge + cases. + * ld-mips-elf/empic2-fwd-1.d: Likewise. + * ld-mips-elf/empic2-rev-0.d: Likewise. + * ld-mips-elf/empic2-rev-1.d: Likewise. + * ld-mips-elf/empic2-ref.s: Likewise. + * ld-mips-elf/empic2-space.s: Likewise. + * ld-mips-elf/empic2-fwd-tgt.s: Likewise. + * ld-mips-elf/empic2-rev-tgt.s: Likewise. + * ld-mips-elf/mips-elf.exp: New file to run MIPS 32-bit ELF + tests (including those above). + 2001-11-30 H.J. Lu * ld-elfvers/vers.exp (build_vers_lib): Preserve the library diff --git a/ld/testsuite/ld-mips-elf/empic1-ln.d b/ld/testsuite/ld-mips-elf/empic1-ln.d new file mode 100644 index 0000000000..eb784786d2 --- /dev/null +++ b/ld/testsuite/ld-mips-elf/empic1-ln.d @@ -0,0 +1,27 @@ +#name: MIPS 32-bit ELF embedded-pic relocs #1-ln (large negative) +#as: -membedded-pic -mips3 +#source: empic1-tgt.s +#source: empic1-space.s +#source: empic1-space.s +#source: empic1-ref.s +#objdump: --prefix-addresses -tdr --show-raw-insn -mmips:4000 +#ld: -Ttext 0x400000 -e 0x400000 + +.*: file format elf.*mips.* + +SYMBOL TABLE: +#... +0+410020 g F .text [0-9a-f]+ foo +#... +0+400000 g F .text [0-9a-f]+ bar +#... + +Disassembly of section \.text: + ... + ... + ... +0+410020 <[^>]*> 00000000 nop +0+410024 <[^>]*> 3c02ffff lui v0,0xffff +0+410028 <[^>]*> 6442ffe0 daddiu v0,v0,-32 + ... +#pass diff --git a/ld/testsuite/ld-mips-elf/empic1-lp.d b/ld/testsuite/ld-mips-elf/empic1-lp.d new file mode 100644 index 0000000000..bd11e525b6 --- /dev/null +++ b/ld/testsuite/ld-mips-elf/empic1-lp.d @@ -0,0 +1,26 @@ +#name: MIPS 32-bit ELF embedded-pic relocs #1-lp (large positive) +#as: -membedded-pic -mips3 +#source: empic1-ref.s +#source: empic1-space.s +#source: empic1-space.s +#source: empic1-tgt.s +#objdump: --prefix-addresses -tdr --show-raw-insn -mmips:4000 +#ld: -Ttext 0x400000 -e 0x400000 + +.*: file format elf.*mips.* + +SYMBOL TABLE: +#... +0+400000 g F .text [0-9a-f]+ foo +#... +0+410020 g F .text [0-9a-f]+ bar +#... + +Disassembly of section \.text: +0+400000 <[^>]*> 00000000 nop +0+400004 <[^>]*> 3c020001 lui v0,0x1 +0+400008 <[^>]*> 64420020 daddiu v0,v0,32 + ... + ... + ... +#pass diff --git a/ld/testsuite/ld-mips-elf/empic1-mn.d b/ld/testsuite/ld-mips-elf/empic1-mn.d new file mode 100644 index 0000000000..fa43abf27d --- /dev/null +++ b/ld/testsuite/ld-mips-elf/empic1-mn.d @@ -0,0 +1,25 @@ +#name: MIPS 32-bit ELF embedded-pic relocs #1-mn (medium negative) +#as: -membedded-pic -mips3 +#source: empic1-tgt.s +#source: empic1-space.s +#source: empic1-ref.s +#objdump: --prefix-addresses -tdr --show-raw-insn -mmips:4000 +#ld: -Ttext 0x400000 -e 0x400000 + +.*: file format elf.*mips.* + +SYMBOL TABLE: +#... +0+408020 g F .text [0-9a-f]+ foo +#... +0+400000 g F .text [0-9a-f]+ bar +#... + +Disassembly of section \.text: + ... + ... +0+408020 <[^>]*> 00000000 nop +0+408024 <[^>]*> 3c02ffff lui v0,0xffff +0+408028 <[^>]*> 64427fe0 daddiu v0,v0,32736 + ... +#pass diff --git a/ld/testsuite/ld-mips-elf/empic1-mp.d b/ld/testsuite/ld-mips-elf/empic1-mp.d new file mode 100644 index 0000000000..27d157477f --- /dev/null +++ b/ld/testsuite/ld-mips-elf/empic1-mp.d @@ -0,0 +1,25 @@ +#name: MIPS 32-bit ELF embedded-pic relocs #1-mp (medium positive) +#as: -membedded-pic -mips3 +#source: empic1-ref.s +#source: empic1-space.s +#source: empic1-tgt.s +#objdump: --prefix-addresses -tdr --show-raw-insn -mmips:4000 +#ld: -Ttext 0x400000 -e 0x400000 + +.*: file format elf.*mips.* + +SYMBOL TABLE: +#... +0+400000 g F .text [0-9a-f]+ foo +#... +0+408020 g F .text [0-9a-f]+ bar +#... + +Disassembly of section \.text: +0+400000 <[^>]*> 00000000 nop +0+400004 <[^>]*> 3c020001 lui v0,0x1 +0+400008 <[^>]*> 64428020 daddiu v0,v0,-32736 + ... + ... + ... +#pass diff --git a/ld/testsuite/ld-mips-elf/empic1-ref.s b/ld/testsuite/ld-mips-elf/empic1-ref.s new file mode 100644 index 0000000000..dfa345e6ba --- /dev/null +++ b/ld/testsuite/ld-mips-elf/empic1-ref.s @@ -0,0 +1,9 @@ + + .globl foo + .ent foo +foo: + nop + la $2, bar - foo + .end foo + + .p2align 5 diff --git a/ld/testsuite/ld-mips-elf/empic1-sn.d b/ld/testsuite/ld-mips-elf/empic1-sn.d new file mode 100644 index 0000000000..6d041edf34 --- /dev/null +++ b/ld/testsuite/ld-mips-elf/empic1-sn.d @@ -0,0 +1,23 @@ +#name: MIPS 32-bit ELF embedded-pic relocs #1-sn (small negative) +#as: -membedded-pic -mips3 +#source: empic1-tgt.s +#source: empic1-ref.s +#objdump: --prefix-addresses -tdr --show-raw-insn -mmips:4000 +#ld: -Ttext 0x400000 -e 0x400000 + +.*: file format elf.*mips.* + +SYMBOL TABLE: +#... +0+400020 g F .text [0-9a-f]+ foo +#... +0+400000 g F .text [0-9a-f]+ bar +#... + +Disassembly of section \.text: + ... +0+400020 <[^>]*> 00000000 nop +0+400024 <[^>]*> 3c020000 lui v0,0x0 +0+400028 <[^>]*> 6442ffe0 daddiu v0,v0,-32 + ... +#pass diff --git a/ld/testsuite/ld-mips-elf/empic1-sp.d b/ld/testsuite/ld-mips-elf/empic1-sp.d new file mode 100644 index 0000000000..f91d625947 --- /dev/null +++ b/ld/testsuite/ld-mips-elf/empic1-sp.d @@ -0,0 +1,23 @@ +#name: MIPS 32-bit ELF embedded-pic relocs #1-sp (small positive) +#as: -membedded-pic -mips3 +#source: empic1-ref.s +#source: empic1-tgt.s +#objdump: --prefix-addresses -tdr --show-raw-insn -mmips:4000 +#ld: -Ttext 0x400000 -e 0x400000 + +.*: file format elf.*mips.* + +SYMBOL TABLE: +#... +0+400000 g F .text [0-9a-f]+ foo +#... +0+400020 g F .text [0-9a-f]+ bar +#... + +Disassembly of section \.text: +0+400000 <[^>]*> 00000000 nop +0+400004 <[^>]*> 3c020000 lui v0,0x0 +0+400008 <[^>]*> 64420020 daddiu v0,v0,32 + ... + ... +#pass diff --git a/ld/testsuite/ld-mips-elf/empic1-space.s b/ld/testsuite/ld-mips-elf/empic1-space.s new file mode 100644 index 0000000000..9c30cfbccf --- /dev/null +++ b/ld/testsuite/ld-mips-elf/empic1-space.s @@ -0,0 +1,5 @@ + + .ent space +space: + .space (32 * 1024) + .end space diff --git a/ld/testsuite/ld-mips-elf/empic1-tgt.s b/ld/testsuite/ld-mips-elf/empic1-tgt.s new file mode 100644 index 0000000000..909488cedc --- /dev/null +++ b/ld/testsuite/ld-mips-elf/empic1-tgt.s @@ -0,0 +1,8 @@ + + .globl bar + .ent bar +bar: + nop + .end bar + + .p2align 5 diff --git a/ld/testsuite/ld-mips-elf/empic2-fwd-0.d b/ld/testsuite/ld-mips-elf/empic2-fwd-0.d new file mode 100644 index 0000000000..e53f1faa13 --- /dev/null +++ b/ld/testsuite/ld-mips-elf/empic2-fwd-0.d @@ -0,0 +1,20 @@ +#name: MIPS 32-bit ELF embedded-pic relocs #2-fwd-0 (0x7ffc forward edge case) +#as: -membedded-pic -mips3 +#source: empic2-ref.s +#source: empic2-fwd-tgt.s +#objdump: --prefix-addresses -tdr --show-raw-insn -mmips:4000 +#ld: -Ttext 0x400000 -e 0x400000 + +.*: file format elf.*mips.* + +#... +0+400000 g F .text [0-9a-f]+ foo +#... +0+407ffc g F .text [0-9a-f]+ bar +#... + +Disassembly of section \.text: +0+400000 <[^>]*> 3c020000 lui v0,0x0 +0+400004 <[^>]*> 64427ffc daddiu v0,v0,32764 + ... +#pass diff --git a/ld/testsuite/ld-mips-elf/empic2-fwd-1.d b/ld/testsuite/ld-mips-elf/empic2-fwd-1.d new file mode 100644 index 0000000000..e7208520da --- /dev/null +++ b/ld/testsuite/ld-mips-elf/empic2-fwd-1.d @@ -0,0 +1,21 @@ +#name: MIPS 32-bit ELF embedded-pic relocs #2-fwd-1 (0xfffc forward edge case) +#as: -membedded-pic -mips3 +#source: empic2-ref.s +#source: empic2-space.s +#source: empic2-fwd-tgt.s +#objdump: --prefix-addresses -tdr --show-raw-insn -mmips:4000 +#ld: -Ttext 0x400000 -e 0x400000 + +.*: file format elf.*mips.* + +#... +0+400000 g F .text [0-9a-f]+ foo +#... +0+40fffc g F .text [0-9a-f]+ bar +#... + +Disassembly of section \.text: +0+400000 <[^>]*> 3c020001 lui v0,0x1 +0+400004 <[^>]*> 6442fffc daddiu v0,v0,-4 + ... +#pass diff --git a/ld/testsuite/ld-mips-elf/empic2-fwd-tgt.s b/ld/testsuite/ld-mips-elf/empic2-fwd-tgt.s new file mode 100644 index 0000000000..915cf456b2 --- /dev/null +++ b/ld/testsuite/ld-mips-elf/empic2-fwd-tgt.s @@ -0,0 +1,7 @@ + + .space (32768 - 16 - 4) # 16..32764 + + .globl bar + .ent bar +bar: + .end bar diff --git a/ld/testsuite/ld-mips-elf/empic2-ref.s b/ld/testsuite/ld-mips-elf/empic2-ref.s new file mode 100644 index 0000000000..c0ae00c5ab --- /dev/null +++ b/ld/testsuite/ld-mips-elf/empic2-ref.s @@ -0,0 +1,6 @@ + .globl foo + .ent foo +foo: + la $2,bar-foo + + .p2align 4 diff --git a/ld/testsuite/ld-mips-elf/empic2-rev-0.d b/ld/testsuite/ld-mips-elf/empic2-rev-0.d new file mode 100644 index 0000000000..9bd9accb25 --- /dev/null +++ b/ld/testsuite/ld-mips-elf/empic2-rev-0.d @@ -0,0 +1,22 @@ +#name: MIPS 32-bit ELF embedded-pic relocs #2-rev-0 (0x0004 backward edge case) +#as: -membedded-pic -mips3 +#source: empic2-rev-tgt.s +#source: empic2-ref.s +#objdump: --prefix-addresses -tdr --show-raw-insn -mmips:4000 +#ld: -Ttext 0x400000 -e 0x400000 + +.*: file format elf.*mips.* + +#... +0+408000 g F .text [0-9a-f]+ foo +#... +0+407ffc g F .text [0-9a-f]+ bar +#... + +Disassembly of section \.text: + ... +0+407ffc <[^>]*> 00000000 nop +0+408000 <[^>]*> 3c020000 lui v0,0x0 +0+408004 <[^>]*> 6442fffc daddiu v0,v0,-4 + ... +#pass diff --git a/ld/testsuite/ld-mips-elf/empic2-rev-1.d b/ld/testsuite/ld-mips-elf/empic2-rev-1.d new file mode 100644 index 0000000000..1a38ec2c7c --- /dev/null +++ b/ld/testsuite/ld-mips-elf/empic2-rev-1.d @@ -0,0 +1,24 @@ +#name: MIPS 32-bit ELF embedded-pic relocs #2-rev-1 (0x8004 backward edge case) +#as: -membedded-pic -mips3 +#source: empic2-rev-tgt.s +#source: empic2-space.s +#source: empic2-ref.s +#objdump: --prefix-addresses -tdr --show-raw-insn -mmips:4000 +#ld: -Ttext 0x400000 -e 0x400000 + +.*: file format elf.*mips.* + +#... +0+410000 g F .text [0-9a-f]+ foo +#... +0+407ffc g F .text [0-9a-f]+ bar +#... + +Disassembly of section \.text: + ... +0+407ffc <[^>]*> 00000000 nop + ... +0+410000 <[^>]*> 3c02ffff lui v0,0xffff +0+410004 <[^>]*> 64427ffc daddiu v0,v0,32764 + ... +#pass diff --git a/ld/testsuite/ld-mips-elf/empic2-rev-tgt.s b/ld/testsuite/ld-mips-elf/empic2-rev-tgt.s new file mode 100644 index 0000000000..8124cfe750 --- /dev/null +++ b/ld/testsuite/ld-mips-elf/empic2-rev-tgt.s @@ -0,0 +1,8 @@ + + .space (32768 - 4) + + .globl bar + .ent bar +bar: + .space 4 + .end bar diff --git a/ld/testsuite/ld-mips-elf/empic2-space.s b/ld/testsuite/ld-mips-elf/empic2-space.s new file mode 100644 index 0000000000..9c30cfbccf --- /dev/null +++ b/ld/testsuite/ld-mips-elf/empic2-space.s @@ -0,0 +1,5 @@ + + .ent space +space: + .space (32 * 1024) + .end space diff --git a/ld/testsuite/ld-mips-elf/mips-elf.exp b/ld/testsuite/ld-mips-elf/mips-elf.exp new file mode 100644 index 0000000000..b47b32628f --- /dev/null +++ b/ld/testsuite/ld-mips-elf/mips-elf.exp @@ -0,0 +1,38 @@ +# Expect script for MIPS ELF linker tests +# Copyright 2002 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. +# + +if { [istarget mips*-*-*] } then { + + # Run embedded-pic tests only if generic ELF. + if { [istarget mips*-*-elf] } { + # Check basic PC-relative HI/LO relocs. + run_dump_test "empic1-ln" + run_dump_test "empic1-lp" + run_dump_test "empic1-mn" + run_dump_test "empic1-mp" + run_dump_test "empic1-sn" + run_dump_test "empic1-sp" + + # PC-relative HI/LO reloc edge-case regression tests. + # As of 2001-12-26, the linker botches the fwd-0 and rev-1 tests. + run_dump_test "empic2-fwd-0" + run_dump_test "empic2-fwd-1" + run_dump_test "empic2-rev-0" + run_dump_test "empic2-rev-1" + } +} -- 2.11.0