Fix problem with objdump and 16 bit R_BA.

This commit is contained in:
Tom Rix 2002-05-04 10:07:18 +00:00
parent a3d60be3b8
commit 59862849e4
4 changed files with 202 additions and 85 deletions

View File

@ -1,3 +1,26 @@
2002-05-04 Tom Rix <trix@redhat.com>
* coffswap.h (coff_swap_reloc_in): Remove XCOFF support.
(coff_swap_reloc_out): Same.
* coff-rs6000.c: (xcoff_swap_reloc_in): Moved from coffswap.h.
(xcoff_swap_reloc_out): Same.
(xcoff_rtype2howto): Renamed from _bfd_xcoff_rtype2howto. Special
case some 16 bit relocs. Add reloc value to output.
(xcoff_howto_table): Remove 64 bit R_POS, add 16 bit
R_RBR. Improve names.
(_bfd_xcoff_reloc_type_lookup): Adjust for removal of 64 bit R_POS.
(bfd_xcoff_backend_data): Update with new reloc swap names.
(bfd_pmac_xcoff_backend_data) : Same.
* coff64-rs6000.c: (xcoff64_swap_reloc_in): Moved from coffswap.h.
(xcoff64_swap_reloc_out): Same.
(xcoff64_rtype2howto): Special case some 16 bit relocs and 32 bit
R_POS. Add reloc value to output.
(xcoff64_howto_table): Move 64 bit R_POS to first entry. Add 16
bit R_RBR. Improve names, masks.
(xcoff64_reloc_type_lookup): Adjust for move of 64 bit R_POS.
(bfd_xcoff_backend_data): Update with new reloc swap names.
(bfd_xcoff_aix5_backend_data) : Same.
2002-05-04 Alan Modra <amodra@bigpond.net.au> 2002-05-04 Alan Modra <amodra@bigpond.net.au>
* elf32-hppa.c (struct elf32_hppa_link_hash_table): Add * elf32-hppa.c (struct elf32_hppa_link_hash_table): Add

View File

