static reloc_howto_type *coff_i386_rtype_to_howto
PARAMS ((bfd *, asection *, struct internal_reloc *,
struct coff_link_hash_entry *, struct internal_syment *,
-
bfd_vma *));
+static reloc_howto_type *coff_i386_reloc_type_lookup
+ PARAMS ((bfd *, bfd_reloc_code_real_type));
+static const bfd_target *i3coff_object_p PARAMS ((bfd *));
#define COFF_DEFAULT_SECTION_ALIGNMENT_POWER (2)
/* The page size is a guess based on ELF. */
#ifdef COFF_WITH_PE
/* FIXME: How should this case be handled? */
- if (reloc_entry->howto->type == R_IMAGEBASE && diff != 0)
- abort ();
+ if (reloc_entry->howto->type == R_IMAGEBASE)
+ diff -= pe_data (output_bfd)->pe_opthdr.ImageBase;
#endif
#define DOIT(x) \
0xffffffff, /* src_mask */
0xffffffff, /* dst_mask */
true), /* pcrel_offset */
- /* {7}, */
+ /* PE IMAGE_REL_I386_DIR32NB relocation (7). */
HOWTO (R_IMAGEBASE, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
EMPTY_HOWTO (014),
EMPTY_HOWTO (015),
EMPTY_HOWTO (016),
- HOWTO (R_RELBYTE, /* type */
+ /* Byte relocation (017). */
+ HOWTO (R_RELBYTE, /* type */
0, /* rightshift */
0, /* size (0 = byte, 1 = short, 2 = long) */
8, /* bitsize */
0x000000ff, /* src_mask */
0x000000ff, /* dst_mask */
PCRELOFFSET), /* pcrel_offset */
+ /* 16-bit word relocation (020). */
HOWTO (R_RELWORD, /* type */
0, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
0x0000ffff, /* src_mask */
0x0000ffff, /* dst_mask */
PCRELOFFSET), /* pcrel_offset */
+ /* 32-bit longword relocation (021). */
HOWTO (R_RELLONG, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
0xffffffff, /* src_mask */
0xffffffff, /* dst_mask */
PCRELOFFSET), /* pcrel_offset */
+ /* Byte PC relative relocation (022). */
HOWTO (R_PCRBYTE, /* type */
0, /* rightshift */
0, /* size (0 = byte, 1 = short, 2 = long) */
0x000000ff, /* src_mask */
0x000000ff, /* dst_mask */
PCRELOFFSET), /* pcrel_offset */
+ /* 16-bit word PC relative relocation (023). */
HOWTO (R_PCRWORD, /* type */
0, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
0x0000ffff, /* src_mask */
0x0000ffff, /* dst_mask */
PCRELOFFSET), /* pcrel_offset */
+ /* 32-bit longword PC relative relocation (024). */
HOWTO (R_PCRLONG, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
#define BADMAG(x) I386BADMAG(x)
#define I386 1 /* Customize coffcode.h */
-#define RTYPE2HOWTO(cache_ptr, dst) \
- (cache_ptr)->howto = howto_table + (dst)->r_type;
+#define RTYPE2HOWTO(cache_ptr, dst) \
+ ((cache_ptr)->howto = \
+ ((dst)->r_type < sizeof (howto_table) / sizeof (howto_table[0]) \
+ ? howto_table + (dst)->r_type \
+ : NULL))
/* For 386 COFF a STYP_NOLOAD | STYP_BSS section is part of a shared
library. On some other COFF targets STYP_BSS is normally
struct internal_syment *sym;
bfd_vma *addendp;
{
-
reloc_howto_type *howto;
+ if (rel->r_type > sizeof (howto_table) / sizeof (howto_table[0]))
+ {
+ bfd_set_error (bfd_error_bad_value);
+ return NULL;
+ }
+
howto = howto_table + rel->r_type;
#ifdef COFF_WITH_PE
+ /* Cancel out code in _bfd_coff_generic_relocate_section. */
*addendp = 0;
#endif
return howto;
}
-
#define coff_bfd_reloc_type_lookup coff_i386_reloc_type_lookup
-
static reloc_howto_type *
coff_i386_reloc_type_lookup (abfd, code)
bfd *abfd ATTRIBUTE_UNUSED;
moment. To port BFD, that person will have to add more @code{#defines}.
Three of the bit twiddling routines are exported to
@code{gdb}; @code{coff_swap_aux_in}, @code{coff_swap_sym_in}
- and @code{coff_swap_linno_in}. @code{GDB} reads the symbol
+ and @code{coff_swap_lineno_in}. @code{GDB} reads the symbol
table on its own, but uses BFD to fix things up. More of the
bit twiddlers are exported for @code{gas};
@code{coff_swap_aux_out}, @code{coff_swap_sym_out},
#ifdef COFF_LONG_SECTION_NAMES
/* Handle long section names as in PE. This must be compatible
- with the code in coff_write_symbols. */
+ with the code in coff_write_symbols and _bfd_coff_final_link. */
{
size_t len;
#endif
#ifdef COFF_IMAGE_WITH_PE
- /* suppress output of the sections if they are null. ld includes
- the bss and data sections even if there is no size assigned
- to them. NT loader doesn't like it if these section headers are
- included if the sections themselves are not needed */
+ /* Suppress output of the sections if they are null. ld
+ includes the bss and data sections even if there is no size
+ assigned to them. NT loader doesn't like it if these section
+ headers are included if the sections themselves are not
+ needed. See also coff_compute_section_file_positions. */
if (section.s_size == 0)
internal_f.f_nscns--;
else
base of the line number information for the table is stored in
the symbol associated with the function.
+ Note: The PE format uses line number 0 for a flag indicating a
+ new source file.
+
The information is copied from the external to the internal
table, and each symbol which marks a function is marked by
pointing its...
return true;
}
+/* Slurp in the symbol table, converting it to generic form. Note
+ that if coff_relocate_section is defined, the linker will read
+ symbols via coff_link_add_symbols, rather than via this routine. */
+
static boolean
coff_slurp_symbol_table (abfd)
bfd * abfd;
case C_THUMBSTATFUNC:/* Thumb static function */
#endif
case C_LABEL: /* label */
- if (src->u.syment.n_scnum == -2)
+ if (src->u.syment.n_scnum == N_DEBUG)
dst->symbol.flags = BSF_DEBUGGING;
else
dst->symbol.flags = BSF_LOCAL;
break;
case C_NULL:
+ /* PE DLLs sometimes have zeroed out symbols for some
+ reason. Just ignore them without a warning. */
+ if (src->u.syment.n_type == 0
+ && src->u.syment.n_value == 0
+ && src->u.syment.n_scnum == 0)
+ break;
+ /* Fall through. */
case C_EXTDEF: /* external definition */
case C_ULABEL: /* undefined label */
case C_USTATIC: /* undefined static */
struct bfd_link_info *link_info ATTRIBUTE_UNUSED;
{
abort ();
+ return 0;
}
#endif