diff options
author | Geoffrey Keating <geoffk@geoffk.org> | 2000-03-11 02:16:25 +0000 |
---|---|---|
committer | Geoffrey Keating <geoffk@geoffk.org> | 2000-03-11 02:16:25 +0000 |
commit | bb2d6cd7b19cd82313963d2d878a94e6e85a38b6 (patch) | |
tree | 1aa892d4bc8e425e4ef6495561cdb9db2c65abad /gas/testsuite | |
parent | 88b6bae086d357c92d250d13263feea1c02175a0 (diff) | |
download | gdb-bb2d6cd7b19cd82313963d2d878a94e6e85a38b6.zip gdb-bb2d6cd7b19cd82313963d2d878a94e6e85a38b6.tar.gz gdb-bb2d6cd7b19cd82313963d2d878a94e6e85a38b6.tar.bz2 |
In bfd/:
* elf32-mips.c (mips_elf_next_relocation): Rename from
mips_elf_next_lo16_relocation, and generalize to look
for any relocation type.
(elf_mips_howto_table): Make R_MIPS_PC16 pcrel_offset.
(elf_mips_gnu_rel_hi16): Howto for R_MIPS_GNU_REL_HI16.
(elf_mips_gnu_rel_lo16): Howto for R_MIPS_GNU_REL_LO16.
(elf_mips_gnu_rel16_s2): Howto for R_MIPS_GNU_REL16_S2.
(elf_mips_gnu_pcrel64): Howto for R_MIPS_PC64.
(elf_mips_gnu_pcrel32): Howto for R_MIPS_PC32.
(bfd_elf32_bfd_reloc_type_lookup): Add new relocs.
(mips_rtype_to_howto): Likewise.
(mips_elf_calculate_relocation): Handle new relocs.
(_bfd_mips_elf_relocate_section): REL_HI16/REL_LO16 relocs
are paired. The addend for R_MIPS_GNU_REL16_S2
is shifted right two bits.
In gas/:
* config/tc-mips.c (mips_ip): Don't put stuff in .rodata
when embedded-pic.
* config/tc-mips.c (SWITCH_TABLE): The ELF embedded-pic
implementation doesn't have special handling for switch
statements.
(macro_build): Allow for code in sections other than .text.
(macro): Likewise.
(mips_ip): Likewise.
(md_apply_fix): Do pc-relative relocation madness for MIPS ELF.
Don't perform relocs if we will be outputting them.
(tc_gen_reloc): For ELF, just use fx_addnumber for pc-relative
relocations. Allow BFD_RELOC_16_PCREL_S2 relocs when
embedded-pic.
In gas/testsuite/:
* gas/mips/empic.d: New file.
* gas/mips/empic.s: New file.
* gas/mips/mips16-e.d: New file.
* gas/mips/mips16-e.s: New file.
* gas/mips/mips16-f.d: New file.
* gas/mips/mips16-f.s: New file.
* gas/mips/mips.exp: Add empic, mips16-e. Add mips16-f as an
expected failure.
In include/elf:
* mips.h: Add R_MIPS_GNU_REL_HI16, R_MIPS_GNU_REL_LO16,
R_MIPS_GNU_REL16_S2, R_MIPS_PC64 and R_MIPS_PC32 relocation
numbers.
Diffstat (limited to 'gas/testsuite')
-rw-r--r-- | gas/testsuite/ChangeLog | 11 | ||||
-rw-r--r-- | gas/testsuite/gas/mips/empic.d | 155 | ||||
-rw-r--r-- | gas/testsuite/gas/mips/empic.s | 112 | ||||
-rw-r--r-- | gas/testsuite/gas/mips/mips.exp | 6 | ||||
-rw-r--r-- | gas/testsuite/gas/mips/mips16-e.d | 41 | ||||
-rw-r--r-- | gas/testsuite/gas/mips/mips16-e.s | 13 | ||||
-rw-r--r-- | gas/testsuite/gas/mips/mips16-f.d | 33 | ||||
-rw-r--r-- | gas/testsuite/gas/mips/mips16-f.s | 6 |
8 files changed, 377 insertions, 0 deletions
diff --git a/gas/testsuite/ChangeLog b/gas/testsuite/ChangeLog index 607c2f6..ef99b86 100644 --- a/gas/testsuite/ChangeLog +++ b/gas/testsuite/ChangeLog @@ -1,3 +1,14 @@ +2000-03-10 Geoffrey Keating <geoffk@cygnus.com> + + * gas/mips/empic.d: New file. + * gas/mips/empic.s: New file. + * gas/mips/mips16-e.d: New file. + * gas/mips/mips16-e.s: New file. + * gas/mips/mips16-f.d: New file. + * gas/mips/mips16-f.s: New file. + * gas/mips/mips.exp: Add empic, mips16-e. Add mips16-f as an + expected failure. + 2000-02-25 H.J. Lu <hjl@gnu.org> * gas/i386/general.l: Support a.out and coff. diff --git a/gas/testsuite/gas/mips/empic.d b/gas/testsuite/gas/mips/empic.d new file mode 100644 index 0000000..3c6b4d4 --- /dev/null +++ b/gas/testsuite/gas/mips/empic.d @@ -0,0 +1,155 @@ +#objdump: -rst -mmips:4000 +#name: MIPS empic +#as: -membedded-pic -mips3 + +# Check GNU-specific embedded relocs, for ELF. + +.*: +file format elf.*mips.* + +SYMBOL TABLE: +0+0000000 l d \.text 0+0000000 +0+0000000 l d \.data 0+0000000 +0+0000000 l d \.bss 0+0000000 +0+0000000 l d \.foo 0+0000000 +0+0000000 l d \.reginfo 0+0000000 +0+0000000 l d \.mdebug 0+0000000 +0+0000004 l \.text 0+0000000 l2 +0+0000000 \*UND\* 0+0000000 g1 +0+0000000 \*UND\* 0+0000000 g2 +0+0000100 l \.foo 0+0000000 l1 +0+0000034 l \.text 0+0000000 l3 +0+0000098 l \.text 0+0000000 l5 +0+0000004 l \.foo 0+0000000 l4 + + +RELOCATION RECORDS FOR \[\.text\]: +OFFSET TYPE VALUE +0+0000004 R_MIPS_GNU_REL16_S2 g1 +0+000000c R_MIPS_GNU_REL16_S2 g2 +0+0000014 R_MIPS_GNU_REL16_S2 g2 +0+000001c R_MIPS_GNU_REL16_S2 \.foo +0+0000024 R_MIPS_GNU_REL16_S2 \.text +0+000002c R_MIPS_GNU_REL16_S2 \.foo +0+0000034 R_MIPS_GNU_REL16_S2 \.text +0+000003c R_MIPS_GNU_REL_HI16 g1 +0+0000040 R_MIPS_GNU_REL_LO16 g1 +0+0000044 R_MIPS_GNU_REL_HI16 \.foo +0+0000048 R_MIPS_GNU_REL_LO16 \.foo +0+0000050 R_MIPS_32 g1 +0+0000054 R_MIPS_32 \.foo +0+0000058 R_MIPS_32 \.text +0+000005c R_MIPS_PC32 g1 +0+0000060 R_MIPS_PC32 \.foo +0+0000068 R_MIPS_64 g1 +0+0000070 R_MIPS_64 \.foo +0+0000078 R_MIPS_64 \.text +0+0000080 R_MIPS_PC64 g1 +0+0000088 R_MIPS_PC64 \.foo +0+0000098 R_MIPS_GNU_REL16_S2 \.text +0+000009c R_MIPS_GNU_REL16_S2 \.text +0+00000a0 R_MIPS_GNU_REL_HI16 \.text +0+00000a4 R_MIPS_GNU_REL_LO16 \.text +0+00000a8 R_MIPS_GNU_REL_HI16 \.text +0+00000ac R_MIPS_GNU_REL_LO16 \.text +0+00000b0 R_MIPS_32 \.text +0+00000b8 R_MIPS_64 \.text +0+00000cc R_MIPS_GNU_REL16_S2 \.text +0+00000d0 R_MIPS_GNU_REL16_S2 \.text +0+00000d4 R_MIPS_GNU_REL_HI16 \.text +0+00000d8 R_MIPS_GNU_REL_LO16 \.text +0+00000dc R_MIPS_GNU_REL_HI16 \.text +0+00000e0 R_MIPS_GNU_REL_LO16 \.text +0+00000e4 R_MIPS_32 \.text +0+00000f0 R_MIPS_64 \.text + + +RELOCATION RECORDS FOR \[\.foo\]: +OFFSET TYPE VALUE +0+0000004 R_MIPS_GNU_REL_HI16 g1 +0+0000008 R_MIPS_GNU_REL_LO16 g1 +0+000000c R_MIPS_GNU_REL_HI16 \.foo +0+0000010 R_MIPS_GNU_REL_LO16 \.foo +0+0000014 R_MIPS_GNU_REL_HI16 \.text +0+0000018 R_MIPS_GNU_REL_LO16 \.text +0+000001c R_MIPS_GNU_REL_HI16 g1 +0+0000020 R_MIPS_GNU_REL_LO16 g1 +0+0000024 R_MIPS_GNU_REL_HI16 g1 +0+0000028 R_MIPS_GNU_REL_LO16 g1 +0+000002c R_MIPS_GNU_REL_HI16 \.foo +0+0000030 R_MIPS_GNU_REL_LO16 \.foo +0+0000034 R_MIPS_GNU_REL_HI16 \.text +0+0000038 R_MIPS_GNU_REL_LO16 \.text +0+000003c R_MIPS_32 g1 +0+0000040 R_MIPS_32 \.foo +0+0000044 R_MIPS_32 \.text +0+0000048 R_MIPS_PC32 g1 +0+0000050 R_MIPS_PC32 \.text +0+0000058 R_MIPS_64 g1 +0+0000060 R_MIPS_64 \.foo +0+0000068 R_MIPS_64 \.text +0+0000070 R_MIPS_PC64 g1 +0+0000080 R_MIPS_PC64 \.text +0+0000088 R_MIPS_GNU_REL_HI16 g1 +0+000008c R_MIPS_GNU_REL_LO16 g1 +0+0000090 R_MIPS_GNU_REL_HI16 \.foo +0+0000094 R_MIPS_GNU_REL_LO16 \.foo +0+0000098 R_MIPS_GNU_REL_HI16 \.text +0+000009c R_MIPS_GNU_REL_LO16 \.text +0+00000a0 R_MIPS_GNU_REL_HI16 g1 +0+00000a4 R_MIPS_GNU_REL_LO16 g1 +0+00000a8 R_MIPS_GNU_REL_HI16 \.foo +0+00000ac R_MIPS_GNU_REL_LO16 \.foo +0+00000b0 R_MIPS_GNU_REL_HI16 \.text +0+00000b4 R_MIPS_GNU_REL_LO16 \.text +0+00000b8 R_MIPS_32 g1 +0+00000bc R_MIPS_32 \.foo +0+00000c0 R_MIPS_32 \.text +0+00000c4 R_MIPS_PC32 g1 +0+00000cc R_MIPS_PC32 \.text +0+00000d0 R_MIPS_64 g1 +0+00000d8 R_MIPS_64 \.foo +0+00000e0 R_MIPS_64 \.text +0+00000e8 R_MIPS_PC64 g1 +0+00000f8 R_MIPS_PC64 \.text + +Contents of section \.text: + 0000 00000000 0411ffff 00000000 1000ffff .* + 0010 00000000 1000ffff 00000000 0411003f .* + 0020 00000000 04110000 00000000 10000041 .* + 0030 00000000 10000000 00000000 3c030000 .* + 0040 [26]463000c 3c030000 [26]4630114 2403ffd0 .* + 0050 00000000 00000100 00000004 00000028 .* + 0060 0000012c ffffffd0 00000000 00000000 .* + 0070 00000000 00000100 00000000 00000004 .* + 0080 00000000 0000004c 00000000 00000154 .* + 0090 ffffffff ffffffd0 10000032 10000033 .* + 00a0 3c030000 [26]46300d8 3c030000 [26]46300e8 .* + 00b0 000000cc 00000034 00000000 000000cc .* + 00c0 00000000 00000034 00000000 10000032 .* + 00d0 10000033 3c030000 [26]463010c 3c030000 .* + 00e0 [26]463011c 000000cc 00000034 00000000 .* + 00f0 00000000 000000cc 00000000 00000034 .* +Contents of section \.data: +Contents of section \.reginfo: + 0000 80000008 00000000 00000000 00000000 .* + 0010 00000000 00000000 .* +Contents of section \.mdebug: +#... +Contents of section \.foo: + 0000 00000000 3c030000 [26]4630004 3c030000 .* + 0010 [26]463010c 3c030000 [26]4630018 3c030000 .* + 0020 [26]463001c 3c030000 [26]4630024 3c030000 .* + 0030 [26]463012c 3c030000 [26]4630038 00000000 .* + 0040 00000100 00000004 00000044 000000fc .* + 0050 00000050 00000000 00000000 00000000 .* + 0060 00000000 00000100 00000000 00000004 .* + 0070 00000000 0000006c 00000000 000000fc .* + 0080 00000000 00000080 3c030000 [26]463008c .* + 0090 3c030000 [26]4630194 3c030000 [26]46300a0 .* + 00a0 3c030000 [26]46300a4 3c030000 [26]46301ac .* + 00b0 3c030000 [26]46300b8 00000004 00000104 .* + 00c0 00000008 000000c4 00000100 000000d0 .* + 00d0 00000000 00000004 00000000 00000104 .* + 00e0 00000000 00000008 00000000 000000e8 .* + 00f0 00000000 00000100 00000000 000000fc .* + 0100 00000000 .* diff --git a/gas/testsuite/gas/mips/empic.s b/gas/testsuite/gas/mips/empic.s new file mode 100644 index 0000000..2c485b3 --- /dev/null +++ b/gas/testsuite/gas/mips/empic.s @@ -0,0 +1,112 @@ +# Check GNU-specific embedded relocs, for ELF. + + .text + .set noreorder + nop +l2: jal g1 # R_MIPS_GNU_REL16_S2 g1 -1 + nop + b g2 # R_MIPS_GNU_REL16_S2 g2 -1 + nop + b g2 # R_MIPS_GNU_REL16_S2 g2 -1 + nop + jal l1 # R_MIPS_GNU_REL16_S2 .foo 3F + nop + jal l2 # R_MIPS_GNU_REL16_S2 .text 0 or -9 + nop + b l1+8 # R_MIPS_GNU_REL16_S2 .foo 41 + nop +l3: + b l2 # R_MIPS_GNU_REL16_S2 .text 0 or -D + nop + la $3,g1-l3 # R_MIPS_GNU_REL_HI16 g1 0 + # R_MIPS_GNU_REL_LO16 g1 C + la $3,l1-l3 # R_MIPS_GNU_REL_HI16 .foo 0 + # R_MIPS_GNU_REL_LO16 .foo 114 + la $3,l2-l3 # -30 + .word g1 # R_MIPS_32 g1 0 + .word l1 # R_MIPS_32 .foo 100 + .word l2 # R_MIPS_32 .text 4 + .word g1-l3 # R_MIPS_PC32 g1 28 + .word l1-l3 # R_MIPS_PC32 .foo 12C + .word l2-l3 # -30 + .align 3 + .dword g1 # R_MIPS_64 g1 0 + .dword l1 # R_MIPS_64 .foo 100 + .dword l2 # R_MIPS_64 .text 4 + .dword g1-l3 # R_MIPS_PC64 g1 4C + .dword l1-l3 # R_MIPS_PC64 .foo 154 + .dword l2-l3 # -30 +l5: + b 2f # R_MIPS_GNU_REL16_S2 .text 32 + b 2f+4 # R_MIPS_GNU_REL16_S2 .text 33 + la $3,2f-l5 # R_MIPS_GNU_REL_HI16 .text 0 + # R_MIPS_GNU_REL_HI16 .text D8 + la $3,2f+8-l5 # R_MIPS_GNU_REL_HI16 .text 0 + # R_MIPS_GNU_REL_HI16 .text E8 + + .word 2f # R_MIPS_32 .text CC + .word 2f-l5 # R_MIPS_PC32 .text EC or 34 + .dword 2f # R_MIPS_64 .text CC + .dword 2f-l5 # R_MIPS_PC64 .text F8 or 34 + nop +2: # at address 0xCC. + b 2b # R_MIPS_GNU_REL16_S2 .text 32 + b 2b+4 # R_MIPS_GNU_REL16_S2 .text 33 + la $3,2b-l5 # R_MIPS_GNU_REL_HI16 .text 0 + # R_MIPS_GNU_REL_HI16 .text 10C + la $3,2b+8-l5 # R_MIPS_GNU_REL_HI16 .text 0 + # R_MIPS_GNU_REL_HI16 .text 11C + .word 2b # R_MIPS_32 .text CC + .word 2b-l5 # R_MIPS_PC32 .text 11C or 34 + nop + .dword 2b # R_MIPS_64 .text CC + .dword 2b-l5 # R_MIPS_PC64 .text 98 or 34 + + .section ".foo","ax",@progbits + nop +l4: + la $3,g1-l4 + la $3,l1-l4 + la $3,l2-l4 + la $3,g1-l4 + + dla $3,g1-l4 + dla $3,l1-l4 + dla $3,l2-l4 + + .word g1 + .word l1 + .word l2 + .word g1-l4 + .word l1-l4 + .word l2-l4 + .dword g1 + .dword l1 + .dword l2 + .dword g1-l4 + .dword l1-l4 + .dword l2-l4 + + la $3,g1-l4+4 + la $3,l1-l4+4 + la $3,l2-l4+4 + + dla $3,g1-l4+4 + dla $3,l1-l4+4 + dla $3,l2-l4+4 + + .word g1+4 + .word l1+4 + .word l2+4 + .word g1-l4+4 + .word l1-l4+4 + .word l2-l4+4 + .dword g1+4 + .dword l1+4 + .dword l2+4 + .dword g1-l4+4 + .dword l1-l4+4 + .dword l2-l4+4 +l1: + + nop diff --git a/gas/testsuite/gas/mips/mips.exp b/gas/testsuite/gas/mips/mips.exp index f1a0d57..6ed1c02 100644 --- a/gas/testsuite/gas/mips/mips.exp +++ b/gas/testsuite/gas/mips/mips.exp @@ -107,5 +107,11 @@ if [istarget mips*-*-*] then { } { run_dump_test "e32-rel2" } + run_dump_test "empic" + if { !$no_mips16 } { + run_dump_test "mips16-e" + setup_xfail "mips*-*-*" + run_dump_test "mips16-f" + } } } diff --git a/gas/testsuite/gas/mips/mips16-e.d b/gas/testsuite/gas/mips/mips16-e.d new file mode 100644 index 0000000..1f23f68 --- /dev/null +++ b/gas/testsuite/gas/mips/mips16-e.d @@ -0,0 +1,41 @@ +#objdump: -rst -mips16 +#name: MIPS16 reloc +#as: -mips16 + +# Check MIPS16 reloc processing + +.*: +file format elf.*mips.* + +SYMBOL TABLE: +0+0000000 l d \.text 0+0000000 +0+0000000 l d \.data 0+0000000 +0+0000000 l d \.bss 0+0000000 +0+0000000 l d foo 0+0000000 +0+0000000 l d \.reginfo 0+0000000 +0+0000000 l d \.mdebug 0+0000000 +0+0000002 l \.text 0+0000000 0xf0 l1 +0+0000004 l \.text 0+0000000 0xf0 L1.1 +0+0000000 \*UND\* 0+0000000 g1 + + +RELOCATION RECORDS FOR \[foo\]: +OFFSET TYPE VALUE +0+0000000 R_MIPS_32 l1 +0+0000004 R_MIPS_32 l1 +0+0000008 R_MIPS_32 L1.1 +0+000000c R_MIPS_32 L1.1 +0+0000010 R_MIPS_32 g1 +0+0000014 R_MIPS_32 g1 + + +Contents of section \.text: + 0000 65006500 65006500 .* +Contents of section \.data: +Contents of section \.reginfo: + 0000 00000001 00000000 00000000 00000000 .* + 0010 00000000 00000000 .* +Contents of section \.mdebug: +#... +Contents of section foo: + 0000 00000000 00000008 00000000 00000003 .* + 0010 00000000 00000008 .* diff --git a/gas/testsuite/gas/mips/mips16-e.s b/gas/testsuite/gas/mips/mips16-e.s new file mode 100644 index 0000000..b19d020 --- /dev/null +++ b/gas/testsuite/gas/mips/mips16-e.s @@ -0,0 +1,13 @@ + .set noreorder + .text + nop +l1: nop +1: nop + nop + .section "foo" + .word l1 + .word l1+8 + .word 1b + .word 1b+3 + .word g1 + .word g1+8 diff --git a/gas/testsuite/gas/mips/mips16-f.d b/gas/testsuite/gas/mips/mips16-f.d new file mode 100644 index 0000000..3a6af1b --- /dev/null +++ b/gas/testsuite/gas/mips/mips16-f.d @@ -0,0 +1,33 @@ +#objdump: -rst -mips16 +#name: MIPS16 reloc 2 +#as: -mips16 + +# Check MIPS16 reloc processing + +.*: +file format elf.*mips.* + +SYMBOL TABLE: +0+0000000 l d \.text 0+0000000 +0+0000000 l d \.data 0+0000000 +0+0000000 l d \.bss 0+0000000 +0+0000000 l d foo 0+0000000 +0+0000000 l d \.reginfo 0+0000000 +0+0000000 l d \.mdebug 0+0000000 +0+0000002 l \.text 0+0000000 0xf0 l1 + + +RELOCATION RECORDS FOR \[foo\]: +OFFSET TYPE VALUE +0+0000000 R_MIPS_32 l1 + + +Contents of section \.text: + 0000 65006500 .* +Contents of section \.data: +Contents of section \.reginfo: + 0000 00000001 00000000 00000000 00000000 .* + 0010 00000000 00000000 .* +Contents of section \.mdebug: +#... +Contents of section foo: + 0000 00000003 .* diff --git a/gas/testsuite/gas/mips/mips16-f.s b/gas/testsuite/gas/mips/mips16-f.s new file mode 100644 index 0000000..0b254bd --- /dev/null +++ b/gas/testsuite/gas/mips/mips16-f.s @@ -0,0 +1,6 @@ + .set noreorder + .text + nop +l1: nop + .section "foo" + .word l1+3 |