@ -54,9 +54,11 @@ extern void _bfd_xcoff_swap_sym_in PARAMS ((bfd *, PTR, PTR));
extern unsigned int _bfd_xcoff_swap_sym_out PARAMS ((bfd *, PTR, PTR)); extern unsigned int _bfd_xcoff_swap_sym_out PARAMS ((bfd *, PTR, PTR));
extern void _bfd_xcoff_swap_aux_in PARAMS ((bfd *, PTR, int, int, int, int, PTR)); extern void _bfd_xcoff_swap_aux_in PARAMS ((bfd *, PTR, int, int, int, int, PTR));
extern unsigned int _bfd_xcoff_swap_aux_out PARAMS ((bfd *, PTR, int, int, int, int, PTR)); extern unsigned int _bfd_xcoff_swap_aux_out PARAMS ((bfd *, PTR, int, int, int, int, PTR));
static void xcoff_swap_reloc_in PARAMS ((bfd *, PTR, PTR));
static unsigned int xcoff_swap_reloc_out PARAMS ((bfd *, PTR, PTR));
/* Forward declare _bfd_xcoff_rtype2howto for coffcode.h macro. */ /* Forward declare xcoff_rtype2howto for coffcode.h macro. */
void _bfd_xcoff_rtype2howto PARAMS ((arelent *, struct internal_reloc *)); void xcoff_rtype2howto PARAMS ((arelent *, struct internal_reloc *));
/* coffcode.h needs these to be defined. */ /* coffcode.h needs these to be defined. */
#define RS6000COFF_C 1 #define RS6000COFF_C 1
@ -74,7 +76,7 @@ void _bfd_xcoff_rtype2howto PARAMS ((arelent *, struct internal_reloc *));
#define COFF_DEFAULT_SECTION_ALIGNMENT_POWER (3) #define COFF_DEFAULT_SECTION_ALIGNMENT_POWER (3)
#define COFF_LONG_FILENAMES #define COFF_LONG_FILENAMES
#define NO_COFF_SYMBOLS #define NO_COFF_SYMBOLS
#define RTYPE2HOWTO(cache_ptr, dst) _bfd_xcoff_rtype2howto (cache_ptr, dst) #define RTYPE2HOWTO(cache_ptr, dst) xcoff_rtype2howto (cache_ptr, dst)
#define coff_mkobject _bfd_xcoff_mkobject #define coff_mkobject _bfd_xcoff_mkobject
#define coff_bfd_copy_private_bfd_data _bfd_xcoff_copy_private_bfd_data #define coff_bfd_copy_private_bfd_data _bfd_xcoff_copy_private_bfd_data
#define coff_bfd_is_local_label_name _bfd_xcoff_is_local_label_name #define coff_bfd_is_local_label_name _bfd_xcoff_is_local_label_name
@ -105,6 +107,9 @@ extern int rs6000coff_core_file_failing_signal PARAMS ((bfd *abfd));
#define coff_SWAP_sym_out _bfd_xcoff_swap_sym_out #define coff_SWAP_sym_out _bfd_xcoff_swap_sym_out
#define coff_SWAP_aux_in _bfd_xcoff_swap_aux_in #define coff_SWAP_aux_in _bfd_xcoff_swap_aux_in
#define coff_SWAP_aux_out _bfd_xcoff_swap_aux_out #define coff_SWAP_aux_out _bfd_xcoff_swap_aux_out
#define coff_swap_reloc_in xcoff_swap_reloc_in
#define coff_swap_reloc_out xcoff_swap_reloc_out
#define NO_COFF_RELOCS
#include "coffcode.h" #include "coffcode.h"
@ -696,7 +701,7 @@ reloc_howto_type xcoff_howto_table[] =
0, /* bitpos */ 0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */ complain_overflow_bitfield, /* complain_on_overflow */
0, /* special_function */ 0, /* special_function */
"R_BA", /* name */ "R_BA_26", /* name */
true, /* partial_inplace */ true, /* partial_inplace */
0x3fffffc, /* src_mask */ 0x3fffffc, /* src_mask */
0x3fffffc, /* dst_mask */ 0x3fffffc, /* dst_mask */
@ -900,7 +905,7 @@ reloc_howto_type xcoff_howto_table[] =
0, /* bitpos */ 0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */ complain_overflow_signed, /* complain_on_overflow */
0, /* special_function */ 0, /* special_function */
"R_RBR", /* name */ "R_RBR_26", /* name */
true, /* partial_inplace */ true, /* partial_inplace */
0xffff, /* src_mask */ 0xffff, /* src_mask */
0xffff, /* dst_mask */ 0xffff, /* dst_mask */
@ -921,49 +926,57 @@ reloc_howto_type xcoff_howto_table[] =
0xffff, /* dst_mask */ 0xffff, /* dst_mask */
false), /* pcrel_offset */ false), /* pcrel_offset */
HOWTO (R_POS, /* type */
0, /* rightshift */
4, /* size (0 = byte, 1 = short, 2 = long) */
64, /* bitsize */
false, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
0, /* special_function */
"R_POS", /* name */
true, /* partial_inplace */
MINUS_ONE, /* src_mask */
MINUS_ONE, /* dst_mask */
false), /* pcrel_offset */
/* 16 bit Non modifiable absolute branch. */ /* 16 bit Non modifiable absolute branch. */
HOWTO (R_BA, /* type */ HOWTO (R_BA, /* type */
0, /* rightshift */ 0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */ 1, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */ 16, /* bitsize */
false, /* pc_relative */ false, /* pc_relative */
0, /* bitpos */ 0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */ complain_overflow_bitfield, /* complain_on_overflow */
0, /* special_function */ 0, /* special_function */
"R_BA", /* name */ "R_BA_16", /* name */
true, /* partial_inplace */ true, /* partial_inplace */
0xfffc, /* src_mask */ 0xfffc, /* src_mask */
0xfffc, /* dst_mask */ 0xfffc, /* dst_mask */
false), /* pcrel_offset */ false), /* pcrel_offset */
/* Modifiable branch relative. */
HOWTO (R_RBR, /* type */
0, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
false, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
0, /* special_function */
"R_RBR_16", /* name */
true, /* partial_inplace */
0xffff, /* src_mask */
0xffff, /* dst_mask */
false), /* pcrel_offset */
}; };
void void
_bfd_xcoff_rtype2howto (relent, internal) xcoff_rtype2howto (relent, internal)
arelent *relent; arelent *relent;
struct internal_reloc *internal; struct internal_reloc *internal;
{ {
relent->howto = xcoff_howto_table + internal->r_type; if (internal->r_type > R_RBRC)
abort ();
/* Check for relocs we don't know of. */ /* Default howto layout works most of the time */
if (internal->r_type relent->howto = &xcoff_howto_table[internal->r_type];
>= sizeof (xcoff_howto_table) / sizeof (xcoff_howto_table[0]))
abort (); /* Special case some 16 bit reoloc */
if (internal->r_type != relent->howto->type) if (15 == (internal->r_size & 0x1f))
abort (); {
if (R_BA == internal->r_type)
relent->howto = &xcoff_howto_table[0x1c];
else if (R_RBR == internal->r_type)
relent->howto = &xcoff_howto_table[0x1d];
}
/* The r_size field of an XCOFF reloc encodes the bitsize of the /* The r_size field of an XCOFF reloc encodes the bitsize of the
relocation, as well as indicating whether it is signed or not. relocation, as well as indicating whether it is signed or not.
@ -972,14 +985,12 @@ _bfd_xcoff_rtype2howto (relent, internal)
for R_REF relocs. */ for R_REF relocs. */
if (relent->howto->dst_mask != 0 if (relent->howto->dst_mask != 0
&& (relent->howto->bitsize && (relent->howto->bitsize
!= ((unsigned int) internal->r_size & 0x3f) + 1)) != ((unsigned int) internal->r_size & 0x1f) + 1))
abort (); abort ();
#if 0
if ((internal->r_size & 0x80) != 0 /* Put a meaningful value in addend */
? (relent->howto->complain_on_overflow != complain_overflow_signed) relent->addend = (internal->r_size & 0x80) ? - internal->r_vaddr
: (relent->howto->complain_on_overflow != complain_overflow_bitfield)) : internal->r_vaddr;
abort ();
#endif
} }
reloc_howto_type * reloc_howto_type *
@ -992,7 +1003,7 @@ _bfd_xcoff_reloc_type_lookup (abfd, code)
case BFD_RELOC_PPC_B26: case BFD_RELOC_PPC_B26:
return &xcoff_howto_table[0xa]; return &xcoff_howto_table[0xa];
case BFD_RELOC_PPC_BA16: case BFD_RELOC_PPC_BA16:
return &xcoff_howto_table[0x1d]; return &xcoff_howto_table[0x1c];
case BFD_RELOC_PPC_BA26: case BFD_RELOC_PPC_BA26:
return &xcoff_howto_table[8]; return &xcoff_howto_table[8];
case BFD_RELOC_PPC_TOC16: case BFD_RELOC_PPC_TOC16:
@ -1000,8 +1011,6 @@ _bfd_xcoff_reloc_type_lookup (abfd, code)
case BFD_RELOC_32: case BFD_RELOC_32:
case BFD_RELOC_CTOR: case BFD_RELOC_CTOR:
return &xcoff_howto_table[0]; return &xcoff_howto_table[0];
case BFD_RELOC_64:
return &xcoff_howto_table[0x1c];
default: default:
return NULL; return NULL;
} }
@ -2650,6 +2659,40 @@ xcoff_swap_ldsym_out (abfd, src, d)
bfd_put_32 (abfd, src->l_parm, dst->l_parm); bfd_put_32 (abfd, src->l_parm, dst->l_parm);
} }
static void
xcoff_swap_reloc_in (abfd, s, d)
bfd *abfd;
PTR s;
PTR d;
{
struct external_reloc *src = (struct external_reloc *) s;
struct internal_reloc *dst = (struct internal_reloc *) d;
memset (dst, 0, sizeof (struct internal_reloc));
dst->r_vaddr = bfd_get_32 (abfd, src->r_vaddr);
dst->r_symndx = bfd_get_32 (abfd, src->r_symndx);
dst->r_size = bfd_get_8 (abfd, src->r_size);
dst->r_type = bfd_get_8 (abfd, src->r_type);
}
static unsigned int
xcoff_swap_reloc_out (abfd, s, d)
bfd *abfd;
PTR s;
PTR d;
{
struct internal_reloc *src = (struct internal_reloc *) s;
struct external_reloc *dst = (struct external_reloc *) d;
bfd_put_32 (abfd, src->r_vaddr, dst->r_vaddr);
bfd_put_32 (abfd, src->r_symndx, dst->r_symndx);
bfd_put_8 (abfd, src->r_type, dst->r_type);
bfd_put_8 (abfd, src->r_size, dst->r_size);
return bfd_coff_relsz (abfd);
}
/* Swap in the ldrel structure. */ /* Swap in the ldrel structure. */
static void static void
@ -3911,7 +3954,7 @@ static const struct xcoff_backend_data_rec bfd_xcoff_backend_data =
_bfd_xcoff_swap_aux_out, /* _bfd_swap_aux_out */ _bfd_xcoff_swap_aux_out, /* _bfd_swap_aux_out */
_bfd_xcoff_swap_sym_out, /* _bfd_swap_sym_out */ _bfd_xcoff_swap_sym_out, /* _bfd_swap_sym_out */
coff_swap_lineno_out, /* _bfd_swap_lineno_out */ coff_swap_lineno_out, /* _bfd_swap_lineno_out */
coff_swap_reloc_out, /* _bfd_swap_reloc_out */ xcoff_swap_reloc_out, /* _bfd_swap_reloc_out */
coff_swap_filehdr_out, /* _bfd_swap_filehdr_out */ coff_swap_filehdr_out, /* _bfd_swap_filehdr_out */
coff_swap_aouthdr_out, /* _bfd_swap_aouthdr_out */ coff_swap_aouthdr_out, /* _bfd_swap_aouthdr_out */
coff_swap_scnhdr_out, /* _bfd_swap_scnhdr_out */ coff_swap_scnhdr_out, /* _bfd_swap_scnhdr_out */
@ -3931,7 +3974,7 @@ static const struct xcoff_backend_data_rec bfd_xcoff_backend_data =
coff_swap_filehdr_in, /* _bfd_coff_swap_filehdr_in */ coff_swap_filehdr_in, /* _bfd_coff_swap_filehdr_in */
coff_swap_aouthdr_in, /* _bfd_swap_aouthdr_in */ coff_swap_aouthdr_in, /* _bfd_swap_aouthdr_in */
coff_swap_scnhdr_in, /* _bfd_swap_scnhdr_in */ coff_swap_scnhdr_in, /* _bfd_swap_scnhdr_in */
coff_swap_reloc_in, /* _bfd_reloc_in */ xcoff_swap_reloc_in, /* _bfd_reloc_in */
coff_bad_format_hook, /* _bfd_bad_format_hook */ coff_bad_format_hook, /* _bfd_bad_format_hook */
coff_set_arch_mach_hook, /* _bfd_set_arch_mach_hook */ coff_set_arch_mach_hook, /* _bfd_set_arch_mach_hook */
coff_mkobject_hook, /* _bfd_mkobject_hook */ coff_mkobject_hook, /* _bfd_mkobject_hook */
@ -4168,7 +4211,7 @@ static const struct xcoff_backend_data_rec bfd_pmac_xcoff_backend_data =
_bfd_xcoff_swap_aux_out, /* _bfd_swap_aux_out */ _bfd_xcoff_swap_aux_out, /* _bfd_swap_aux_out */
_bfd_xcoff_swap_sym_out, /* _bfd_swap_sym_out */ _bfd_xcoff_swap_sym_out, /* _bfd_swap_sym_out */
coff_swap_lineno_out, /* _bfd_swap_lineno_out */ coff_swap_lineno_out, /* _bfd_swap_lineno_out */
coff_swap_reloc_out, /* _bfd_swap_reloc_out */ xcoff_swap_reloc_out, /* _bfd_swap_reloc_out */
coff_swap_filehdr_out, /* _bfd_swap_filehdr_out */ coff_swap_filehdr_out, /* _bfd_swap_filehdr_out */
coff_swap_aouthdr_out, /* _bfd_swap_aouthdr_out */ coff_swap_aouthdr_out, /* _bfd_swap_aouthdr_out */
coff_swap_scnhdr_out, /* _bfd_swap_scnhdr_out */ coff_swap_scnhdr_out, /* _bfd_swap_scnhdr_out */
@ -4188,7 +4231,7 @@ static const struct xcoff_backend_data_rec bfd_pmac_xcoff_backend_data =
coff_swap_filehdr_in, /* _bfd_coff_swap_filehdr_in */ coff_swap_filehdr_in, /* _bfd_coff_swap_filehdr_in */
coff_swap_aouthdr_in, /* _bfd_swap_aouthdr_in */ coff_swap_aouthdr_in, /* _bfd_swap_aouthdr_in */
coff_swap_scnhdr_in, /* _bfd_swap_scnhdr_in */ coff_swap_scnhdr_in, /* _bfd_swap_scnhdr_in */
coff_swap_reloc_in, /* _bfd_reloc_in */ xcoff_swap_reloc_in, /* _bfd_reloc_in */
coff_bad_format_hook, /* _bfd_bad_format_hook */ coff_bad_format_hook, /* _bfd_bad_format_hook */
coff_set_arch_mach_hook, /* _bfd_set_arch_mach_hook */ coff_set_arch_mach_hook, /* _bfd_set_arch_mach_hook */
coff_mkobject_hook, /* _bfd_mkobject_hook */ coff_mkobject_hook, /* _bfd_mkobject_hook */

