aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid S. Miller <davem@redhat.com>2008-04-16 08:51:18 +0000
committerDavid S. Miller <davem@redhat.com>2008-04-16 08:51:18 +0000
commit739f7f82beda72a2702c814d5a8af90a91b1c30d (patch)
tree223b463a3e96dd2b75666140540c090a9ecd5b64
parent14a6d8e0dfbb4359a08c77c46e335dbce4c36cfc (diff)
downloadgdb-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.
-rw-r--r--bfd/ChangeLog18
-rw-r--r--bfd/bfd-in2.h5
-rw-r--r--bfd/elfxx-sparc.c43
-rw-r--r--bfd/libbfd.h5
-rw-r--r--bfd/reloc.c10
-rw-r--r--gas/ChangeLog6
-rw-r--r--gas/config/tc-sparc.c24
-rw-r--r--gas/testsuite/gas/sparc/gotop32.d15
-rw-r--r--gas/testsuite/gas/sparc/gotop32.s9
-rw-r--r--gas/testsuite/gas/sparc/gotop64.d15
-rw-r--r--gas/testsuite/gas/sparc/gotop64.s9
-rw-r--r--gas/testsuite/gas/sparc/sparc.exp5
-rw-r--r--ld/testsuite/ChangeLog14
-rw-r--r--ld/testsuite/ld-sparc/gotop32.dd28
-rw-r--r--ld/testsuite/ld-sparc/gotop32.rd70
-rw-r--r--ld/testsuite/ld-sparc/gotop32.s28
-rw-r--r--ld/testsuite/ld-sparc/gotop32.sd10
-rw-r--r--ld/testsuite/ld-sparc/gotop32.td12
-rw-r--r--ld/testsuite/ld-sparc/gotop64.dd28
-rw-r--r--ld/testsuite/ld-sparc/gotop64.rd70
-rw-r--r--ld/testsuite/ld-sparc/gotop64.s28
-rw-r--r--ld/testsuite/ld-sparc/gotop64.sd10
-rw-r--r--ld/testsuite/ld-sparc/gotop64.td12
-rw-r--r--ld/testsuite/ld-sparc/sparc.exp10
24 files changed, 474 insertions, 10 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 5726af5..c111604 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,21 @@
+2008-04-16 David S. Miller <davem@davemloft.net>
+
+ * 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.
+
2008-04-14 Aurelien Jarno <aurelien@aurel32.net>
* configure.in: Link with the PIC version of libiberty on
diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
index 1427421..a3af3ce 100644
--- a/bfd/bfd-in2.h
+++ b/bfd/bfd-in2.h
@@ -2400,6 +2400,11 @@ relocation types already defined. */
BFD_RELOC_SPARC_UA16,
BFD_RELOC_SPARC_UA32,
BFD_RELOC_SPARC_UA64,
+ 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,
/* I think these are specific to SPARC a.out (e.g., Sun 4). */
BFD_RELOC_SPARC_BASE13,
diff --git a/bfd/elfxx-sparc.c b/bfd/elfxx-sparc.c
index 057e719..7b81555 100644
--- a/bfd/elfxx-sparc.c
+++ b/bfd/elfxx-sparc.c
@@ -258,7 +258,12 @@ static reloc_howto_type _bfd_sparc_elf_howto_table[] =
HOWTO(R_SPARC_TLS_DTPOFF32,0,2,32,FALSE,0,complain_overflow_bitfield,bfd_elf_generic_reloc,"R_SPARC_TLS_DTPOFF32",FALSE,0,0xffffffff,TRUE),
HOWTO(R_SPARC_TLS_DTPOFF64,0,4,64,FALSE,0,complain_overflow_bitfield,bfd_elf_generic_reloc,"R_SPARC_TLS_DTPOFF64",FALSE,0,MINUS_ONE,TRUE),
HOWTO(R_SPARC_TLS_TPOFF32,0,0, 0,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_TLS_TPOFF32",FALSE,0,0x00000000,TRUE),
- HOWTO(R_SPARC_TLS_TPOFF64,0,0, 0,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_TLS_TPOFF64",FALSE,0,0x00000000,TRUE)
+ HOWTO(R_SPARC_TLS_TPOFF64,0,0, 0,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_TLS_TPOFF64",FALSE,0,0x00000000,TRUE),
+ HOWTO(R_SPARC_GOTDATA_HIX22,0,2,0,FALSE,0,complain_overflow_bitfield,sparc_elf_hix22_reloc,"R_SPARC_GOTDATA_HIX22",FALSE,0,0x003fffff, FALSE),
+ HOWTO(R_SPARC_GOTDATA_LOX10,0,2,0,FALSE,0,complain_overflow_dont, sparc_elf_lox10_reloc, "R_SPARC_GOTDATA_LOX10",FALSE,0,0x000003ff, FALSE),
+ HOWTO(R_SPARC_GOTDATA_OP_HIX22,0,2,0,FALSE,0,complain_overflow_bitfield,sparc_elf_hix22_reloc,"R_SPARC_GOTDATA_OP_HIX22",FALSE,0,0x003fffff, FALSE),
+ HOWTO(R_SPARC_GOTDATA_OP_LOX10,0,2,0,FALSE,0,complain_overflow_dont, sparc_elf_lox10_reloc, "R_SPARC_GOTDATA_OP_LOX10",FALSE,0,0x000003ff, FALSE),
+ HOWTO(R_SPARC_GOTDATA_OP,0,0, 0,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_GOTDATA_OP",FALSE,0,0x00000000,TRUE),
};
static reloc_howto_type sparc_vtinherit_howto =
HOWTO (R_SPARC_GNU_VTINHERIT, 0,2,0,FALSE,0,complain_overflow_dont, NULL, "R_SPARC_GNU_VTINHERIT", FALSE,0, 0, FALSE);
@@ -349,6 +354,11 @@ static const struct elf_reloc_map sparc_reloc_map[] =
{ BFD_RELOC_SPARC_H44, R_SPARC_H44 },
{ BFD_RELOC_SPARC_M44, R_SPARC_M44 },
{ BFD_RELOC_SPARC_L44, R_SPARC_L44 },
+ { BFD_RELOC_SPARC_GOTDATA_HIX22, R_SPARC_GOTDATA_HIX22 },
+ { BFD_RELOC_SPARC_GOTDATA_LOX10, R_SPARC_GOTDATA_LOX10 },
+ { BFD_RELOC_SPARC_GOTDATA_OP_HIX22, R_SPARC_GOTDATA_OP_HIX22 },
+ { BFD_RELOC_SPARC_GOTDATA_OP_LOX10, R_SPARC_GOTDATA_OP_LOX10 },
+ { BFD_RELOC_SPARC_GOTDATA_OP, R_SPARC_GOTDATA_OP },
{ BFD_RELOC_SPARC_REGISTER, R_SPARC_REGISTER },
{ BFD_RELOC_VTABLE_INHERIT, R_SPARC_GNU_VTINHERIT },
{ BFD_RELOC_VTABLE_ENTRY, R_SPARC_GNU_VTENTRY },
@@ -1178,6 +1188,10 @@ _bfd_sparc_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
case R_SPARC_GOT10:
case R_SPARC_GOT13:
case R_SPARC_GOT22:
+ case R_SPARC_GOTDATA_HIX22:
+ case R_SPARC_GOTDATA_LOX10:
+ case R_SPARC_GOTDATA_OP_HIX22:
+ case R_SPARC_GOTDATA_OP_LOX10:
case R_SPARC_TLS_GD_HI22:
case R_SPARC_TLS_GD_LO10:
/* This symbol requires a global offset table entry. */
@@ -1190,6 +1204,10 @@ _bfd_sparc_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
case R_SPARC_GOT10:
case R_SPARC_GOT13:
case R_SPARC_GOT22:
+ case R_SPARC_GOTDATA_HIX22:
+ case R_SPARC_GOTDATA_LOX10:
+ case R_SPARC_GOTDATA_OP_HIX22:
+ case R_SPARC_GOTDATA_OP_LOX10:
tls_type = GOT_NORMAL;
break;
case R_SPARC_TLS_GD_HI22:
@@ -1622,6 +1640,10 @@ _bfd_sparc_elf_gc_sweep_hook (bfd *abfd, struct bfd_link_info *info,
case R_SPARC_GOT10:
case R_SPARC_GOT13:
case R_SPARC_GOT22:
+ case R_SPARC_GOTDATA_HIX22:
+ case R_SPARC_GOTDATA_LOX10:
+ case R_SPARC_GOTDATA_OP_HIX22:
+ case R_SPARC_GOTDATA_OP_LOX10:
if (h != NULL)
{
if (h->got.refcount > 0)
@@ -2606,6 +2628,20 @@ _bfd_sparc_elf_relocate_section (bfd *output_bfd,
switch (r_type)
{
+ case R_SPARC_GOTDATA_HIX22:
+ case R_SPARC_GOTDATA_LOX10:
+ case R_SPARC_GOTDATA_OP_HIX22:
+ case R_SPARC_GOTDATA_OP_LOX10:
+ /* We don't support these code transformation optimizations
+ yet, so just leave the sequence alone and treat as
+ GOT22/GOT10. */
+ if (r_type == R_SPARC_GOTDATA_HIX22
+ || r_type == R_SPARC_GOTDATA_OP_HIX22)
+ r_type = R_SPARC_GOT22;
+ else
+ r_type = R_SPARC_GOT10;
+ /* Fall through. */
+
case R_SPARC_GOT10:
case R_SPARC_GOT13:
case R_SPARC_GOT22:
@@ -3256,6 +3292,11 @@ _bfd_sparc_elf_relocate_section (bfd *output_bfd,
}
continue;
+ case R_SPARC_GOTDATA_OP:
+ /* We don't support gotdata code transformation optimizations
+ yet, so simply leave the sequence as-is. */
+ continue;
+
case R_SPARC_TLS_IE_LD:
case R_SPARC_TLS_IE_LDX:
if (! info->shared && (h == NULL || h->dynindx == -1))
diff --git a/bfd/libbfd.h b/bfd/libbfd.h
index 1b44720..2c97498 100644
--- a/bfd/libbfd.h
+++ b/bfd/libbfd.h
@@ -862,6 +862,11 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
"BFD_RELOC_SPARC_UA16",
"BFD_RELOC_SPARC_UA32",
"BFD_RELOC_SPARC_UA64",
+ "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",
"BFD_RELOC_SPARC_BASE13",
"BFD_RELOC_SPARC_BASE22",
"BFD_RELOC_SPARC_10",
diff --git a/bfd/reloc.c b/bfd/reloc.c
index 027ede0..03f0f9f 100644
--- a/bfd/reloc.c
+++ b/bfd/reloc.c
@@ -1830,6 +1830,16 @@ ENUMX
BFD_RELOC_SPARC_UA32
ENUMX
BFD_RELOC_SPARC_UA64
+ENUMX
+ BFD_RELOC_SPARC_GOTDATA_HIX22
+ENUMX
+ BFD_RELOC_SPARC_GOTDATA_LOX10
+ENUMX
+ BFD_RELOC_SPARC_GOTDATA_OP_HIX22
+ENUMX
+ BFD_RELOC_SPARC_GOTDATA_OP_LOX10
+ENUMX
+ BFD_RELOC_SPARC_GOTDATA_OP
ENUMDOC
SPARC ELF relocations. There is probably some overlap with other
relocation types already defined.
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"
diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog
index f199728..627d933 100644
--- a/ld/testsuite/ChangeLog
+++ b/ld/testsuite/ChangeLog
@@ -1,3 +1,17 @@
+2008-04-16 David S. Miller <davem@davemloft.net>
+
+ * 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.
+
2008-04-15 Andrew Stubbs <andrew.stubbs@st.com>
* ld-sh/arch/sh-dsp.s: Regenerate.
diff --git a/ld/testsuite/ld-sparc/gotop32.dd b/ld/testsuite/ld-sparc/gotop32.dd
new file mode 100644
index 0000000..9f6b1f6
--- /dev/null
+++ b/ld/testsuite/ld-sparc/gotop32.dd
@@ -0,0 +1,28 @@
+#source: gotop32.s
+#as: --32 -K PIC
+#ld: -shared -melf32_sparc
+#objdump: -drj.text
+#target: sparc*-*-*
+
+.*: +file format elf32-sparc
+
+Disassembly of section .text:
+00001000 <foo-0x8>:
+ +1000: 81 c3 e0 08 retl *
+ +1004: ae 03 c0 17 add %o7, %l7, %l7
+
+00001008 <foo>:
+ +1008: 9d e3 bf 98 save %sp, -104, %sp
+ +100c: 2f 00 00 44 sethi %hi\(0x11000\), %l7
+ +1010: 7f ff ff fc call 1000 <_.*>
+ +1014: ae 05 e0 60 add %l7, 0x60, %l7 ! 11060 <.*>
+ +1018: 01 00 00 00 nop *
+ +101c: 23 00 00 04 sethi %hi\(0x1000\), %l1
+ +1020: 01 00 00 00 nop *
+ +1024: a2 1c 60 04 xor %l1, 4, %l1
+ +1028: 01 00 00 00 nop *
+ +102c: f0 05 c0 11 ld \[ %l7 \+ %l1 \], %i0
+ +1030: 01 00 00 00 nop *
+ +1034: 81 c7 e0 08 ret
+ +1038: 81 e8 00 00 restore
+#pass
diff --git a/ld/testsuite/ld-sparc/gotop32.rd b/ld/testsuite/ld-sparc/gotop32.rd
new file mode 100644
index 0000000..e4b4295
--- /dev/null
+++ b/ld/testsuite/ld-sparc/gotop32.rd
@@ -0,0 +1,70 @@
+#source: gotop32.s
+#as: --32 -K PIC
+#ld: -shared -melf32_sparc
+#readelf: -WSsrl
+#target: sparc*-*-*
+
+There are [0-9]+ section headers, starting at offset 0x[0-9a-f]+:
+
+Section Headers:
+ +\[Nr\] Name +Type +Addr +Off +Size +ES Flg Lk Inf Al
+ +\[[ 0-9]+\] +NULL +0+ 0+ 0+ 0+ +0 +0 +0
+ +\[[ 0-9]+\] .hash +.*
+ +\[[ 0-9]+\] .dynsym +.*
+ +\[[ 0-9]+\] .dynstr +.*
+ +\[[ 0-9]+\] .rela.dyn +.*
+ +\[[ 0-9]+\] .text +PROGBITS +0+1000 0+1000 0+1000 0+ +AX +0 +0 4096
+ +\[[ 0-9]+\] .dynamic +DYNAMIC +0+12000 0+2000 0+70 08 +WA +3 +0 +4
+ +\[[ 0-9]+\] .got +PROGBITS +0+12070 0+2070 0+8 04 +WA +0 +0 +4
+ +\[[ 0-9]+\] .data +PROGBITS +0+13000 0+3000 0+1000 00 +WA +0 +0 4096
+ +\[[ 0-9]+\] .shstrtab +.*
+ +\[[ 0-9]+\] .symtab +.*
+ +\[[ 0-9]+\] .strtab +.*
+#...
+
+Elf file type is DYN \(Shared object file\)
+Entry point 0x1000
+There are [0-9]+ program headers, starting at offset [0-9]+
+
+Program Headers:
+ +Type +Offset +VirtAddr +PhysAddr +FileSiz MemSiz +Flg Align
+ +LOAD +0x0+ 0x0+ 0x0+ 0x0+2000 0x0+2000 R E 0x10000
+ +LOAD +0x0+2000 0x0+12000 0x0+12000 0x0+2000 0x0+2000 RW +0x10000
+ +DYNAMIC +0x0+2000 0x0+12000 0x0+12000 0x0+70 0x0+70 RW +0x4
+#...
+
+Relocation section '.rela.dyn' at offset 0x[0-9a-f]+ contains 1 entries:
+ Offset +Info +Type +Sym. Value +Symbol's Name \+ Addend
+[0-9a-f ]+R_SPARC_GLOB_DAT +0+13000 +sym \+ 0
+
+Symbol table '\.dynsym' contains [0-9]+ entries:
+ +Num: +Value +Size Type +Bind +Vis +Ndx Name
+.* NOTYPE +LOCAL +DEFAULT +UND *
+.* SECTION LOCAL +DEFAULT +5 *
+.* SECTION LOCAL +DEFAULT +7 *
+.* NOTYPE +GLOBAL DEFAULT +ABS __bss_start
+.* FUNC +GLOBAL DEFAULT +5 foo
+.* NOTYPE +GLOBAL DEFAULT +ABS _edata
+.* NOTYPE +GLOBAL DEFAULT +ABS _end
+.* NOTYPE +GLOBAL DEFAULT +8 sym
+
+Symbol table '\.symtab' contains [0-9]+ entries:
+ +Num: +Value +Size Type +Bind +Vis +Ndx Name
+.* NOTYPE +LOCAL +DEFAULT +UND *
+.* SECTION LOCAL +DEFAULT +1 *
+.* SECTION LOCAL +DEFAULT +2 *
+.* SECTION LOCAL +DEFAULT +3 *
+.* SECTION LOCAL +DEFAULT +4 *
+.* SECTION LOCAL +DEFAULT +5 *
+.* SECTION LOCAL +DEFAULT +6 *
+.* SECTION LOCAL +DEFAULT +7 *
+.* SECTION LOCAL +DEFAULT +8 *
+.* OBJECT +LOCAL +HIDDEN +ABS _DYNAMIC
+.* OBJECT +LOCAL +HIDDEN +ABS _PROCEDURE_LINKAGE_TABLE_
+.* OBJECT +LOCAL +HIDDEN +ABS _GLOBAL_OFFSET_TABLE_
+.* NOTYPE +GLOBAL DEFAULT +ABS __bss_start
+.* FUNC +GLOBAL DEFAULT +5 foo
+.* NOTYPE +GLOBAL DEFAULT +ABS _edata
+.* NOTYPE +GLOBAL DEFAULT +ABS _end
+.* NOTYPE +GLOBAL DEFAULT +8 sym
+
diff --git a/ld/testsuite/ld-sparc/gotop32.s b/ld/testsuite/ld-sparc/gotop32.s
new file mode 100644
index 0000000..ac01d6f
--- /dev/null
+++ b/ld/testsuite/ld-sparc/gotop32.s
@@ -0,0 +1,28 @@
+ .data
+ .align 4096
+ .globl sym
+sym: .word 0x12345678
+
+ .text
+ .align 4096
+.LLGETPC0:
+ retl
+ add %o7, %l7, %l7
+
+ .globl foo
+ .type foo,#function
+ .proc 04
+foo:
+ save %sp, -104, %sp
+ sethi %hi(_GLOBAL_OFFSET_TABLE_-4), %l7
+ call .LLGETPC0
+ add %l7, %lo(_GLOBAL_OFFSET_TABLE_+4), %l7
+ nop
+ sethi %gdop_hix22(sym), %l1
+ nop
+ xor %l1, %gdop_lox10(sym), %l1
+ nop
+ ld [%l7 + %l1], %i0, %gdop(sym)
+ nop
+ ret
+ restore
diff --git a/ld/testsuite/ld-sparc/gotop32.sd b/ld/testsuite/ld-sparc/gotop32.sd
new file mode 100644
index 0000000..fc16756
--- /dev/null
+++ b/ld/testsuite/ld-sparc/gotop32.sd
@@ -0,0 +1,10 @@
+#source: gotop32.s
+#as: --32 -K PIC
+#ld: -shared -melf32_sparc
+#objdump: -sj.got
+#target: sparc*-*-*
+
+.*: +file format elf32-sparc
+
+Contents of section .got:
+ 12070 00012000 00000000 .*
diff --git a/ld/testsuite/ld-sparc/gotop32.td b/ld/testsuite/ld-sparc/gotop32.td
new file mode 100644
index 0000000..e73482d
--- /dev/null
+++ b/ld/testsuite/ld-sparc/gotop32.td
@@ -0,0 +1,12 @@
+#source: gotop32.s
+#as: --32 -K PIC
+#ld: -shared -melf32_sparc
+#objdump: -sj.data
+#target: sparc*-*-*
+
+.*: +file format elf32-sparc
+
+Contents of section .data:
+ 13000 12345678 00000000 00000000 00000000 .*
+ 13010 00000000 00000000 00000000 00000000 .*
+#pass
diff --git a/ld/testsuite/ld-sparc/gotop64.dd b/ld/testsuite/ld-sparc/gotop64.dd
new file mode 100644
index 0000000..a78f55a
--- /dev/null
+++ b/ld/testsuite/ld-sparc/gotop64.dd
@@ -0,0 +1,28 @@
+#source: gotop64.s
+#as: --64 -K PIC
+#ld: -shared -melf64_sparc
+#objdump: -drj.text
+#target: sparc*-*-*
+
+.*: +file format elf64-sparc
+
+Disassembly of section .text:
+0000000000001000 <foo-0x8>:
+ +1000: 81 c3 e0 08 retl *
+ +1004: ae 03 c0 17 add %o7, %l7, %l7
+
+0000000000001008 <foo>:
+ +1008: 9d e3 bf 60 save %sp, -160, %sp
+ +100c: 2f 00 04 04 sethi %hi\(0x101000\), %l7
+ +1010: 7f ff ff fc call 1000 <_.*>
+ +1014: ae 05 e0 d0 add %l7, 0xd0, %l7 ! 1010d0 <.*>
+ +1018: 01 00 00 00 nop *
+ +101c: 23 00 00 08 sethi %hi\(0x2000\), %l1
+ +1020: 01 00 00 00 nop *
+ +1024: a2 1c 60 08 xor %l1, 8, %l1
+ +1028: 01 00 00 00 nop *
+ +102c: f0 5d c0 11 ldx \[ %l7 \+ %l1 \], %i0
+ +1030: 01 00 00 00 nop *
+ +1034: 81 c7 e0 08 ret
+ +1038: 81 e8 00 00 restore
+#pass
diff --git a/ld/testsuite/ld-sparc/gotop64.rd b/ld/testsuite/ld-sparc/gotop64.rd
new file mode 100644
index 0000000..24cf94f
--- /dev/null
+++ b/ld/testsuite/ld-sparc/gotop64.rd
@@ -0,0 +1,70 @@
+#source: gotop64.s
+#as: --64 -K PIC
+#ld: -shared -melf64_sparc
+#readelf: -WSsrl
+#target: sparc*-*-*
+
+There are [0-9]+ section headers, starting at offset 0x[0-9a-f]+:
+
+Section Headers:
+ +\[Nr\] Name +Type +Address +Off +Size +ES Flg Lk Inf Al
+ +\[[ 0-9]+\] +NULL +0+ 0+ 0+ 0+ +0 +0 +0
+ +\[[ 0-9]+\] .hash +.*
+ +\[[ 0-9]+\] .dynsym +.*
+ +\[[ 0-9]+\] .dynstr +.*
+ +\[[ 0-9]+\] .rela.dyn +.*
+ +\[[ 0-9]+\] .text +PROGBITS +0+1000 0+1000 0+1000 0+ +AX +0 +0 4096
+ +\[[ 0-9]+\] .dynamic +DYNAMIC +0+102000 0+2000 0+e0 10 +WA +3 +0 +8
+ +\[[ 0-9]+\] .got +PROGBITS +0+1020e0 0+20e0 0+10 08 +WA +0 +0 +8
+ +\[[ 0-9]+\] .data +PROGBITS +0+103000 0+3000 0+1000 00 +WA +0 +0 4096
+ +\[[ 0-9]+\] .shstrtab +.*
+ +\[[ 0-9]+\] .symtab +.*
+ +\[[ 0-9]+\] .strtab +.*
+#...
+
+Elf file type is DYN \(Shared object file\)
+Entry point 0x1000
+There are [0-9]+ program headers, starting at offset [0-9]+
+
+Program Headers:
+ +Type +Offset +VirtAddr +PhysAddr +FileSiz +MemSiz +Flg Align
+ +LOAD +0x0+ 0x0+ 0x0+ 0x0+2000 0x0+2000 R E 0x100000
+ +LOAD +0x0+2000 0x0+102000 0x0+102000 0x0+2000 0x0+2000 RW +0x100000
+ +DYNAMIC +0x0+2000 0x0+102000 0x0+102000 0x0+e0 0x0+e0 RW +0x8
+#...
+
+Relocation section '.rela.dyn' at offset 0x[0-9a-f]+ contains 1 entries:
+ +Offset +Info +Type +Symbol's Value +Symbol's Name \+ Addend
+[0-9a-f ]+R_SPARC_GLOB_DAT +0+103000 +sym \+ 0
+
+Symbol table '\.dynsym' contains [0-9]+ entries:
+ +Num: +Value +Size Type +Bind +Vis +Ndx Name
+.* NOTYPE +LOCAL +DEFAULT +UND *
+.* SECTION LOCAL +DEFAULT +5 *
+.* SECTION LOCAL +DEFAULT +7 *
+.* NOTYPE +GLOBAL DEFAULT +ABS __bss_start
+.* FUNC +GLOBAL DEFAULT +5 foo
+.* NOTYPE +GLOBAL DEFAULT +ABS _edata
+.* NOTYPE +GLOBAL DEFAULT +ABS _end
+.* NOTYPE +GLOBAL DEFAULT +8 sym
+
+Symbol table '\.symtab' contains [0-9]+ entries:
+ +Num: +Value +Size Type +Bind +Vis +Ndx Name
+.* NOTYPE +LOCAL +DEFAULT +UND *
+.* SECTION LOCAL +DEFAULT +1 *
+.* SECTION LOCAL +DEFAULT +2 *
+.* SECTION LOCAL +DEFAULT +3 *
+.* SECTION LOCAL +DEFAULT +4 *
+.* SECTION LOCAL +DEFAULT +5 *
+.* SECTION LOCAL +DEFAULT +6 *
+.* SECTION LOCAL +DEFAULT +7 *
+.* SECTION LOCAL +DEFAULT +8 *
+.* OBJECT +LOCAL +HIDDEN +ABS _DYNAMIC
+.* OBJECT +LOCAL +HIDDEN +ABS _PROCEDURE_LINKAGE_TABLE_
+.* OBJECT +LOCAL +HIDDEN +ABS _GLOBAL_OFFSET_TABLE_
+.* NOTYPE +GLOBAL DEFAULT +ABS __bss_start
+.* FUNC +GLOBAL DEFAULT +5 foo
+.* NOTYPE +GLOBAL DEFAULT +ABS _edata
+.* NOTYPE +GLOBAL DEFAULT +ABS _end
+.* NOTYPE +GLOBAL DEFAULT +8 sym
+
diff --git a/ld/testsuite/ld-sparc/gotop64.s b/ld/testsuite/ld-sparc/gotop64.s
new file mode 100644
index 0000000..8a8ff82
--- /dev/null
+++ b/ld/testsuite/ld-sparc/gotop64.s
@@ -0,0 +1,28 @@
+ .data
+ .align 4096
+ .globl sym
+sym: .word 0x12345678
+
+ .text
+ .align 4096
+.LLGETPC0:
+ retl
+ add %o7, %l7, %l7
+
+ .globl foo
+ .type foo,#function
+ .proc 04
+foo:
+ save %sp, -160, %sp
+ sethi %hi(_GLOBAL_OFFSET_TABLE_-4), %l7
+ call .LLGETPC0
+ add %l7, %lo(_GLOBAL_OFFSET_TABLE_+4), %l7
+ nop
+ sethi %gdop_hix22(sym), %l1
+ nop
+ xor %l1, %gdop_lox10(sym), %l1
+ nop
+ ldx [%l7 + %l1], %i0, %gdop(sym)
+ nop
+ ret
+ restore
diff --git a/ld/testsuite/ld-sparc/gotop64.sd b/ld/testsuite/ld-sparc/gotop64.sd
new file mode 100644
index 0000000..9ab0f61
--- /dev/null
+++ b/ld/testsuite/ld-sparc/gotop64.sd
@@ -0,0 +1,10 @@
+#source: gotop64.s
+#as: --64 -K PIC
+#ld: -shared -melf64_sparc
+#objdump: -sj.got
+#target: sparc*-*-*
+
+.*: +file format elf64-sparc
+
+Contents of section .got:
+ 1020e0 00000000 00102000 00000000 00000000 .*
diff --git a/ld/testsuite/ld-sparc/gotop64.td b/ld/testsuite/ld-sparc/gotop64.td
new file mode 100644
index 0000000..f16cf50
--- /dev/null
+++ b/ld/testsuite/ld-sparc/gotop64.td
@@ -0,0 +1,12 @@
+#source: gotop64.s
+#as: --64 -K PIC
+#ld: -shared -melf64_sparc
+#objdump: -sj.data
+#target: sparc*-*-*
+
+.*: +file format elf64-sparc
+
+Contents of section .data:
+ 103000 12345678 00000000 00000000 00000000 .*
+ 103010 00000000 00000000 00000000 00000000 .*
+#pass
diff --git a/ld/testsuite/ld-sparc/sparc.exp b/ld/testsuite/ld-sparc/sparc.exp
index d54c311..e41dfe5 100644
--- a/ld/testsuite/ld-sparc/sparc.exp
+++ b/ld/testsuite/ld-sparc/sparc.exp
@@ -89,6 +89,11 @@ set sparctests {
{"32-bit: TLS in debug sections" "-melf32_sparc"
"--32" {tlsg32.s}
{{objdump -sj.debug_foobar tlsg32.sd}} "tlsg32"}
+ {"32-bit: GOTDATA relocations" "-shared -melf32_sparc"
+ "--32 -K PIC" {gotop32.s}
+ {{readelf -WSsrl gotop32.rd} {objdump -drj.text gotop32.dd}
+ {objdump -sj.got gotop32.sd} {objdump -sj.data gotop32.td}}
+ "libgotop32.so"}
}
set sparc64tests {
{"64-bit: TLS -fpic -shared transitions" "-shared -melf64_sparc"
@@ -113,6 +118,11 @@ set sparc64tests {
{"64-bit: TLS in debug sections" "-melf64_sparc"
"--64 -Av9" {tlsg64.s}
{{objdump -sj.debug_foobar tlsg64.sd}} "tlsg64"}
+ {"64-bit: GOTDATA relocations" "-shared -melf64_sparc"
+ "--64 -K PIC" {gotop64.s}
+ {{readelf -WSsrl gotop64.rd} {objdump -drj.text gotop64.dd}
+ {objdump -sj.got gotop64.sd} {objdump -sj.data gotop64.td}}
+ "libgotop64.so"}
}
if { ![istarget "sparc64-*-elf*"] } {