#define COFF_DEFAULT_SECTION_ALIGNMENT_POWER (1)
/* We derive a hash table from the basic BFD hash table to
- hold entries in the function vector. Aside from the
+ hold entries in the function vector. Aside from the
info stored by the basic hash table, we need the offset
of a particular entry within the hash table as well as
the offset where we'll add the next entry. */
We only come here for pcrel stuff and return normally if not an -r link.
When doing -r, we can't do any arithmetic for the pcrel stuff, because
the code in reloc.c assumes that we can manipulate the targets of
- the pcrel branches. This isn't so, since the H8/300 can do relaxing,
+ the pcrel branches. This isn't so, since the H8/300 can do relaxing,
which means that the gap after the instruction may not be enough to
contain the offset required for the branch, so we have to use only
the addend until the final link. */
static asection *last_input_section = NULL;
static arelent *last_reloc = NULL;
- /* 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. */
/* Only examine the relocs which might be relaxable. */
switch (reloc->howto->type)
- {
+ {
/* This is the 16/24 bit absolute branch which could become an 8 bit
pc-relative branch. */
case R_JMP1:
this jump. +128 is valid since the target will move two bytes
closer if we do relax this branch. */
if ((int)gap >= -128 && (int)gap <= 128 )
- {
+ {
/* It's possible we may be able to eliminate this branch entirely;
if the previous instruction is a branch around this instruction,
and there's no label at this instruction, then we can reverse
bCC lab1 bCC' lab2
jmp lab2
lab1: lab1:
-
+
This saves 4 bytes instead of two, and should be relatively
common. */
this jump. +128 is valid since the target will move two bytes
closer if we do relax this branch. */
if ((int)gap >= -128 && (int)gap <= 128 )
- {
+ {
/* Change the reloc type. */
reloc->howto = howto_table + 15;
value = bfd_coff_reloc16_get_value (reloc, link_info, input_section);
/* Get the address of the instruction (not the reloc). */
- dot = (link_order->offset
- + dst_address
+ dot = (link_order->offset
+ + dst_address
+ link_order->u.indirect.section->output_section->vma + 1);
gap = value - dot;
src_address += 2;
break;
-
+
/* Similarly for a 24bit absolute that is now 8 bits. */
case R_JMPL2:
/* Get the address of the target of this branch. */
}
/* This is a jump/call through a function vector, and we're
- expected to create the function vector ourselves.
+ expected to create the function vector ourselves.
First look up this symbol in the linker hash table -- we need
the derived linker symbol which holds this symbol's index
h = funcvec_hash_lookup (h8300_coff_hash_table (info)->funcvec_hash_table,
name, false, false);
-
/* If this symbol isn't already in the hash table, add
it and bump up the size of the hash table. */
if (h == NULL)
HOWTO (R_H8500_IMM32, 0, 1, 32, false, 0,
complain_overflow_bitfield, 0, "r_imm32", true, 0xffffffff, 0xffffffff, false);
-
static reloc_howto_type r_high8 =
HOWTO (R_H8500_HIGH8, 0, 1, 8, false, 0,
complain_overflow_dont, 0, "r_high8", true, 0x000000ff, 0x000000ff, false);
static reloc_howto_type r_pcrel8 =
HOWTO (R_H8500_PCREL8, 0, 1, 8, true, 0, complain_overflow_signed, 0, "r_pcrel8", true, 0, 0, true);
-
static reloc_howto_type r_pcrel16 =
HOWTO (R_H8500_PCREL16, 0, 1, 16, true, 0, complain_overflow_signed, 0, "r_pcrel16", true, 0, 0, true);
HOWTO (R_H8500_HIGH16, 0, 1, 8, false, 0,
complain_overflow_dont, 0, "r_high16", true, 0x000ffff, 0x0000ffff, false);
-
/* Turn a howto into a reloc number */
-static int
+static int
coff_h8500_select_reloc (howto)
reloc_howto_type *howto;
{
#define SELECT_RELOC(x,howto) x.r_type = coff_h8500_select_reloc(howto)
-
#define BADMAG(x) H8500BADMAG(x)
#define H8500 1 /* Customize coffcode.h */
#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 = bfd_abs_section_ptr->symbol_ptr_ptr;
}
-
relent->addend = reloc->r_offset;
relent->address -= section->vma;
}
(*dst_ptr) += 2;
(*src_ptr) += 2;
break;
-
+
case R_H8500_HIGH16:
bfd_put_16 (in_abfd,
(bfd_coff_reloc16_get_value (reloc, link_info, input_section)
}
break;
-
case R_H8500_PCREL8:
{
bfd_vma dst = bfd_coff_reloc16_get_value (reloc, link_info,
#include "coffcode.h"
-
#undef coff_bfd_get_relocated_section_contents
#undef coff_bfd_relax_section
#define coff_bfd_get_relocated_section_contents \
#include "libcoff.h"
-static bfd_reloc_status_type coff_i860_reloc
+static bfd_reloc_status_type coff_i860_reloc
PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
static reloc_howto_type *coff_i860_rtype_to_howto
PARAMS ((bfd *, asection *, struct internal_reloc *,
if (output_bfd == (bfd *) NULL)
return bfd_reloc_continue;
-
if (bfd_is_com_section (symbol->section))
{
/* We are relocating a common symbol. The current value in the
diff = reloc_entry->addend;
}
-
#define DOIT(x) \
x = ((x & ~howto->dst_mask) | (((x & howto->src_mask) + diff) & howto->dst_mask))
#define PCRELOFFSET false
#endif
-static reloc_howto_type howto_table[] =
+static reloc_howto_type howto_table[] =
{
EMPTY_HOWTO (0),
EMPTY_HOWTO (1),
EMPTY_HOWTO (3),
EMPTY_HOWTO (4),
EMPTY_HOWTO (5),
- HOWTO (R_DIR32, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- false, /* pc_relative */
- 0, /* bitpos */
+ HOWTO (R_DIR32, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
- coff_i860_reloc, /* special_function */
- "dir32", /* name */
- true, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* dst_mask */
+ coff_i860_reloc, /* special_function */
+ "dir32", /* name */
+ true, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
true), /* pcrel_offset */
/* {7}, */
- HOWTO (R_IMAGEBASE, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- false, /* pc_relative */
- 0, /* bitpos */
+ HOWTO (R_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 */
- coff_i860_reloc, /* special_function */
- "rva32", /* name */
- true, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* dst_mask */
+ coff_i860_reloc, /* special_function */
+ "rva32", /* name */
+ true, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
false), /* pcrel_offset */
EMPTY_HOWTO (010),
EMPTY_HOWTO (011),
EMPTY_HOWTO (014),
EMPTY_HOWTO (015),
EMPTY_HOWTO (016),
- HOWTO (R_RELBYTE, /* type */
- 0, /* rightshift */
- 0, /* size (0 = byte, 1 = short, 2 = long) */
- 8, /* bitsize */
- false, /* pc_relative */
- 0, /* bitpos */
+ HOWTO (R_RELBYTE, /* type */
+ 0, /* rightshift */
+ 0, /* size (0 = byte, 1 = short, 2 = long) */
+ 8, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
- coff_i860_reloc, /* special_function */
- "8", /* name */
- true, /* partial_inplace */
- 0x000000ff, /* src_mask */
- 0x000000ff, /* dst_mask */
+ coff_i860_reloc, /* special_function */
+ "8", /* name */
+ true, /* partial_inplace */
+ 0x000000ff, /* src_mask */
+ 0x000000ff, /* dst_mask */
PCRELOFFSET), /* pcrel_offset */
- HOWTO (R_RELWORD, /* type */
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- false, /* pc_relative */
- 0, /* bitpos */
+ HOWTO (R_RELWORD, /* type */
+ 0, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
- coff_i860_reloc, /* special_function */
- "16", /* name */
- true, /* partial_inplace */
- 0x0000ffff, /* src_mask */
- 0x0000ffff, /* dst_mask */
+ coff_i860_reloc, /* special_function */
+ "16", /* name */
+ true, /* partial_inplace */
+ 0x0000ffff, /* src_mask */
+ 0x0000ffff, /* dst_mask */
PCRELOFFSET), /* pcrel_offset */
- HOWTO (R_RELLONG, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- false, /* pc_relative */
- 0, /* bitpos */
+ HOWTO (R_RELLONG, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
- coff_i860_reloc, /* special_function */
- "32", /* name */
- true, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* dst_mask */
+ coff_i860_reloc, /* special_function */
+ "32", /* name */
+ true, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
PCRELOFFSET), /* pcrel_offset */
- HOWTO (R_PCRBYTE, /* type */
- 0, /* rightshift */
- 0, /* size (0 = byte, 1 = short, 2 = long) */
- 8, /* bitsize */
- true, /* pc_relative */
- 0, /* bitpos */
+ HOWTO (R_PCRBYTE, /* type */
+ 0, /* rightshift */
+ 0, /* size (0 = byte, 1 = short, 2 = long) */
+ 8, /* bitsize */
+ true, /* pc_relative */
+ 0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
- coff_i860_reloc, /* special_function */
- "DISP8", /* name */
- true, /* partial_inplace */
- 0x000000ff, /* src_mask */
- 0x000000ff, /* dst_mask */
+ coff_i860_reloc, /* special_function */
+ "DISP8", /* name */
+ true, /* partial_inplace */
+ 0x000000ff, /* src_mask */
+ 0x000000ff, /* dst_mask */
PCRELOFFSET), /* pcrel_offset */
- HOWTO (R_PCRWORD, /* type */
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- true, /* pc_relative */
- 0, /* bitpos */
+ HOWTO (R_PCRWORD, /* type */
+ 0, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ true, /* pc_relative */
+ 0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
- coff_i860_reloc, /* special_function */
- "DISP16", /* name */
- true, /* partial_inplace */
- 0x0000ffff, /* src_mask */
- 0x0000ffff, /* dst_mask */
+ coff_i860_reloc, /* special_function */
+ "DISP16", /* name */
+ true, /* partial_inplace */
+ 0x0000ffff, /* src_mask */
+ 0x0000ffff, /* dst_mask */
PCRELOFFSET), /* pcrel_offset */
- HOWTO (R_PCRLONG, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- true, /* pc_relative */
- 0, /* bitpos */
+ HOWTO (R_PCRLONG, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ true, /* pc_relative */
+ 0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
- coff_i860_reloc, /* special_function */
- "DISP32", /* name */
- true, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* dst_mask */
+ coff_i860_reloc, /* special_function */
+ "DISP32", /* name */
+ true, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
PCRELOFFSET) /* pcrel_offset */
};
function will be adding in the final value of the symbol. We
need to subtract out the current size in order to get the
correct result. */
-
- BFD_ASSERT (h != NULL);
+ BFD_ASSERT (h != NULL);
/* I think we *do* want to bypass this. If we don't, I have seen some data
parameters get the wrong relcation address. If I link two versions
with and without this section bypassed and then do a binary comparison,
- the addresses which are different can be looked up in the map. The
+ the addresses which are different can be looked up in the map. The
case in which this section has been bypassed has addresses which correspond
to values I can find in the map */
*addendp -= sym->n_value;
/* If the output symbol is common (in which case this must be a
relocateable link), we need to add in the final size of the
common symbol. */
- if (h != NULL && h->root.type == bfd_link_hash_common)
+ if (h != NULL && h->root.type == bfd_link_hash_common)
*addendp += h->root.u.c.size;
return howto;
bfd_getl32, bfd_getl_signed_32, bfd_putl32,
bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* hdrs */
-/* Note that we allow an object file to be treated as a core file as well. */
+/* Note that we allow an object file to be treated as a core file as well. */
{_bfd_dummy_target, i3coff_object_p, /* bfd_check_format */
bfd_generic_archive_p, i3coff_object_p},
{bfd_false, coff_mkobject, _bfd_generic_mkarchive, /* bfd_set_format */
BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
NULL,
-
+
COFF_SWAP_TABLE
};