View File

@ -96,6 +96,8 @@ static void _bfd_xcoff64_swap_aux_in
PARAMS ((bfd *, PTR, int, int, int, int, PTR)); PARAMS ((bfd *, PTR, int, int, int, int, PTR));
static unsigned int _bfd_xcoff64_swap_aux_out static unsigned int _bfd_xcoff64_swap_aux_out
PARAMS ((bfd *, PTR, int, int, int, int, PTR)); PARAMS ((bfd *, PTR, int, int, int, int, PTR));
static void xcoff64_swap_reloc_in PARAMS ((bfd *, PTR, PTR));
static unsigned int xcoff64_swap_reloc_out PARAMS ((bfd *, PTR, PTR));
extern boolean _bfd_xcoff_mkobject PARAMS ((bfd *)); extern boolean _bfd_xcoff_mkobject PARAMS ((bfd *));
extern boolean _bfd_xcoff_copy_private_bfd_data PARAMS ((bfd *, bfd *)); extern boolean _bfd_xcoff_copy_private_bfd_data PARAMS ((bfd *, bfd *));
extern boolean _bfd_xcoff_is_local_label_name PARAMS ((bfd *, const char *)); extern boolean _bfd_xcoff_is_local_label_name PARAMS ((bfd *, const char *));
@ -199,7 +201,9 @@ extern int rs6000coff_core_file_failing_signal PARAMS ((bfd *abfd));
#define coff_SWAP_sym_out _bfd_xcoff64_swap_sym_out #define coff_SWAP_sym_out _bfd_xcoff64_swap_sym_out
#define coff_SWAP_aux_in _bfd_xcoff64_swap_aux_in #define coff_SWAP_aux_in _bfd_xcoff64_swap_aux_in
#define coff_SWAP_aux_out _bfd_xcoff64_swap_aux_out #define coff_SWAP_aux_out _bfd_xcoff64_swap_aux_out
#define coff_swap_reloc_in xcoff64_swap_reloc_in
#define coff_swap_reloc_out xcoff64_swap_reloc_out
#define NO_COFF_RELOCS
#include "coffcode.h" #include "coffcode.h"
@ -614,6 +618,40 @@ xcoff64_swap_ldsym_out (abfd, src, d)
bfd_put_32 (abfd, src->l_parm, dst->l_parm); bfd_put_32 (abfd, src->l_parm, dst->l_parm);
} }
static void
xcoff64_swap_reloc_in (abfd, s, d)
bfd *abfd;
PTR s;
PTR d;
{
struct external_reloc *src = (struct external_reloc *) s;
struct internal_reloc *dst = (struct internal_reloc *) d;
memset (dst, 0, sizeof (struct internal_reloc));
dst->r_vaddr = bfd_get_64 (abfd, src->r_vaddr);
dst->r_symndx = bfd_get_32 (abfd, src->r_symndx);
dst->r_size = bfd_get_8 (abfd, src->r_size);
dst->r_type = bfd_get_8 (abfd, src->r_type);
}
static unsigned int
xcoff64_swap_reloc_out (abfd, s, d)
bfd *abfd;
PTR s;
PTR d;
{
struct internal_reloc *src = (struct internal_reloc *) s;
struct external_reloc *dst = (struct external_reloc *) d;
bfd_put_64 (abfd, src->r_vaddr, dst->r_vaddr);
bfd_put_32 (abfd, src->r_symndx, dst->r_symndx);
bfd_put_8 (abfd, src->r_type, dst->r_type);
bfd_put_8 (abfd, src->r_size, dst->r_size);
return bfd_coff_relsz (abfd);
}
/* Swap in the ldrel structure. */ /* Swap in the ldrel structure. */
static void static void
@ -1203,7 +1241,7 @@ reloc_howto_type xcoff64_howto_table[] =
0, /* bitpos */ 0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */ complain_overflow_bitfield, /* complain_on_overflow */
0, /* special_function */ 0, /* special_function */
"R_POS", /* name */ "R_POS_64", /* name */
true, /* partial_inplace */ true, /* partial_inplace */
MINUS_ONE, /* src_mask */ MINUS_ONE, /* src_mask */
MINUS_ONE, /* dst_mask */ MINUS_ONE, /* dst_mask */
@ -1310,7 +1348,7 @@ reloc_howto_type xcoff64_howto_table[] =
0, /* bitpos */ 0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */ complain_overflow_bitfield, /* complain_on_overflow */
0, /* special_function */ 0, /* special_function */
"R_BA", /* name */ "R_BA_26", /* name */
true, /* partial_inplace */ true, /* partial_inplace */
0x3fffffc, /* src_mask */ 0x3fffffc, /* src_mask */
0x3fffffc, /* dst_mask */ 0x3fffffc, /* dst_mask */
@ -1514,7 +1552,7 @@ reloc_howto_type xcoff64_howto_table[] =
0, /* bitpos */ 0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */ complain_overflow_signed, /* complain_on_overflow */
0, /* special_function */ 0, /* special_function */
"R_RBR", /* name */ "R_RBR_26", /* name */
true, /* partial_inplace */ true, /* partial_inplace */
0xffff, /* src_mask */ 0xffff, /* src_mask */
0xffff, /* dst_mask */ 0xffff, /* dst_mask */
@ -1537,32 +1575,47 @@ reloc_howto_type xcoff64_howto_table[] =
HOWTO (R_POS, /* type */ HOWTO (R_POS, /* type */
0, /* rightshift */ 0, /* rightshift */
4, /* size (0 = byte, 1 = short, 2 = long) */ 2, /* size (0 = byte, 1 = short, 2 = long) */
64, /* bitsize */ 32, /* bitsize */
false, /* pc_relative */ false, /* pc_relative */
0, /* bitpos */ 0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */ complain_overflow_bitfield, /* complain_on_overflow */
0, /* special_function */ 0, /* special_function */
"R_POS", /* name */ "R_POS_32", /* name */
true, /* partial_inplace */ true, /* partial_inplace */
MINUS_ONE, /* src_mask */ 0xffffffff, /* src_mask */
MINUS_ONE, /* dst_mask */ 0xffffffff, /* dst_mask */
false), /* pcrel_offset */ false), /* pcrel_offset */
/* 16 bit Non modifiable absolute branch. */ /* 16 bit Non modifiable absolute branch. */
HOWTO (R_BA, /* type */ HOWTO (R_BA, /* type */
0, /* rightshift */ 0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */ 1, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */ 16, /* bitsize */
false, /* pc_relative */ false, /* pc_relative */
0, /* bitpos */ 0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */ complain_overflow_bitfield, /* complain_on_overflow */
0, /* special_function */ 0, /* special_function */
"R_BA", /* name */ "R_BA_16", /* name */
true, /* partial_inplace */ true, /* partial_inplace */
0xfffc, /* src_mask */ 0xfffc, /* src_mask */
0xfffc, /* dst_mask */ 0xfffc, /* dst_mask */
false), /* pcrel_offset */ false), /* pcrel_offset */
/* Modifiable branch relative. */
HOWTO (R_RBR, /* type */
0, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
false, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
0, /* special_function */
"R_RBR_16", /* name */
true, /* partial_inplace */
0xffff, /* src_mask */
0xffff, /* dst_mask */
false), /* pcrel_offset */
}; };
void void
@ -1570,14 +1623,26 @@ xcoff64_rtype2howto (relent, internal)
arelent *relent; arelent *relent;
struct internal_reloc *internal; struct internal_reloc *internal;
{ {
relent->howto = xcoff64_howto_table + internal->r_type; if (internal->r_type > R_RBRC)
abort ();
/* Check for relocs we don't know of. */ /* Default howto layout works most of the time */
if (internal->r_type relent->howto = &xcoff64_howto_table[internal->r_type];
>= sizeof (xcoff64_howto_table) / sizeof (xcoff64_howto_table[0]))
abort (); /* Special case some 16 bit reoloc */
if (internal->r_type != relent->howto->type) if (15 == (internal->r_size & 0x3f))
abort (); {
if (R_BA == internal->r_type)
relent->howto = &xcoff64_howto_table[0x1d];
else if (R_RBR == internal->r_type)
relent->howto = &xcoff64_howto_table[0x1e];
}
/* Special case 32 bit */
else if (31 == (internal->r_size & 0x3f))
{
if (R_POS == internal->r_type)
relent->howto = &xcoff64_howto_table[0x1c];
}
/* The r_size field of an XCOFF reloc encodes the bitsize of the /* The r_size field of an XCOFF reloc encodes the bitsize of the
relocation, as well as indicating whether it is signed or not. relocation, as well as indicating whether it is signed or not.
@ -1588,12 +1653,10 @@ xcoff64_rtype2howto (relent, internal)
&& (relent->howto->bitsize && (relent->howto->bitsize
!= ((unsigned int) internal->r_size & 0x3f) + 1)) != ((unsigned int) internal->r_size & 0x3f) + 1))
abort (); abort ();
#if 0
if ((internal->r_size & 0x80) != 0 /* Put a meaningful value in addend */
? (relent->howto->complain_on_overflow != complain_overflow_signed) relent->addend = (internal->r_size & 0x80) ? - internal->r_vaddr
: (relent->howto->complain_on_overflow != complain_overflow_bitfield)) : internal->r_vaddr;
abort ();
#endif
} }
reloc_howto_type * reloc_howto_type *
@ -1613,9 +1676,9 @@ xcoff64_reloc_type_lookup (abfd, code)
return &xcoff64_howto_table[3]; return &xcoff64_howto_table[3];
case BFD_RELOC_32: case BFD_RELOC_32:
case BFD_RELOC_CTOR: case BFD_RELOC_CTOR:
return &xcoff64_howto_table[0];
case BFD_RELOC_64:
return &xcoff64_howto_table[0x1c]; return &xcoff64_howto_table[0x1c];
case BFD_RELOC_64:
return &xcoff64_howto_table[0];
default: default:
return NULL; return NULL;
} }
@ -2314,7 +2377,7 @@ static const struct xcoff_backend_data_rec bfd_xcoff_backend_data =
_bfd_xcoff64_swap_aux_out, /* _bfd_swap_aux_out */ _bfd_xcoff64_swap_aux_out, /* _bfd_swap_aux_out */
_bfd_xcoff64_swap_sym_out, /* _bfd_swap_sym_out */ _bfd_xcoff64_swap_sym_out, /* _bfd_swap_sym_out */
_bfd_xcoff64_swap_lineno_out, /* _bfd_swap_lineno_out */ _bfd_xcoff64_swap_lineno_out, /* _bfd_swap_lineno_out */
coff_swap_reloc_out, /* _bfd_swap_reloc_out */ xcoff64_swap_reloc_out, /* _bfd_swap_reloc_out */
coff_swap_filehdr_out, /* _bfd_swap_filehdr_out */ coff_swap_filehdr_out, /* _bfd_swap_filehdr_out */
coff_swap_aouthdr_out, /* _bfd_swap_aouthdr_out */ coff_swap_aouthdr_out, /* _bfd_swap_aouthdr_out */
coff_swap_scnhdr_out, /* _bfd_swap_scnhdr_out */ coff_swap_scnhdr_out, /* _bfd_swap_scnhdr_out */
@ -2334,7 +2397,7 @@ static const struct xcoff_backend_data_rec bfd_xcoff_backend_data =
coff_swap_filehdr_in, /* _bfd_coff_swap_filehdr_in */ coff_swap_filehdr_in, /* _bfd_coff_swap_filehdr_in */
coff_swap_aouthdr_in, /* _bfd_swap_aouthdr_in */ coff_swap_aouthdr_in, /* _bfd_swap_aouthdr_in */
coff_swap_scnhdr_in, /* _bfd_swap_scnhdr_in */ coff_swap_scnhdr_in, /* _bfd_swap_scnhdr_in */
coff_swap_reloc_in, /* _bfd_reloc_in */ xcoff64_swap_reloc_in, /* _bfd_reloc_in */
xcoff64_bad_format_hook, /* _bfd_bad_format_hook */ xcoff64_bad_format_hook, /* _bfd_bad_format_hook */
coff_set_arch_mach_hook, /* _bfd_set_arch_mach_hook */ coff_set_arch_mach_hook, /* _bfd_set_arch_mach_hook */
coff_mkobject_hook, /* _bfd_mkobject_hook */ coff_mkobject_hook, /* _bfd_mkobject_hook */
@ -2569,7 +2632,7 @@ static const struct xcoff_backend_data_rec bfd_xcoff_aix5_backend_data =
_bfd_xcoff64_swap_aux_out, /* _bfd_swap_aux_out */ _bfd_xcoff64_swap_aux_out, /* _bfd_swap_aux_out */
_bfd_xcoff64_swap_sym_out, /* _bfd_swap_sym_out */ _bfd_xcoff64_swap_sym_out, /* _bfd_swap_sym_out */
_bfd_xcoff64_swap_lineno_out, /* _bfd_swap_lineno_out */ _bfd_xcoff64_swap_lineno_out, /* _bfd_swap_lineno_out */
coff_swap_reloc_out, /* _bfd_swap_reloc_out */ xcoff64_swap_reloc_out, /* _bfd_swap_reloc_out */
coff_swap_filehdr_out, /* _bfd_swap_filehdr_out */ coff_swap_filehdr_out, /* _bfd_swap_filehdr_out */
coff_swap_aouthdr_out, /* _bfd_swap_aouthdr_out */ coff_swap_aouthdr_out, /* _bfd_swap_aouthdr_out */
coff_swap_scnhdr_out, /* _bfd_swap_scnhdr_out */ coff_swap_scnhdr_out, /* _bfd_swap_scnhdr_out */
@ -2589,7 +2652,7 @@ static const struct xcoff_backend_data_rec bfd_xcoff_aix5_backend_data =
coff_swap_filehdr_in, /* _bfd_coff_swap_filehdr_in */ coff_swap_filehdr_in, /* _bfd_coff_swap_filehdr_in */
coff_swap_aouthdr_in, /* _bfd_swap_aouthdr_in */ coff_swap_aouthdr_in, /* _bfd_swap_aouthdr_in */
coff_swap_scnhdr_in, /* _bfd_swap_scnhdr_in */ coff_swap_scnhdr_in, /* _bfd_swap_scnhdr_in */
coff_swap_reloc_in, /* _bfd_reloc_in */ xcoff64_swap_reloc_in, /* _bfd_reloc_in */
xcoff64_bad_format_hook, /* _bfd_bad_format_hook */ xcoff64_bad_format_hook, /* _bfd_bad_format_hook */
coff_set_arch_mach_hook, /* _bfd_set_arch_mach_hook */ coff_set_arch_mach_hook, /* _bfd_set_arch_mach_hook */
coff_mkobject_hook, /* _bfd_mkobject_hook */ coff_mkobject_hook, /* _bfd_mkobject_hook */

