Add support for .uahword, .uaword and .uaxword pseudo ops

This commit is contained in:
Nick Clifton 2001-05-28 09:23:54 +00:00
parent c04a062df3
commit 0f2712edc9
13 changed files with 194 additions and 75 deletions

View File

@ -1,3 +1,12 @@
2001-05-28 Jeff Sturm <jsturm@one-point.com>
* reloc.c: Add BFD_RELOC_SPARC_UA16 and BFD_RELOC_SPARC_UA64.
* bfd-in2.h: Regenerate.
* libbfd.h: Regenerate.
* elf32-sparc.c: Enable BFD_RELOC_SPARC_UA16, BFD_RELOC_SPARC_UA32
and BFD_RELOC_SPARC_UA64 mapping
* elf64-sparc.c: Likewise.
2001-05-25 H.J. Lu <hjl@gnu.org>
* Makefile.am (BFD32_BACKENDS): Remove coff-pmac.lo.

View File

@ -1928,7 +1928,9 @@ relocation types already defined. */
BFD_RELOC_SPARC_GLOB_DAT,
BFD_RELOC_SPARC_JMP_SLOT,
BFD_RELOC_SPARC_RELATIVE,
BFD_RELOC_SPARC_UA16,
BFD_RELOC_SPARC_UA32,
BFD_RELOC_SPARC_UA64,
/* I think these are specific to SPARC a.out (e.g., Sun 4). */
BFD_RELOC_SPARC_BASE13,

View File

