diff options
author | Jakub Jelinek <jakub@redhat.com> | 2001-12-21 22:35:24 +0000 |
---|---|---|
committer | Jakub Jelinek <jakub@redhat.com> | 2001-12-21 22:35:24 +0000 |
commit | bd5e6e7e3a8be60699e596633cd828d3446e75ee (patch) | |
tree | abcf04a60d2166b0d451f2a3d5fa061c36b64a44 /gas/testsuite | |
parent | 58d370e0e6b0b1cc1df5b587ca39a14e975f5850 (diff) | |
download | gdb-bd5e6e7e3a8be60699e596633cd828d3446e75ee.zip gdb-bd5e6e7e3a8be60699e596633cd828d3446e75ee.tar.gz gdb-bd5e6e7e3a8be60699e596633cd828d3446e75ee.tar.bz2 |
* elf32-sparc.c (_bfd_sparc_elf_howto_table): Fix dst_mask for
R_SPARC_DISP32. Support R_SPARC_PLT32.
(sparc_reloc_map): Add BFD_RELOC_16_PCREL and BFD_RELOC_SPARC_PLT32.
(elf32_sparc_check_relocs): Handle R_SPARC_PLT32.
(elf32_sparc_relocate_section): Likewise.
* elf64-sparc.c (sparc64_elf_howto_table): Fix dst_mask for
R_SPARC_DISP32. Support R_SPARC_PLT32 and R_SPARC_PLT64.
(sparc_reloc_map): Add BFD_RELOC_16_PCREL, BFD_RELOC_64_PCREL
and BFD_RELOC_SPARC_PLT32.
(sparc64_elf_check_relocs): Handle R_SPARC_PLT32 and R_SPARC_PLT64.
(sparc64_elf_relocate_section): Likewise.
* reloc.c (bfd_reloc_code_type): Add BFD_RELOC_SPARC_PLT32.
* bfd-in2.h, libbfd.h: Rebuilt.
* config/tc-sparc.h (TC_PARSE_CONS_EXPRESSION): Define.
(sparc_cons): Provide prototype.
* config/tc-sparc.c (tc_gen_reloc): Handle BFD_RELOC_*_PCREL and
BFD_RELOC_SPARC_PLT{32,64}. Enumerate for which relocs
reloc->addend = fixp->fx_addnumber shouldn't be done instead of
enumarating for which pc relative ones it should be done.
(sparc_cons_special_reloc): New variable.
(sparc_cons): New function.
(cons_fix_new_sparc): Use sparc_cons_special_reloc.
* testsuite/gas/sparc/pcrel.s: New test.
* testsuite/gas/sparc/pcrel.d: Expected output.
* testsuite/gas/sparc/pcrel64.s: New test.
* testsuite/gas/sparc/pcrel64.d: Expected output.
* testsuite/gas/sparc/plt.s: New test.
* testsuite/gas/sparc/plt.d: Expected output.
* testsuite/gas/sparc/plt64.s: New test.
* testsuite/gas/sparc/plt64.d: Expected output.
* testsuite/gas/sparc/sparc.exp: Add pcrel, pcrel64, plt and plt64
tests.
Diffstat (limited to 'gas/testsuite')
-rw-r--r-- | gas/testsuite/gas/sparc/pcrel.d | 34 | ||||
-rw-r--r-- | gas/testsuite/gas/sparc/pcrel.s | 26 | ||||
-rw-r--r-- | gas/testsuite/gas/sparc/pcrel64.d | 40 | ||||
-rw-r--r-- | gas/testsuite/gas/sparc/pcrel64.s | 32 | ||||
-rw-r--r-- | gas/testsuite/gas/sparc/plt.d | 23 | ||||
-rw-r--r-- | gas/testsuite/gas/sparc/plt.s | 12 | ||||
-rw-r--r-- | gas/testsuite/gas/sparc/plt64.d | 26 | ||||
-rw-r--r-- | gas/testsuite/gas/sparc/plt64.s | 13 | ||||
-rw-r--r-- | gas/testsuite/gas/sparc/sparc.exp | 4 |
9 files changed, 210 insertions, 0 deletions
diff --git a/gas/testsuite/gas/sparc/pcrel.d b/gas/testsuite/gas/sparc/pcrel.d new file mode 100644 index 0000000..2d37010 --- /dev/null +++ b/gas/testsuite/gas/sparc/pcrel.d @@ -0,0 +1,34 @@ +#as: +#objdump: -Dr +#name: pc relative relocs + +.*: +file format .*sparc.* + +Disassembly of section .text: + +0+ <foo-0x8>: + 0: 01 00 00 00 nop + 4: 01 00 00 00 nop + +0+8 <foo>: + 8: 01 00 00 00 nop +Disassembly of section .data: + +0+ <.data>: + 0: 00 00 00 00 (unimp|illtrap) 0 + 4: 00 00 00 01 (unimp|illtrap) 0x1 + ... + 8: R_SPARC_32 .text\+0x10 + c: R_SPARC_DISP32 .text\+0x10 + 10: R_SPARC_32 .text\+0x10 + 14: R_SPARC_DISP32 .text\+0x10 + 18: R_SPARC_32 foo + 1c: R_SPARC_DISP32 foo + 20: R_SPARC_32 foo\+0x10 + 24: R_SPARC_DISP32 foo\+0x10 + 28: R_SPARC_DISP8 .data\+0x18 + 29: R_SPARC_DISP8 .data\+0x34 + 2a: R_SPARC_DISP16 .data\+0x18 + 2c: R_SPARC_DISP16 .data\+0x34 + 30: 00 02 00 00 (unimp|illtrap) 0x20000 + ... diff --git a/gas/testsuite/gas/sparc/pcrel.s b/gas/testsuite/gas/sparc/pcrel.s new file mode 100644 index 0000000..ac59454 --- /dev/null +++ b/gas/testsuite/gas/sparc/pcrel.s @@ -0,0 +1,26 @@ + .text + .align 4 +1: nop +2: nop + .globl foo +foo: nop + + .data + .align 32 + .word 0 + .word 1 + .word 1b + 16 + .word %r_disp32(1b + 16) + .word 1b + 16 + .word %r_disp32(1b + 16) +3: .word foo + .word %r_disp32(foo) + .word foo + 16 + .word %r_disp32(foo + 16) + .byte %r_disp8(3b) + .byte %r_disp8(4f) + .half %r_disp16(3b) + .half %r_disp16(4f) + .uaword 2 + .half 0 +4: diff --git a/gas/testsuite/gas/sparc/pcrel64.d b/gas/testsuite/gas/sparc/pcrel64.d new file mode 100644 index 0000000..a93ead9 --- /dev/null +++ b/gas/testsuite/gas/sparc/pcrel64.d @@ -0,0 +1,40 @@ +#as: -64 -K PIC +#objdump: -Dr +#name: pc relative 64-bit relocs + +.*: +file format .*sparc.* + +Disassembly of section .text: + +0+ <foo-0x8>: + 0: 01 00 00 00 nop + 4: 01 00 00 00 nop + +0+8 <foo>: + 8: 01 00 00 00 nop +Disassembly of section .data: + +0+ <.data>: + 0: 00 00 00 00 illtrap 0 + 4: 00 00 00 01 illtrap 0x1 + ... + 8: R_SPARC_32 .text\+0x10 + c: R_SPARC_DISP32 .text\+0x10 + 10: R_SPARC_32 .text\+0x10 + 14: R_SPARC_DISP32 .text\+0x10 + 18: R_SPARC_32 foo + 1c: R_SPARC_DISP32 foo + 20: R_SPARC_32 foo\+0x10 + 24: R_SPARC_DISP32 foo\+0x10 + 28: R_SPARC_64 .text\+0x8 + 30: R_SPARC_DISP64 .text\+0x8 + 38: R_SPARC_64 foo + 40: R_SPARC_DISP64 foo + 48: R_SPARC_64 foo\+0x10 + 50: R_SPARC_DISP64 foo\+0x10 + 58: R_SPARC_DISP8 .data\+0x18 + 59: R_SPARC_DISP8 .data\+0x64 + 5a: R_SPARC_DISP16 .data\+0x18 + 5c: R_SPARC_DISP16 .data\+0x64 + 60: 00 02 00 00 illtrap 0x20000 + ... diff --git a/gas/testsuite/gas/sparc/pcrel64.s b/gas/testsuite/gas/sparc/pcrel64.s new file mode 100644 index 0000000..166b119 --- /dev/null +++ b/gas/testsuite/gas/sparc/pcrel64.s @@ -0,0 +1,32 @@ + .text + .align 4 +1: nop +2: nop + .globl foo +foo: nop + + .data + .align 32 + .word 0 + .word 1 + .word 1b + 16 + .word %r_disp32(1b + 16) + .word 1b + 16 + .word %r_disp32(1b + 16) +3: .word foo + .word %r_disp32(foo) + .word foo + 16 + .word %r_disp32(foo + 16) + .xword 2b + 4 + .xword %r_disp64(2b + 4) + .xword foo + .xword %r_disp64(foo) + .xword foo + 16 + .xword %r_disp64(foo + 16) + .byte %r_disp8(3b) + .byte %r_disp8(4f) + .half %r_disp16(3b) + .half %r_disp16(4f) + .uaword 2 + .half 0 +4: diff --git a/gas/testsuite/gas/sparc/plt.d b/gas/testsuite/gas/sparc/plt.d new file mode 100644 index 0000000..6b4ac27 --- /dev/null +++ b/gas/testsuite/gas/sparc/plt.d @@ -0,0 +1,23 @@ +#as: -K PIC +#objdump: -Dr +#name: plt relocs + +.*: +file format .*sparc.* + +Disassembly of section .text: + +0+ <.text>: + 0: 40 00 00 00 call 0x0 + 0: R_SPARC_WPLT30 foo + 4: 01 00 00 00 nop + 8: 40 00 00 00 call 0x8 + 8: R_SPARC_WPLT30 bar\+0x4 +Disassembly of section .data: + +0+ <.data>: + ... + 0: R_SPARC_PLT32 foo + 4: R_SPARC_PLT32 bar\+0x4 + 8: 01 00 00 00 nop + 9: R_SPARC_PLT32 foo + c: 00 02 03 04 (unimp|illtrap) 0x20304 diff --git a/gas/testsuite/gas/sparc/plt.s b/gas/testsuite/gas/sparc/plt.s new file mode 100644 index 0000000..b7b4d09 --- /dev/null +++ b/gas/testsuite/gas/sparc/plt.s @@ -0,0 +1,12 @@ + .text + .align 4 + call foo + nop + call bar + 4 + .data + .align 4 + .word %r_plt32(foo) + .word %r_plt32(bar + 4) + .byte 1 + .uaword %r_plt32(foo) + .byte 2, 3, 4 diff --git a/gas/testsuite/gas/sparc/plt64.d b/gas/testsuite/gas/sparc/plt64.d new file mode 100644 index 0000000..736515b --- /dev/null +++ b/gas/testsuite/gas/sparc/plt64.d @@ -0,0 +1,26 @@ +#as: -K PIC -64 +#objdump: -Dr +#name: plt 64-bit relocs + +.*: +file format .*sparc.* + +Disassembly of section .text: + +0+ <.text>: + 0: 40 00 00 00 call 0x0 + 0: R_SPARC_WPLT30 foo + 4: 01 00 00 00 nop + 8: 40 00 00 00 call 0x8 + 8: R_SPARC_WPLT30 bar\+0x4 +Disassembly of section .data: + +0+ <.data>: + ... + 0: R_SPARC_PLT64 foo + 8: R_SPARC_PLT64 bar\+0x4 + 10: 01 00 00 00 nop + 11: R_SPARC_PLT64 foo + 14: 00 00 00 00 illtrap 0 + 18: 00 02 03 04 illtrap 0x20304 + 1c: 00 00 00 00 illtrap 0 + 1c: R_SPARC_PLT32 bar\+0x4 diff --git a/gas/testsuite/gas/sparc/plt64.s b/gas/testsuite/gas/sparc/plt64.s new file mode 100644 index 0000000..e5faf20 --- /dev/null +++ b/gas/testsuite/gas/sparc/plt64.s @@ -0,0 +1,13 @@ + .text + .align 4 + call foo + nop + call bar + 4 + .data + .align 8 + .xword %r_plt64(foo) + .xword %r_plt64(bar + 4) + .byte 1 + .uaxword %r_plt64(foo) + .byte 2, 3, 4 + .word %r_plt32(bar + 4) diff --git a/gas/testsuite/gas/sparc/sparc.exp b/gas/testsuite/gas/sparc/sparc.exp index 39bf0f9..7298256 100644 --- a/gas/testsuite/gas/sparc/sparc.exp +++ b/gas/testsuite/gas/sparc/sparc.exp @@ -19,6 +19,8 @@ proc gas_64_check { } { if [istarget sparc*-*-*] { run_dump_test "synth" run_dump_test "unalign" + run_dump_test "pcrel" + run_dump_test "plt" if [gas_64_check] { run_dump_test "asi" run_dump_test "membar" @@ -28,6 +30,8 @@ if [istarget sparc*-*-*] { run_dump_test "rdpr" run_dump_test "wrpr" run_dump_test "reloc64" + run_dump_test "pcrel64" + run_dump_test "plt64" } } |