View File

@ -244,13 +244,7 @@ coff_swap_reloc_in (abfd, src, dst)
reloc_dst->r_vaddr = GET_RELOC_VADDR (abfd, reloc_src->r_vaddr); reloc_dst->r_vaddr = GET_RELOC_VADDR (abfd, reloc_src->r_vaddr);
reloc_dst->r_symndx = H_GET_S32 (abfd, reloc_src->r_symndx); reloc_dst->r_symndx = H_GET_S32 (abfd, reloc_src->r_symndx);
#ifdef RS6000COFF_C
reloc_dst->r_type = H_GET_8 (abfd, reloc_src->r_type);
reloc_dst->r_size = H_GET_8 (abfd, reloc_src->r_size);
#else
reloc_dst->r_type = H_GET_16 (abfd, reloc_src->r_type); reloc_dst->r_type = H_GET_16 (abfd, reloc_src->r_type);
#endif
#ifdef SWAP_IN_RELOC_OFFSET #ifdef SWAP_IN_RELOC_OFFSET
reloc_dst->r_offset = SWAP_IN_RELOC_OFFSET (abfd, reloc_src->r_offset); reloc_dst->r_offset = SWAP_IN_RELOC_OFFSET (abfd, reloc_src->r_offset);
@ -267,13 +261,7 @@ coff_swap_reloc_out (abfd, src, dst)
struct external_reloc *reloc_dst = (struct external_reloc *) dst; struct external_reloc *reloc_dst = (struct external_reloc *) dst;
PUT_RELOC_VADDR (abfd, reloc_src->r_vaddr, reloc_dst->r_vaddr); PUT_RELOC_VADDR (abfd, reloc_src->r_vaddr, reloc_dst->r_vaddr);
H_PUT_32 (abfd, reloc_src->r_symndx, reloc_dst->r_symndx); H_PUT_32 (abfd, reloc_src->r_symndx, reloc_dst->r_symndx);
#ifdef RS6000COFF_C
H_PUT_8 (abfd, reloc_src->r_type, reloc_dst->r_type);
H_PUT_8 (abfd, reloc_src->r_size, reloc_dst->r_size);
#else
H_PUT_16 (abfd, reloc_src->r_type, reloc_dst->r_type); H_PUT_16 (abfd, reloc_src->r_type, reloc_dst->r_type);
#endif
#ifdef SWAP_OUT_RELOC_OFFSET #ifdef SWAP_OUT_RELOC_OFFSET
SWAP_OUT_RELOC_OFFSET (abfd, reloc_src->r_offset, reloc_dst->r_offset); SWAP_OUT_RELOC_OFFSET (abfd, reloc_src->r_offset, reloc_dst->r_offset);