@ -120,9 +120,9 @@ reloc_howto_type _bfd_sparc_elf_howto_table[] =
HOWTO(R_SPARC_NONE, 0,0, 0,false,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_NONE", false,0,0x00000000,true),
HOWTO(R_SPARC_NONE, 0,0, 0,false,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_NONE", false,0,0x00000000,true),
HOWTO(R_SPARC_NONE, 0,0, 0,false,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_NONE", false,0,0x00000000,true),
HOWTO(R_SPARC_NONE, 0,0, 0,false,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_NONE", false,0,0x00000000,true),
HOWTO(R_SPARC_NONE, 0,0, 0,false,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_NONE", false,0,0x00000000,true),
HOWTO(R_SPARC_REV32, 0,2,32,false,0,complain_overflow_bitfield,bfd_elf_generic_reloc, "R_SPARC_REV32", false,0,0xffffffff,true),
HOWTO(R_SPARC_UA64, 0,4,64,false,0,complain_overflow_bitfield,bfd_elf_generic_reloc, "R_SPARC_UA64", false,0,(~ (bfd_vma)0), true),
HOWTO(R_SPARC_UA16, 0,1,16,false,0,complain_overflow_bitfield,bfd_elf_generic_reloc, "R_SPARC_UA16", false,0,0x0000ffff,true),
HOWTO(R_SPARC_REV32, 0,2,32,false,0,complain_overflow_bitfield,bfd_elf_generic_reloc, "R_SPARC_REV32", false,0,0xffffffff,true),
};
static reloc_howto_type elf32_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);
@ -159,26 +159,27 @@ static CONST struct elf_reloc_map sparc_reloc_map[] =
{ BFD_RELOC_SPARC_JMP_SLOT, R_SPARC_JMP_SLOT },
{ BFD_RELOC_SPARC_RELATIVE, R_SPARC_RELATIVE },
{ BFD_RELOC_SPARC_WDISP22, R_SPARC_WDISP22 },
/* ??? Doesn't dwarf use this? */
/*{ BFD_RELOC_SPARC_UA32, R_SPARC_UA32 }, not used?? */
{BFD_RELOC_SPARC_10, R_SPARC_10},
{BFD_RELOC_SPARC_11, R_SPARC_11},
{BFD_RELOC_SPARC_64, R_SPARC_64},
{BFD_RELOC_SPARC_OLO10, R_SPARC_OLO10},
{BFD_RELOC_SPARC_HH22, R_SPARC_HH22},
{BFD_RELOC_SPARC_HM10, R_SPARC_HM10},
{BFD_RELOC_SPARC_LM22, R_SPARC_LM22},
{BFD_RELOC_SPARC_PC_HH22, R_SPARC_PC_HH22},
{BFD_RELOC_SPARC_PC_HM10, R_SPARC_PC_HM10},
{BFD_RELOC_SPARC_PC_LM22, R_SPARC_PC_LM22},
{BFD_RELOC_SPARC_WDISP16, R_SPARC_WDISP16},
{BFD_RELOC_SPARC_WDISP19, R_SPARC_WDISP19},
{BFD_RELOC_SPARC_7, R_SPARC_7},
{BFD_RELOC_SPARC_5, R_SPARC_5},
{BFD_RELOC_SPARC_6, R_SPARC_6},
{BFD_RELOC_SPARC_REV32, R_SPARC_REV32 },
{BFD_RELOC_VTABLE_INHERIT, R_SPARC_GNU_VTINHERIT},
{BFD_RELOC_VTABLE_ENTRY, R_SPARC_GNU_VTENTRY},
{ BFD_RELOC_SPARC_UA16, R_SPARC_UA16 },
{ BFD_RELOC_SPARC_UA32, R_SPARC_UA32 },
{ BFD_RELOC_SPARC_UA64, R_SPARC_UA64 },
{ BFD_RELOC_SPARC_10, R_SPARC_10 },
{ BFD_RELOC_SPARC_11, R_SPARC_11 },
{ BFD_RELOC_SPARC_64, R_SPARC_64 },
{ BFD_RELOC_SPARC_OLO10, R_SPARC_OLO10 },
{ BFD_RELOC_SPARC_HH22, R_SPARC_HH22 },
{ BFD_RELOC_SPARC_HM10, R_SPARC_HM10 },
{ BFD_RELOC_SPARC_LM22, R_SPARC_LM22 },
{ BFD_RELOC_SPARC_PC_HH22, R_SPARC_PC_HH22 },
{ BFD_RELOC_SPARC_PC_HM10, R_SPARC_PC_HM10 },
{ BFD_RELOC_SPARC_PC_LM22, R_SPARC_PC_LM22 },
{ BFD_RELOC_SPARC_WDISP16, R_SPARC_WDISP16 },
{ BFD_RELOC_SPARC_WDISP19, R_SPARC_WDISP19 },
{ BFD_RELOC_SPARC_7, R_SPARC_7 },
{ BFD_RELOC_SPARC_5, R_SPARC_5 },
{ BFD_RELOC_SPARC_6, R_SPARC_6 },
{ BFD_RELOC_SPARC_REV32, R_SPARC_REV32 },
{ BFD_RELOC_VTABLE_INHERIT, R_SPARC_GNU_VTINHERIT },
{ BFD_RELOC_VTABLE_ENTRY, R_SPARC_GNU_VTENTRY },
};
static reloc_howto_type *
@ -551,7 +552,9 @@ elf32_sparc_check_relocs (abfd, info, sec, relocs)
case R_SPARC_22:
case R_SPARC_13:
case R_SPARC_LO10:
case R_SPARC_UA16:
case R_SPARC_UA32:
case R_SPARC_UA64:
if (h != NULL)
h->elf_link_hash_flags |= ELF_LINK_NON_GOT_REF;
@ -1218,7 +1221,9 @@ elf32_sparc_relocate_section (output_bfd, info, input_bfd, input_section,
|| r_type == R_SPARC_22
|| r_type == R_SPARC_13
|| r_type == R_SPARC_LO10
|| r_type == R_SPARC_UA16
|| r_type == R_SPARC_UA32
|| r_type == R_SPARC_UA64
|| ((r_type == R_SPARC_PC10
|| r_type == R_SPARC_PC22)
&& strcmp (h->root.root.string,
@ -1405,7 +1410,9 @@ elf32_sparc_relocate_section (output_bfd, info, input_bfd, input_section,
case R_SPARC_22:
case R_SPARC_13:
case R_SPARC_LO10:
case R_SPARC_UA16:
case R_SPARC_UA32:
case R_SPARC_UA64:
if (info->shared)
{
Elf_Internal_Rela outrel;

View File

@ -188,31 +188,32 @@ static CONST struct elf_reloc_map sparc_reloc_map[] =
{ BFD_RELOC_SPARC_JMP_SLOT, R_SPARC_JMP_SLOT },
{ BFD_RELOC_SPARC_RELATIVE, R_SPARC_RELATIVE },
{ BFD_RELOC_SPARC_WDISP22, R_SPARC_WDISP22 },
/* ??? Doesn't dwarf use this? */
/*{ BFD_RELOC_SPARC_UA32, R_SPARC_UA32 }, not used?? */
{BFD_RELOC_SPARC_10, R_SPARC_10},
{BFD_RELOC_SPARC_11, R_SPARC_11},
{BFD_RELOC_SPARC_64, R_SPARC_64},
{BFD_RELOC_SPARC_OLO10, R_SPARC_OLO10},
{BFD_RELOC_SPARC_HH22, R_SPARC_HH22},
{BFD_RELOC_SPARC_HM10, R_SPARC_HM10},
{BFD_RELOC_SPARC_LM22, R_SPARC_LM22},
{BFD_RELOC_SPARC_PC_HH22, R_SPARC_PC_HH22},
{BFD_RELOC_SPARC_PC_HM10, R_SPARC_PC_HM10},
{BFD_RELOC_SPARC_PC_LM22, R_SPARC_PC_LM22},
{BFD_RELOC_SPARC_WDISP16, R_SPARC_WDISP16},
{BFD_RELOC_SPARC_WDISP19, R_SPARC_WDISP19},
{BFD_RELOC_SPARC_7, R_SPARC_7},
{BFD_RELOC_SPARC_5, R_SPARC_5},
{BFD_RELOC_SPARC_6, R_SPARC_6},
{BFD_RELOC_SPARC_DISP64, R_SPARC_DISP64},
{BFD_RELOC_SPARC_PLT64, R_SPARC_PLT64},
{BFD_RELOC_SPARC_HIX22, R_SPARC_HIX22},
{BFD_RELOC_SPARC_LOX10, R_SPARC_LOX10},
{BFD_RELOC_SPARC_H44, R_SPARC_H44},
{BFD_RELOC_SPARC_M44, R_SPARC_M44},
{BFD_RELOC_SPARC_L44, R_SPARC_L44},
{BFD_RELOC_SPARC_REGISTER, R_SPARC_REGISTER}
{ BFD_RELOC_SPARC_UA16, R_SPARC_UA16 },
{ BFD_RELOC_SPARC_UA32, R_SPARC_UA32 },
{ BFD_RELOC_SPARC_UA64, R_SPARC_UA64 },
{ BFD_RELOC_SPARC_10, R_SPARC_10 },
{ BFD_RELOC_SPARC_11, R_SPARC_11 },
{ BFD_RELOC_SPARC_64, R_SPARC_64 },
{ BFD_RELOC_SPARC_OLO10, R_SPARC_OLO10 },
{ BFD_RELOC_SPARC_HH22, R_SPARC_HH22 },
{ BFD_RELOC_SPARC_HM10, R_SPARC_HM10 },
{ BFD_RELOC_SPARC_LM22, R_SPARC_LM22 },
{ BFD_RELOC_SPARC_PC_HH22, R_SPARC_PC_HH22 },
{ BFD_RELOC_SPARC_PC_HM10, R_SPARC_PC_HM10 },
{ BFD_RELOC_SPARC_PC_LM22, R_SPARC_PC_LM22 },
{ BFD_RELOC_SPARC_WDISP16, R_SPARC_WDISP16 },
{ BFD_RELOC_SPARC_WDISP19, R_SPARC_WDISP19 },
{ BFD_RELOC_SPARC_7, R_SPARC_7 },
{ BFD_RELOC_SPARC_5, R_SPARC_5 },
{ BFD_RELOC_SPARC_6, R_SPARC_6 },
{ BFD_RELOC_SPARC_DISP64, R_SPARC_DISP64 },
{ BFD_RELOC_SPARC_PLT64, R_SPARC_PLT64 },
{ BFD_RELOC_SPARC_HIX22, R_SPARC_HIX22 },
{ BFD_RELOC_SPARC_LOX10, R_SPARC_LOX10 },
{ BFD_RELOC_SPARC_H44, R_SPARC_H44 },
{ BFD_RELOC_SPARC_M44, R_SPARC_M44 },
{ BFD_RELOC_SPARC_L44, R_SPARC_L44 },
{ BFD_RELOC_SPARC_REGISTER, R_SPARC_REGISTER }
};
static reloc_howto_type *

View File

@ -671,7 +671,9 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
"BFD_RELOC_SPARC_GLOB_DAT",
"BFD_RELOC_SPARC_JMP_SLOT",
"BFD_RELOC_SPARC_RELATIVE",
"BFD_RELOC_SPARC_UA16",
"BFD_RELOC_SPARC_UA32",
"BFD_RELOC_SPARC_UA64",
"BFD_RELOC_SPARC_BASE13",
"BFD_RELOC_SPARC_BASE22",
"BFD_RELOC_SPARC_10",

View File

@ -6,7 +6,7 @@
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: 2001-05-23 19:09+0100\n"
"POT-Creation-Date: 2001-05-23 19:40+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"

View File

@ -1799,8 +1799,12 @@ ENUMX
BFD_RELOC_SPARC_JMP_SLOT
ENUMX
BFD_RELOC_SPARC_RELATIVE
ENUMX
BFD_RELOC_SPARC_UA16
ENUMX
BFD_RELOC_SPARC_UA32
ENUMX
BFD_RELOC_SPARC_UA64
ENUMDOC
SPARC ELF relocations. There is probably some overlap with other
relocation types already defined.

View File

@ -1,3 +1,12 @@
2001-05-28 Jeff Sturm <jsturm@one-point.com>
* config/tc-sparc.c (md_apply_fix3): Handle BFD_RELOC_SPARC_UA16,
BFD_RELOC_SPARC_UA32 and BFD_RELOC_SPARC_UA64.
(tc_gen_reloc): Likewise.
(sparc_cons_align): Don't clear sparc_no_align_cons.
(cons_fix_new_sparc): Substitute BFD_RELOC_SPARC_UA{16|32|64} for
BFD_RELOC_{16|32|64} iff sparc_no_align_cons is set.
2001-05-27 Alan Modra <amodra@one.net.au>
* write.c (relax_segment <rs_space>): Check the section of a

View File

@ -2971,16 +2971,19 @@ md_apply_fix3 (fixP, value, segment)
/* If this is a data relocation, just output VAL. */
if (fixP->fx_r_type == BFD_RELOC_16)
if (fixP->fx_r_type == BFD_RELOC_16
|| fixP->fx_r_type == BFD_RELOC_SPARC_UA16)
{
md_number_to_chars (buf, val, 2);
}
else if (fixP->fx_r_type == BFD_RELOC_32
|| fixP->fx_r_type == BFD_RELOC_SPARC_UA32
|| fixP->fx_r_type == BFD_RELOC_SPARC_REV32)
{
md_number_to_chars (buf, val, 4);
}
else if (fixP->fx_r_type == BFD_RELOC_64)
else if (fixP->fx_r_type == BFD_RELOC_64
|| fixP->fx_r_type == BFD_RELOC_SPARC_UA64)
{
md_number_to_chars (buf, val, 8);
}
@ -3316,6 +3319,9 @@ tc_gen_reloc (section, fixp)
case BFD_RELOC_SPARC_LOX10:
case BFD_RELOC_SPARC_REV32:
case BFD_RELOC_SPARC_OLO10:
case BFD_RELOC_SPARC_UA16:
case BFD_RELOC_SPARC_UA32:
case BFD_RELOC_SPARC_UA64:
case BFD_RELOC_VTABLE_ENTRY:
case BFD_RELOC_VTABLE_INHERIT:
code = fixp->fx_r_type;
@ -4066,12 +4072,9 @@ sparc_cons_align (nbytes)
if (! enforce_aligned_data)
return;
/* Don't align if this is an unaligned pseudo-op. */
if (sparc_no_align_cons)
{
/* This is an unaligned pseudo-op. */
sparc_no_align_cons = 0;
return;
}
return;
nalign = log2 (nbytes);
if (nalign == 0)
@ -4196,9 +4199,23 @@ cons_fix_new_sparc (frag, where, nbytes, exp)
(nbytes == 2 ? BFD_RELOC_16 :
(nbytes == 4 ? BFD_RELOC_32 : BFD_RELOC_64)));
if (target_little_endian_data && nbytes == 4
if (target_little_endian_data
&& nbytes == 4
&& now_seg->flags & SEC_ALLOC)
r = BFD_RELOC_SPARC_REV32;
if (sparc_no_align_cons)
{
switch (nbytes)
{
case 2: r = BFD_RELOC_SPARC_UA16; break;
case 4: r = BFD_RELOC_SPARC_UA32; break;
case 8: r = BFD_RELOC_SPARC_UA64; break;
default: abort ();
}
sparc_no_align_cons = 0;
}
fix_new_exp (frag, where, (int) nbytes, exp, 0, r);
}

View File

@ -1,24 +1,58 @@
2001-05-28 Jeff Sturm <jsturm@one-point.com>
* gas/sparc/unalign.s: New test. Check unaligned relocs.
* gas/sparc/unalign.d: New expected test results.
* gas/sparc/sparc.exp: Run new test.
2001-05-27 Hans-Peter Nilsson <hp@axis.com>
* gas/cris/addi.d: Tweak for 64-bit BFD.
* gas/cris/binop-cmpmove.d, gas/cris/binop-cmpmovx.d,
gas/cris/binop-extx.d, gas/cris/binop.d, gas/cris/bork.d,
gas/cris/branch.d, gas/cris/break.d, gas/cris/brokw-1.d,
gas/cris/brokw-2.d, gas/cris/brokw-3.d, gas/cris/ccr.d,
gas/cris/clear.d, gas/cris/continue.d, gas/cris/fragtest.d,
gas/cris/jump-type.d, gas/cris/labfloat.d, gas/cris/macroat.d,
gas/cris/movem-to-reg.d, gas/cris/nosep.d, gas/cris/oneop-type.d,
gas/cris/prefix.d, gas/cris/pushpop-byte-sreg.d,
gas/cris/pushpop-dword-sreg.d, gas/cris/pushpop-word-sreg.d,
gas/cris/pushpop.d, gas/cris/quick-s6.d, gas/cris/quick-u5.d,
gas/cris/quick-u6.d, gas/cris/range-err-1.s, gas/cris/rd-pic-1.d,
gas/cris/rd-regprefix-1.d, gas/cris/rd-regprefix-1b.d,
gas/cris/reg-to-mem.d, gas/cris/regreg.d, gas/cris/return.d,
gas/cris/scc.d, gas/cris/separator.d, gas/cris/shexpr-1.d,
gas/cris/sreg-to-x.d, gas/cris/test.d, gas/cris/unimplemented.d,
gas/cris/unop-mem.d, gas/cris/x-to-byte-sreg.d,
gas/cris/x-to-dcr1-sreg.d, gas/cris/x-to-dword-sreg.d,
gas/cris/x-to-word-sreg.d: Ditto.
* gas/cris/binop-cmpmove.d: Ditto.
* gas/cris/binop-cmpmovx.d: Ditto.
* gas/cris/binop-extx.d: Ditto.
* gas/cris/binop.d: Ditto.
* gas/cris/bork.d: Ditto.
* gas/cris/branch.d: Ditto.
* gas/cris/break.d: Ditto.
* gas/cris/brokw-1.d: Ditto.
* gas/cris/brokw-2.d: Ditto.
* gas/cris/brokw-3.d: Ditto.
* gas/cris/ccr.d: Ditto.
* gas/cris/clear.d: Ditto.
* gas/cris/continue.d: Ditto.
* gas/cris/fragtest.d: Ditto.
* gas/cris/jump-type.d: Ditto.
* gas/cris/labfloat.d: Ditto.
* gas/cris/macroat.d: Ditto.
* gas/cris/movem-to-reg.d: Ditto.
* gas/cris/nosep.d: Ditto.
* gas/cris/oneop-type.d: Ditto.
* gas/cris/prefix.d: Ditto.
* gas/cris/pushpop-byte-sreg.d: Ditto.
* gas/cris/pushpop-dword-sreg.d: Ditto.
* gas/cris/pushpop-word-sreg.d: Ditto.
* gas/cris/pushpop.d: Ditto.
* gas/cris/quick-s6.d: Ditto.
* gas/cris/quick-u5.d: Ditto.
* gas/cris/quick-u6.d: Ditto.
* gas/cris/range-err-1.s: Ditto.
* gas/cris/rd-pic-1.d: Ditto.
* gas/cris/rd-regprefix-1.d: Ditto.
* gas/cris/rd-regprefix-1b.d: Ditto.
* gas/cris/reg-to-mem.d: Ditto.
* gas/cris/regreg.d: Ditto.
* gas/cris/return.d: Ditto.
* gas/cris/scc.d: Ditto.
* gas/cris/separator.d: Ditto.
* gas/cris/shexpr-1.d: Ditto.
* gas/cris/sreg-to-x.d: Ditto.
* gas/cris/test.d: Ditto.
* gas/cris/unimplemented.d: Ditto.
* gas/cris/unop-mem.d: Ditto.
* gas/cris/x-to-byte-sreg.d: Ditto.
* gas/cris/x-to-dcr1-sreg.d: Ditto.
* gas/cris/x-to-dword-sreg.d: Ditto.
* gas/cris/x-to-word-sreg.d: Ditto.
* gas/cris/shexpr-1.d: Ditto. Correct format.
2001-05-25 H.J. Lu <hjl@gnu.org>

View File

@ -18,6 +18,7 @@ proc gas_64_check { } {
if [istarget sparc*-*-*] {
run_dump_test "synth"
run_dump_test "unalign"
if [gas_64_check] {
run_dump_test "asi"
run_dump_test "membar"

View File

@ -0,0 +1,18 @@
#as:
#objdump: -Dr
#name: sparc unaligned relocs
.*: +file format .*sparc.*
Disassembly of section .text:
Disassembly of section .data:
0+ <foo>:
0: 01 00 00 00 nop
1: R_SPARC_UA32 fred
4: 00 02 00 00 unimp 0x20000
6: R_SPARC_UA16 jim
8: 03 00 00 00 sethi %hi\(0\), %g1
9: R_SPARC_UA64 harry
c: 00 00 00 00 unimp 0
10: 00 04 05 06 unimp 0x40506

View File

@ -0,0 +1,15 @@
# Test unaligned reloc generation
.data
foo:
.byte 0x1
.uaword fred
.byte 0x2
.uahalf jim
.byte 0x3
.uaxword harry
.byte 0x4
.byte 0x5
.byte 0x6