diff options
author | David S. Miller <davem@redhat.com> | 2008-04-16 08:51:18 +0000 |
---|---|---|
committer | David S. Miller <davem@redhat.com> | 2008-04-16 08:51:18 +0000 |
commit | 739f7f82beda72a2702c814d5a8af90a91b1c30d (patch) | |
tree | 223b463a3e96dd2b75666140540c090a9ecd5b64 /gas | |
parent | 14a6d8e0dfbb4359a08c77c46e335dbce4c36cfc (diff) | |
download | gdb-739f7f82beda72a2702c814d5a8af90a91b1c30d.zip gdb-739f7f82beda72a2702c814d5a8af90a91b1c30d.tar.gz gdb-739f7f82beda72a2702c814d5a8af90a91b1c30d.tar.bz2 |
bfd/
* reloc.c (BFD_RELOC_SPARC_GOTDATA_HIX22,
BFD_RELOC_SPARC_GOTDATA_LOX10, BFD_RELOC_SPARC_GOTDATA_OP_HIX22,
BFD_RELOC_SPARC_GOTDATA_OP_LOX10, BFD_RELOC_SPARC_GOTDATA_OP): New.
* libbfd.h: Regnerate.
* bfd-in2.h: Regenerate.
* elfxx-sparc.c (_bfd_sparc_elf_howto_table): Add entries for
GOTDATA relocations.
(sparc_reloc_map): Likewise.
(_bfd_sparc_elf_check_relocs): Handle R_SPARC_GOTDATA_* like
R_SPARC_GOT*.
(_bfd_sparc_elf_gc_sweep_hook): Likewise.
(_bfd_sparc_elf_relocate_section): Transform R_SPARC_GOTDATA_HIX22,
R_SPARC_GOTDATA_LOX10, R_SPARC_GOTDATA_OP_HIX22, and
R_SPARC_GOTDATA_OP_LOX10 into the equivalent R_SPARC_GOT* reloc.
Simply ignore R_SPARC_GOTDATA_OP relocations.
gas/
* config/tc-sparc.c (sparc_ip): Add support for gotdata mnemonics
and relocation generation.
(tc_gen_reloc): Likewise.
gas/testsuite/
* gas/sparc/gotops32.d: New.
* gas/sparc/gotops32.s: Likewise.
* gas/sparc/gotops64.d: Likewise.
* gas/sparc/gotops64.s: Likewise.
* gas/sparc/sparc.exp: Run new gotdata tests.
ld/testsuite/
* ld-sparc/gotop32.dd: New.
* ld-sparc/gotop32.rd: Likewise.
* ld-sparc/gotop32.s: Likewise.
* ld-sparc/gotop32.sd: Likewise.
* ld-sparc/gotop32.td: Likewise.
* ld-sparc/gotop64.dd: Likewise.
* ld-sparc/gotop64.rd: Likewise.
* ld-sparc/gotop64.s: Likewise.
* ld-sparc/gotop64.sd: Likewise.
* ld-sparc/gotop64.td: Likewise.
* ld-sparc/sparc.exp: Run new gotdata tests.
Diffstat (limited to 'gas')
-rw-r--r-- | gas/ChangeLog | 6 | ||||
-rw-r--r-- | gas/config/tc-sparc.c | 24 | ||||
-rw-r--r-- | gas/testsuite/gas/sparc/gotop32.d | 15 | ||||
-rw-r--r-- | gas/testsuite/gas/sparc/gotop32.s | 9 | ||||
-rw-r--r-- | gas/testsuite/gas/sparc/gotop64.d | 15 | ||||
-rw-r--r-- | gas/testsuite/gas/sparc/gotop64.s | 9 | ||||
-rw-r--r-- | gas/testsuite/gas/sparc/sparc.exp | 5 |
7 files changed, 74 insertions, 9 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog index 007dfcd..a86d2df 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,9 @@ +2008-04-16 David S. Miller <davem@davemloft.net> + + * config/tc-sparc.c (sparc_ip): Add support for gotdata mnemonics + and relocation generation. + (tc_gen_reloc): Likewise. + 2008-04-15 Andrew Stubbs <andrew.stubbs@st.com> * config/tc-sh.c (md_apply_fix): Make sure BFD_RELOC_SH_PCRELIMM8BY4 diff --git a/gas/config/tc-sparc.c b/gas/config/tc-sparc.c index e81b1f0..50a469f 100644 --- a/gas/config/tc-sparc.c +++ b/gas/config/tc-sparc.c @@ -1860,7 +1860,7 @@ sparc_ip (str, pinsn) case '\0': /* End of args. */ if (s[0] == ',' && s[1] == '%') { - static const struct tls_ops + static const struct ops { /* The name as it appears in assembler. */ char *name; @@ -1868,10 +1868,10 @@ sparc_ip (str, pinsn) int len; /* The reloc this pseudo-op translates to. */ int reloc; - /* 1 if call. */ - int call; + /* 1 if tls call. */ + int tls_call; } - tls_ops[] = + ops[] = { { "tgd_add", 7, BFD_RELOC_SPARC_TLS_GD_ADD, 0 }, { "tgd_call", 8, BFD_RELOC_SPARC_TLS_GD_CALL, 1 }, @@ -1881,13 +1881,14 @@ sparc_ip (str, pinsn) { "tie_ldx", 7, BFD_RELOC_SPARC_TLS_IE_LDX, 0 }, { "tie_ld", 6, BFD_RELOC_SPARC_TLS_IE_LD, 0 }, { "tie_add", 7, BFD_RELOC_SPARC_TLS_IE_ADD, 0 }, + { "gdop", 4, BFD_RELOC_SPARC_GOTDATA_OP, 0 }, { NULL, 0, 0, 0 } }; - const struct tls_ops *o; + const struct ops *o; char *s1; int npar = 0; - for (o = tls_ops; o->name; o++) + for (o = ops; o->name; o++) if (strncmp (s + 2, o->name, o->len) == 0) break; if (o->name == NULL) @@ -1899,14 +1900,14 @@ sparc_ip (str, pinsn) return special_case; } - if (! o->call && the_insn.reloc != BFD_RELOC_NONE) + if (! o->tls_call && the_insn.reloc != BFD_RELOC_NONE) { as_bad (_("Illegal operands: %%%s cannot be used together with other relocs in the insn ()"), o->name); return special_case; } - if (o->call + if (o->tls_call && (the_insn.reloc != BFD_RELOC_32_PCREL_S2 || the_insn.exp.X_add_number != 0 || the_insn.exp.X_add_symbol @@ -2328,6 +2329,10 @@ sparc_ip (str, pinsn) { "tie_lo10", 8, BFD_RELOC_SPARC_TLS_IE_LO10, 0, 0 }, { "tle_hix22", 9, BFD_RELOC_SPARC_TLS_LE_HIX22, 0, 0 }, { "tle_lox10", 9, BFD_RELOC_SPARC_TLS_LE_LOX10, 0, 0 }, + { "gdop_hix22", 10, BFD_RELOC_SPARC_GOTDATA_OP_HIX22, + 0, 0 }, + { "gdop_lox10", 10, BFD_RELOC_SPARC_GOTDATA_OP_LOX10, + 0, 0 }, { NULL, 0, 0, 0, 0 } }; const struct ops *o; @@ -3445,6 +3450,9 @@ tc_gen_reloc (section, fixp) case BFD_RELOC_SPARC_TLS_LE_LOX10: case BFD_RELOC_SPARC_TLS_DTPOFF32: case BFD_RELOC_SPARC_TLS_DTPOFF64: + case BFD_RELOC_SPARC_GOTDATA_OP_HIX22: + case BFD_RELOC_SPARC_GOTDATA_OP_LOX10: + case BFD_RELOC_SPARC_GOTDATA_OP: code = fixp->fx_r_type; break; default: diff --git a/gas/testsuite/gas/sparc/gotop32.d b/gas/testsuite/gas/sparc/gotop32.d new file mode 100644 index 0000000..76fc627 --- /dev/null +++ b/gas/testsuite/gas/sparc/gotop32.d @@ -0,0 +1,15 @@ +#as: -Av7 +#objdump: -dr +#name: sparc gotop + +.*: +file format .*sparc.* + +Disassembly of section .text: + +0+ <foo>: + 0: 23 00 00 00 sethi %hi\(0\), %l1 + 0: R_SPARC_GOTDATA_OP_HIX22 .data + 4: a2 1c 60 00 xor %l1, 0, %l1 + 4: R_SPARC_GOTDATA_OP_LOX10 .data + 8: e4 05 c0 11 ld \[ %l7 \+ %l1 \], %l2 + 8: R_SPARC_GOTDATA_OP .data diff --git a/gas/testsuite/gas/sparc/gotop32.s b/gas/testsuite/gas/sparc/gotop32.s new file mode 100644 index 0000000..9dc1bff --- /dev/null +++ b/gas/testsuite/gas/sparc/gotop32.s @@ -0,0 +1,9 @@ +# sparc gotop + + .data +sym: .word 0 + + .text +foo: sethi %gdop_hix22(sym), %l1 + xor %l1, %gdop_lox10(sym), %l1 + ld [%l7 + %l1], %l2, %gdop(sym) diff --git a/gas/testsuite/gas/sparc/gotop64.d b/gas/testsuite/gas/sparc/gotop64.d new file mode 100644 index 0000000..8c2d015 --- /dev/null +++ b/gas/testsuite/gas/sparc/gotop64.d @@ -0,0 +1,15 @@ +#as: -64 -Av9 +#objdump: -dr +#name: sparc64 gotop + +.*: +file format .*sparc.* + +Disassembly of section .text: + +0+ <foo>: + 0: 23 00 00 00 sethi %hi\(0\), %l1 + 0: R_SPARC_GOTDATA_OP_HIX22 .data + 4: a2 1c 60 00 xor %l1, 0, %l1 + 4: R_SPARC_GOTDATA_OP_LOX10 .data + 8: e4 5d c0 11 ldx \[ %l7 \+ %l1 \], %l2 + 8: R_SPARC_GOTDATA_OP .data diff --git a/gas/testsuite/gas/sparc/gotop64.s b/gas/testsuite/gas/sparc/gotop64.s new file mode 100644 index 0000000..c69915e --- /dev/null +++ b/gas/testsuite/gas/sparc/gotop64.s @@ -0,0 +1,9 @@ +# sparc64 gotop + + .data +sym: .word 0 + + .text +foo: sethi %gdop_hix22(sym), %l1 + xor %l1, %gdop_lox10(sym), %l1 + ldx [%l7 + %l1], %l2, %gdop(sym) diff --git a/gas/testsuite/gas/sparc/sparc.exp b/gas/testsuite/gas/sparc/sparc.exp index 0111d57..d3eec93 100644 --- a/gas/testsuite/gas/sparc/sparc.exp +++ b/gas/testsuite/gas/sparc/sparc.exp @@ -25,13 +25,15 @@ proc sparc_elf_setup { } { if [istarget sparc*-*-*] { run_dump_test "synth" - # The next three tests are ELF only. + # The next four tests are ELF only. sparc_elf_setup run_dump_test "unalign" sparc_elf_setup run_dump_test "pcrel" sparc_elf_setup run_dump_test "plt" + sparc_elf_setup + run_dump_test "gotop32" if [gas_64_check] { run_dump_test "asi" run_dump_test "membar" @@ -46,6 +48,7 @@ if [istarget sparc*-*-*] { run_dump_test "reloc64" run_dump_test "pcrel64" run_dump_test "plt64" + run_dump_test "gotop64" } run_dump_test "v9branch1" run_dump_test "v9branch2" |