* coff-rs6000.c: Fix formatting.
* coff-sh.c: Likewise.
* coff-sparc.c: Likewise.
* coff-tic30.c: Likewise.
* coff-tic54x.c: Likewise.
* coff-tic80.c: Likewise.
* coff-w65.c: Likewise.
* coff-we32k.c: Likewise.
* coff-z8k.c: Likewise.
* coff-arm.c: Fix formatting.
* coff-ppc.c: Likewise.
* coff-rs6000.c: Likewise.
+ * coff-sh.c: Likewise.
+ * coff-sparc.c: Likewise.
+ * coff-tic30.c: Likewise.
+ * coff-tic54x.c: Likewise.
+ * coff-tic80.c: Likewise.
+ * coff-w65.c: Likewise.
+ * coff-we32k.c: Likewise.
+ * coff-z8k.c: Likewise.
2000-11-15 Richard Henderson <rth@redhat.com>
/* Write out an XCOFF armap. */
-/*ARGSUSED*/
static boolean
xcoff_write_armap_old (abfd, elength, map, orl_count, stridx)
bfd *abfd;
return true;
}
-/*ARGSUSED*/
static boolean
xcoff_write_armap_big (abfd, elength, map, orl_count, stridx)
bfd *abfd;
return true;
}
-/*ARGSUSED*/
boolean
_bfd_xcoff_write_armap (abfd, elength, map, orl_count, stridx)
bfd *abfd;
/* We can't use the usual coff_sizeof_headers routine, because AIX
always uses an a.out header. */
-/*ARGSUSED*/
int
_bfd_xcoff_sizeof_headers (abfd, reloc)
bfd *abfd;
size += abfd->section_count * SCNHSZ;
return size;
}
-\f
-
#include "coff/pe.h"
#ifndef COFF_IMAGE_WITH_PE
-static boolean sh_align_load_span
+static boolean sh_align_load_span
PARAMS ((bfd *, asection *, bfd_byte *,
boolean (*) (bfd *, asection *, PTR, bfd_byte *, bfd_vma),
PTR, bfd_vma **, bfd_vma *, bfd_vma, bfd_vma, boolean *));
reloc_howto_type * howto;
{
return ! howto->pc_relative && howto->type != R_SH_IMAGEBASE;
-}
+}
#endif
/* The supported relocations. There are a lot of relocations defined
EMPTY_HOWTO (15),
#ifdef COFF_WITH_PE
- HOWTO (R_SH_IMAGEBASE, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- false, /* pc_relative */
- 0, /* bitpos */
+ HOWTO (R_SH_IMAGEBASE, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
- sh_reloc, /* special_function */
- "rva32", /* name */
- true, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* dst_mask */
+ sh_reloc, /* special_function */
+ "rva32", /* name */
+ true, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
false), /* pcrel_offset */
#else
EMPTY_HOWTO (16), /* R_SH_IMM8 */
/* Get the value of a symbol, when performing a relocation. */
static long
-get_symbol_value (symbol)
+get_symbol_value (symbol)
asymbol *symbol;
-{
+{
bfd_vma relocation;
if (bfd_is_com_section (symbol->section))
- relocation = 0;
- else
+ relocation = 0;
+ else
relocation = (symbol->value +
symbol->section->output_section->vma +
symbol->section->output_offset);
align load and store instructions on four byte boundaries if we
can, by swapping them with one of the adjacent instructions. */
-static boolean
+static boolean
sh_relax_section (abfd, sec, link_info, again)
bfd *abfd;
asection *sec;
return op;
}
- return NULL;
+ return NULL;
}
/* See whether an instruction uses or sets a general purpose register */
of a double precision value.
So what this all boils down to is that we have to ignore the lowest
bit of the register number. */
-
+
if ((f & USESF1) != 0
&& (USESF1_REG (insn) & 0xe) == (freg & 0xe))
return true;
of a double precision value.
So what this all boils down to is that we have to ignore the lowest
bit of the register number. */
-
+
if ((f & SETSF1) != 0
&& (SETSF1_REG (insn) & 0xe) == (freg & 0xe))
return true;
if (dsp && i - 2 > start)
{
unsigned pprev_insn = bfd_get_16 (abfd, contents + i - 4);
-
+
if ((pprev_insn & 0xfc00) == 0xf800)
prev_op = NULL;
else
sym = NULL;
}
else
- {
+ {
if (symndx < 0
|| (unsigned long) symndx >= obj_raw_syment_count (input_bfd))
{
if (rel->r_type == R_SH_IMAGEBASE)
addend -= pe_data (input_section->output_section->owner)->pe_opthdr.ImageBase;
#endif
-
+
val = 0;
if (h == NULL)
#else
#define TARGET_SYM shlcoff_vec
#endif
-
+
#ifndef TARGET_SHL_NAME
#define TARGET_SHL_NAME "coff-shl"
#endif
BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
& shlcoff_small_vec,
-
+
(PTR) &bfd_coff_small_swap_table
};
bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* hdrs */
{_bfd_dummy_target, coff_small_object_p, /* bfd_check_format */
- bfd_generic_archive_p, _bfd_dummy_target},
+ bfd_generic_archive_p, _bfd_dummy_target},
{bfd_false, coff_mkobject, _bfd_generic_mkarchive, /* bfd_set_format */
bfd_false},
{bfd_false, coff_write_object_contents, /* bfd_write_contents */
BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
& shcoff_small_vec,
-
+
(PTR) &bfd_coff_small_swap_table
};
#endif
enum reloc_type
{
R_SPARC_NONE = 0,
- R_SPARC_8, R_SPARC_16, R_SPARC_32,
- R_SPARC_DISP8, R_SPARC_DISP16, R_SPARC_DISP32,
+ R_SPARC_8, R_SPARC_16, R_SPARC_32,
+ R_SPARC_DISP8, R_SPARC_DISP16, R_SPARC_DISP32,
R_SPARC_WDISP30, R_SPARC_WDISP22,
R_SPARC_HI22, R_SPARC_22,
R_SPARC_13, R_SPARC_LO10,
return bfd_reloc_continue;
}
-static reloc_howto_type coff_sparc_howto_table[] =
+static reloc_howto_type coff_sparc_howto_table[] =
{
HOWTO(R_SPARC_NONE, 0,0, 0,false,0,complain_overflow_dont, bfd_coff_generic_reloc,"R_SPARC_NONE", false,0,0x00000000,true),
HOWTO(R_SPARC_8, 0,0, 8,false,0,complain_overflow_bitfield,bfd_coff_generic_reloc,"R_SPARC_8", false,0,0x000000ff,true),
#define __A_MAGIC_SET__
-/* Enable Sparc-specific hacks in coffcode.h. */
+/* Enable Sparc-specific hacks in coffcode.h. */
#define COFF_SPARC
/* For the case statement use the code values used in tc_gen_reloc to
map to the howto table entries that match those in both the aout
- and coff implementations. */
+ and coff implementations. */
reloc_howto_type *
tic30_coff_reloc_type_lookup (abfd, code)
bfd *abfd ATTRIBUTE_UNUSED;
#define SELECT_RELOC(x,howto) x.r_type = coff_tic30_select_reloc(howto)
-
#define BADMAG(x) TIC30BADMAG(x)
#define TIC30 1 /* Customize coffcode.h */
#define __A_MAGIC_SET__
#define SWAP_OUT_RELOC_EXTRA(abfd, src, dst) dst->r_stuff[0] = 'S'; \
dst->r_stuff[1] = 'C';
-/* Code to turn a r_type into a howto ptr, uses the above howto table. */
+/* Code to turn a r_type into a howto ptr, uses the above howto table. */
static void
rtype2howto (internal, dst)
#define CALC_ADDEND(abfd, symbol, ext_reloc, cache_ptr) \
cache_ptr->addend = ext_reloc.r_offset;
-
#define RELOC_PROCESSING(relent,reloc,symbols,abfd,section) \
reloc_processing(relent, reloc, symbols, abfd, section)
BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
NULL,
-
+
COFF_SWAP_TABLE
};
#define coff_get_section_load_page bfd_ticoff_get_section_load_page
#define coff_set_section_load_page bfd_ticoff_set_section_load_page
-void
+void
bfd_ticoff_set_section_load_page (sect, page)
asection *sect;
int page;
sect->lma = (sect->lma & ADDR_MASK) | PG_TO_FLAG(page);
}
-
int
bfd_ticoff_get_section_load_page (sect)
asection *sect;
{
int page;
- /* Provide meaningful defaults for predefined sections. */
+ /* Provide meaningful defaults for predefined sections. */
if (sect == &bfd_com_section)
page = PG_DATA;
}
/* Set the architecture appropriately. Allow unkown architectures
- (e.g. binary). */
+ (e.g. binary). */
static boolean
tic54x_set_arch_mach (abfd, arch, machine)
bfd *abfd;
}
static bfd_reloc_status_type
-tic54x_relocation (abfd, reloc_entry, symbol, data, input_section,
+tic54x_relocation (abfd, reloc_entry, symbol, data, input_section,
output_bfd, error_message)
bfd *abfd ATTRIBUTE_UNUSED;
arelent *reloc_entry;
bfd *output_bfd;
char **error_message ATTRIBUTE_UNUSED;
{
-
+
if (output_bfd != (bfd *) NULL)
{
/* This is a partial relocation, and we want to apply the
/* NORMAL BANK */
/* 16-bit direct reference to symbol's address */
- HOWTO (R_RELWORD,0,1,16,false,0,complain_overflow_dont,
+ HOWTO (R_RELWORD,0,1,16,false,0,complain_overflow_dont,
tic54x_relocation,"REL16",false,0xFFFF,0xFFFF,false),
/* 7 LSBs of an address */
/* ABSOLUTE BANK */
/* 16-bit direct reference to symbol's address, absolute */
- HOWTO (R_RELWORD,0,1,16,false,0,complain_overflow_dont,
+ HOWTO (R_RELWORD,0,1,16,false,0,complain_overflow_dont,
tic54x_relocation,"AREL16",false,0xFFFF,0xFFFF,false),
/* 7 LSBs of an address, absolute */
}
}
-/* Code to turn a r_type into a howto ptr, uses the above howto table.
+/* Code to turn a r_type into a howto ptr, uses the above howto table.
Called after some initial checking by the tic54x_rtype_to_howto fn below */
static void
tic54x_lookup_howto (internal, dst)
(*_bfd_error_handler) (_("Unrecognized reloc type 0x%x"),
(unsigned int) dst->r_type);
- abort();
+ abort ();
}
#define RELOC_PROCESSING(RELENT,RELOC,SYMS,ABFD,SECT)\
{
/* This is a TI "internal relocation", which means that the relocation
amount is the amount by which the current section is being relocated
- in the output section. */
+ in the output section. */
*addendp = (sec->output_section->vma + sec->output_offset) - sec->vma;
}
/* replace the stock _bfd_coff_is_local_label_name to recognize TI COFF local
labels */
-static boolean
+static boolean
ticoff_bfd_is_local_label_name (abfd, name)
bfd *abfd ATTRIBUTE_UNUSED;
const char *name;
#define coff_bfd_is_local_label_name ticoff_bfd_is_local_label_name
-/* Customize coffcode.h; the default coff_ functions are set up to use COFF2;
+/* Customize coffcode.h; the default coff_ functions are set up to use COFF2;
coff_bad_format_hook uses BADMAG, so set that for COFF2. The COFF1
and COFF0 vectors use custom _bad_format_hook procs instead of setting
- BADMAG.
- */
+ BADMAG.
+ */
#define BADMAG(x) COFF2_BADMAG(x)
#include "coffcode.h"
file_ptr offset;
bfd_size_type bytes_to_do;
{
- return coff_set_section_contents (abfd, section, location,
+ return coff_set_section_contents (abfd, section, location,
offset, bytes_to_do);
}
asymbol *ptr;
relent->address = reloc->r_vaddr;
-
+
if (reloc->r_symndx != -1)
{
if (reloc->r_symndx < 0 || reloc->r_symndx >= obj_conv_table_size (abfd))
relent->sym_ptr_ptr = section->symbol_ptr_ptr;
ptr = *(relent->sym_ptr_ptr);
}
-
+
/* The symbols definitions that we have read in have been
relocated as if their sections started at 0. But the offsets
refering to the symbols in the raw data have not been
modified, so we have to have a negative addend to compensate.
-
+
Note that symbols which used to be common must be left alone */
-
+
/* Calculate any reloc addend by looking at the symbol */
CALC_ADDEND (abfd, ptr, *reloc, relent);
-
+
relent->address -= section->vma;
/* !! relent->section = (asection *) NULL;*/
-
+
/* Fill in the relent->howto field from reloc->r_type */
tic54x_lookup_howto (relent, reloc);
}
/* COFF0 differs in file/section header size and relocation entry size */
-static CONST bfd_coff_backend_data ticoff0_swap_table =
+static CONST bfd_coff_backend_data ticoff0_swap_table =
{
coff_SWAP_aux_in, coff_SWAP_sym_in, coff_SWAP_lineno_in,
coff_SWAP_aux_out, coff_SWAP_sym_out,
};
/* COFF1 differs in section header size */
-static CONST bfd_coff_backend_data ticoff1_swap_table =
+static CONST bfd_coff_backend_data ticoff1_swap_table =
{
coff_SWAP_aux_in, coff_SWAP_sym_in, coff_SWAP_lineno_in,
coff_SWAP_aux_out, coff_SWAP_sym_out,
coff_link_output_has_begun, coff_final_link_postscript
};
-
/* TI COFF v0, DOS tools (little-endian headers) */
const bfd_target tic54x_coff0_vec =
{
\f
/* Code to turn an external r_type into a pointer to an entry in the howto_table.
If passed an r_type we don't recognize the abort rather than silently failing
- to generate an output file. */
+ to generate an output file. */
static void
rtype2howto (cache_ptr, dst)
{
/* This is a TI "internal relocation", which means that the relocation
amount is the amount by which the current section is being relocated
- in the output section. */
+ in the output section. */
*addendp = (sec -> output_section -> vma + sec -> output_offset) - sec -> vma;
}
RTYPE2HOWTO (&genrel, rel);
sym = NULL;
}
else
- {
+ {
h = obj_coff_sym_hashes (input_bfd)[symndx];
sym = syms + symndx;
}
contents[addr + 1] |= hold & 0x80;
break;
}
-
+
case R_PPBASE:
/* Parameter RAM is from 0x1000000 to 0x1000800. */
contents[addr] &=~ 0x3;
};
-
/* Turn a howto into a reloc number */
#define SELECT_RELOC(x,howto) \
#define W65 1 /* Customize coffcode.h */
#define __A_MAGIC_SET__
-
/* Code to swap in the reloc */
#define SWAP_IN_RELOC_OFFSET bfd_h_get_32
#define SWAP_OUT_RELOC_OFFSET bfd_h_put_32
dst->r_stuff[0] = 'S'; \
dst->r_stuff[1] = 'C';
-
static int
select_reloc (howto)
reloc_howto_type *howto;
#define RTYPE2HOWTO(internal, relocentry) rtype2howto(internal,relocentry)
-
/* Perform any necessary magic to the addend in a reloc entry */
-
#define CALC_ADDEND(abfd, symbol, ext_reloc, cache_ptr) \
cache_ptr->addend = ext_reloc.r_offset;
-
#define RELOC_PROCESSING(relent,reloc,symbols,abfd,section) \
reloc_processing(relent, reloc, symbols, abfd, section)
relent->sym_ptr_ptr = (asymbol **)&(bfd_abs_symbol);
}
-
-
relent->addend = reloc->r_offset;
relent->address -= section->vma;
/* relent->section = 0;*/
}
-
static int
h8300_reloc16_estimate(abfd, input_section, reloc, shrink, link_info)
bfd *abfd;
unsigned int shrink;
struct bfd_link_info *link_info;
{
- bfd_vma value;
+ bfd_vma value;
bfd_vma dot;
bfd_vma gap;
- /* The address of the thing to be relocated will have moved back by
+ /* The address of the thing to be relocated will have moved back by
the size of the shrink - but we don't change reloc->address here,
since we need it to know where the relocation lives in the source
uncooked section */
/* reloc->address -= shrink; conceptual */
bfd_vma address = reloc->address - shrink;
-
switch (reloc->howto->type)
- {
+ {
case R_MOV16B2:
case R_JMP2:
shrink+=2;
value = bfd_coff_reloc16_get_value(reloc, link_info, input_section);
if (value >= 0xff00)
- {
+ {
/* Change the reloc type from 16bit, possible 8 to 8bit
possible 16 */
- reloc->howto = reloc->howto + 1;
+ reloc->howto = reloc->howto + 1;
/* The place to relc moves back by one */
/* This will be two bytes smaller in the long run */
shrink +=2 ;
bfd_perform_slip(abfd, 2, input_section, address);
- }
+ }
break;
- /* This is the 24 bit branch which could become an 8 bitter,
+ /* This is the 24 bit branch which could become an 8 bitter,
the relocation points to the first byte of the insn, not the
actual data */
case R_JMPL1:
value = bfd_coff_reloc16_get_value(reloc, link_info, input_section);
-
+
dot = input_section->output_section->vma +
input_section->output_offset + address;
-
+
/* See if the address we're looking at within 127 bytes of where
we are, if so then we can use a small branch rather than the
jump we were going to */
gap = value - dot ;
-
+
if (-120 < (long)gap && (long)gap < 120 )
- {
+ {
/* Change the reloc type from 24bit, possible 8 to 8bit
possible 32 */
- reloc->howto = reloc->howto + 1;
+ reloc->howto = reloc->howto + 1;
/* This will be two bytes smaller in the long run */
shrink +=2 ;
bfd_perform_slip(abfd, 2, input_section, address);
case R_JMP1:
value = bfd_coff_reloc16_get_value(reloc, link_info, input_section);
-
+
dot = input_section->output_section->vma +
input_section->output_offset + address;
-
+
/* See if the address we're looking at within 127 bytes of where
we are, if so then we can use a small branch rather than the
jump we were going to */
gap = value - (dot - shrink);
-
if (-120 < (long)gap && (long)gap < 120 )
- {
+ {
/* Change the reloc type from 16bit, possible 8 to 8bit
possible 16 */
- reloc->howto = reloc->howto + 1;
+ reloc->howto = reloc->howto + 1;
/* The place to relc moves back by one */
/* This will be two bytes smaller in the long run */
break;
}
-
return shrink;
}
-
/* First phase of a relaxing link */
/* Reloc types
{
int gap = bfd_coff_reloc16_get_value (reloc, link_info,
input_section);
- bfd_vma dot = link_order->offset
- + dst_address
+ bfd_vma dot = link_order->offset
+ + dst_address
+ link_order->u.indirect.section->output_section->vma;
gap -= dot + 1;
(link_info, bfd_asymbol_name (*reloc->sym_ptr_ptr),
reloc->howto->name, reloc->addend, input_section->owner,
input_section, reloc->address)))
- abort();
+ abort ();
}
bfd_put_8 (abfd, gap, data + dst_address);
dst_address += 1;
{
bfd_vma gap = bfd_coff_reloc16_get_value (reloc, link_info,
input_section);
- bfd_vma dot = link_order->offset
- + dst_address
+ bfd_vma dot = link_order->offset
+ + dst_address
+ link_order->u.indirect.section->output_section->vma;
-
/* This wraps within the page, so ignore the relativeness, look at the
high part */
if ((gap & 0xf0000) != (dot & 0xf0000)) {
(link_info, bfd_asymbol_name (*reloc->sym_ptr_ptr),
reloc->howto->name, reloc->addend, input_section->owner,
input_section, reloc->address)))
- abort();
+ abort ();
}
gap -= dot + 2;
#include "coffcode.h"
-
#undef coff_bfd_get_relocated_section_contents
#undef coff_bfd_relax_section
#define coff_bfd_get_relocated_section_contents \
#define COFF_DEFAULT_SECTION_ALIGNMENT_POWER (3)
-static reloc_howto_type howto_table[] =
+static reloc_howto_type howto_table[] =
{
EMPTY_HOWTO (0),
EMPTY_HOWTO (1),
/* Turn a howto into a reloc number */
-static int
+static int
coff_z8k_select_reloc (howto)
reloc_howto_type *howto;
{
#define SELECT_RELOC(x,howto) x.r_type = coff_z8k_select_reloc(howto)
-
#define BADMAG(x) Z8KBADMAG(x)
#define Z8K 1 /* Customize coffcode.h */
#define __A_MAGIC_SET__
-
-
/* Code to swap in the reloc */
#define SWAP_IN_RELOC_OFFSET bfd_h_get_32
#define SWAP_OUT_RELOC_OFFSET bfd_h_put_32
#define RTYPE2HOWTO(internal, relocentry) rtype2howto(internal,relocentry)
-
/* Perform any necessary magic to the addend in a reloc entry */
-
#define CALC_ADDEND(abfd, symbol, ext_reloc, cache_ptr) \
cache_ptr->addend = ext_reloc.r_offset;
-
#define RELOC_PROCESSING(relent,reloc,symbols,abfd,section) \
reloc_processing(relent, reloc, symbols, abfd, section)
-static void
+static void
reloc_processing (relent, reloc, symbols, abfd, section)
arelent * relent;
struct internal_reloc *reloc;
relent->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr;
}
-
relent->addend = reloc->r_offset;
relent->address -= section->vma;
}
case R_IMM4L:
bfd_put_8 (in_abfd,
- ((bfd_get_8 (in_abfd, data + *dst_ptr) & 0xf0)
+ ((bfd_get_8 (in_abfd, data + *dst_ptr) & 0xf0)
| (0x0f
& bfd_coff_reloc16_get_value (reloc, link_info,
input_section))),
#include "coffcode.h"
-
#undef coff_bfd_get_relocated_section_contents
#undef coff_bfd_relax_section
#define coff_bfd_get_relocated_section_contents \