+2000-02-29 H.J. Lu <hjl@gnu.org>
+
+ * peicode.h (jtab): Make it static.
+
+ * coff-sh.c (sh_align_load_span): Declared if COFF_WITH_PE is
+ defined and COFF_IMAGE_WITH_PE is not defined.
+ (_bfd_sh_align_load_span): Defined as sh_align_load_span if
+ COFF_WITH_PE is defined and COFF_IMAGE_WITH_PE is not defined.
+
+2000-03-01 Nick Clifton <nickc@cygnus.com>
+
+ * coff-arm.c (bfd_arm_process_before_allocation): Make
+ 'symndx' signed to prevent compile time warning.
+
+ * coff-mcore.c: Remove unused prototype for pe_object_p.
+
+ * coff-sh.c: Add "#ifndef COFF_IMAGE_WITH_PE" around static
+ functions that are not used when COFF_IMAGE_WITH_PE is
+ defined.
+ (struct sh_opcode): Change type of 'flags' field to unsigned
+ long so that it can hold the USESAS flag.
+
+ * coffcode.h (styp_to_sec_flags): Initialise 'target_name'.
+
+ * elf-m10300.c (mn10300_elf_relax_section): Initialise
+ 'sym_sec'.
+
+ * elf32-i370.c: Add ATTRIBUTE_UNUSED to unused function
+ parameters.
+ Remove unusued variables and code.
+ (elf_backend_add_symbol_hook): Fix prototype.
+
+ * elf32-m68k.c (elf_m68k_gc_sweep_hook): Initialise 'sgot' and
+ 'srelgot'.
+
+ * elf32-mcore.c (mcore_elf_relocate_section): Initialise
+ 'oldinst'.
+
+ * elf32-mips.c: Add ATTRIBUTE_UNUSED to unused function
+ parameters.
+ Remove unusued variables and code.
+ (elf_backend_add_symbol_hook): Fix prototype.
+
+ * elf32-sh.c (sh_elf_set_mach_from_flags): Use 'flags'.
+
+ * elflink.h (elf_bfd_link_add_symbols): Add ATTRIBUTE_UNUSED
+ to unused function parameter.
+
+ * pe-mips.c: Add ATTRIBUTE_UNUSED to unused function
+ parameters.
+ Use EMPTY_HOWTO to initialise empty howto slots.
+ Remove unused variables.
+
+ * peicode.h (pe_ILF_build_a_bfd): Initialise id6.
+
2000-03-01 H.J. Lu <hjl@gnu.org>
* aoutx.h (aout_link_input_section_std): Pass "true" to
extern boolean bfd_arm_get_bfd_for_interworking
PARAMS ((bfd *, struct bfd_link_info *));
+/* PE ARM Interworking support. Called from linker. */
+extern boolean bfd_arm_pe_allocate_interworking_sections
+ PARAMS ((struct bfd_link_info *));
+
+extern boolean bfd_arm_pe_process_before_allocation
+ PARAMS ((bfd *, struct bfd_link_info *, int));
+
+extern boolean bfd_arm_pe_get_bfd_for_interworking
+ PARAMS ((bfd *, struct bfd_link_info *));
+
/* ELF ARM Interworking support. Called from linker. */
extern boolean bfd_elf32_arm_allocate_interworking_sections
PARAMS ((struct bfd_link_info *));
extern boolean bfd_arm_get_bfd_for_interworking
PARAMS ((bfd *, struct bfd_link_info *));
+/* PE ARM Interworking support. Called from linker. */
+extern boolean bfd_arm_pe_allocate_interworking_sections
+ PARAMS ((struct bfd_link_info *));
+
+extern boolean bfd_arm_pe_process_before_allocation
+ PARAMS ((bfd *, struct bfd_link_info *, int));
+
+extern boolean bfd_arm_pe_get_bfd_for_interworking
+ PARAMS ((bfd *, struct bfd_link_info *));
+
/* ELF ARM Interworking support. Called from linker. */
extern boolean bfd_elf32_arm_allocate_interworking_sections
PARAMS ((struct bfd_link_info *));
for (rel = i; rel < i + sec->reloc_count; ++rel)
{
unsigned short r_type = rel->r_type;
- unsigned long symndx;
+ long symndx;
struct coff_link_hash_entry * h;
symndx = rel->r_symndx;
static reloc_howto_type * coff_mcore_rtype_to_howto
PARAMS ((bfd *, asection *, struct internal_reloc *,
struct coff_link_hash_entry *, struct internal_syment *, bfd_vma *));
-static const bfd_target * pe_object_p
- PARAMS ((bfd *));
-
-
\f
/* The NT loader points the toc register to &toc + 32768, in order to
use the complete range of a 16-bit displacement. We have to adjust
#ifdef COFF_WITH_PE
#include "coff/pe.h"
+
+#ifndef COFF_IMAGE_WITH_PE
+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 *));
+
+#define _bfd_sh_align_load_span sh_align_load_span
+#endif
#endif
#include "libcoff.h"
PARAMS ((bfd *, asection *, struct bfd_link_info *, boolean *));
static boolean sh_relax_delete_bytes
PARAMS ((bfd *, asection *, bfd_vma, int));
+#ifndef COFF_IMAGE_WITH_PE
static const struct sh_opcode *sh_insn_info PARAMS ((unsigned int));
+#endif
static boolean sh_align_loads
PARAMS ((bfd *, asection *, struct internal_reloc *, bfd_byte *, boolean *));
static boolean sh_swap_insns
static reloc_howto_type *
coff_sh_rtype_to_howto (abfd, sec, rel, h, sym, addendp)
- bfd * abfd;
+ bfd * abfd ATTRIBUTE_UNUSED;
asection * sec;
struct internal_reloc * rel;
struct coff_link_hash_entry * h;
mask value in the sh_major_opcode structure. */
unsigned short opcode;
/* Flags for this instruction. */
- unsigned short flags;
+ unsigned long flags;
};
/* Flag which appear in the sh_opcode structure. */
#define SETSAS (0x40000)
#define SETSAS_REG(x) USESAS_REG (x)
+#ifndef COFF_IMAGE_WITH_PE
static boolean sh_insn_uses_reg
PARAMS ((unsigned int, const struct sh_opcode *, unsigned int));
static boolean sh_insn_sets_reg
static boolean sh_load_use
PARAMS ((unsigned int, const struct sh_opcode *, unsigned int,
const struct sh_opcode *));
-
+#endif
/* The opcode maps. */
#define MAP(a) a, sizeof a / sizeof a[0]
{ MAP (sh_dsp_opcodef0), 0xfc0d }
};
+#ifndef COFF_IMAGE_WITH_PE
/* Given an instruction, return a pointer to the corresponding
sh_opcode structure. Return NULL if the instruction is not
recognized. */
return false;
}
-#ifndef COFF_IMAGE_WITH_PE
/* Try to align loads and stores within a span of memory. This is
called by both the ELF and the COFF sh targets. ABFD and SEC are
the BFD and section we are examining. CONTENTS is the contents of
STOP are the range of memory to examine. If a swap is made,
*PSWAPPED is set to true. */
+#ifdef COFF_WITH_PE
+static
+#endif
boolean
_bfd_sh_align_load_span (abfd, sec, contents, swap, relocs,
plabel, label_end, start, stop, pswapped)
return true;
}
-#endif
+#endif /* not COFF_IMAGE_WITH_PE */
/* Look for loads and stores which we can align to four byte
boundaries. See the longer comment above sh_relax_section for why
CREATE_LITTLE_COFF_TARGET_VEC (TARGET_SYM, TARGET_SHL_NAME, BFD_IS_RELAXABLE,
SEC_CODE | SEC_DATA, '_', NULL);
#else
-CREATE_LITTLE_COFF_TARGET_VEC (TARGET_SYM, TARGET_SHL_NAME, BFD_IS_RELAXABLE, 0, '_', NULL)
+CREATE_LITTLE_COFF_TARGET_VEC (TARGET_SYM, TARGET_SHL_NAME, BFD_IS_RELAXABLE,
+ 0, '_', NULL)
#endif
-
+
#ifndef TARGET_SHL_SYM
/* Some people want versions of the SH COFF target which do not align
to 16 byte boundaries. We implement that by adding a couple of new
{
bfd_byte *esymstart, *esym, *esymend;
int seen_state = 0;
- char *target_name;
+ char *target_name = NULL;
esymstart = esym = (bfd_byte *) obj_coff_external_syms (abfd);
esymend = esym + obj_raw_syment_count (abfd) * bfd_coff_symesz (abfd);
{
struct elf32_mn10300_link_hash_entry *hash;
Elf_Internal_Sym *sym;
- asection *sym_sec;
+ asection *sym_sec = NULL;
const char *sym_name;
char *new_name;
sym_sec = bfd_abs_section_ptr;
else if (isym.st_shndx == SHN_COMMON)
sym_sec = bfd_com_section_ptr;
-
+
sym_name = bfd_elf_string_from_elf_section (input_bfd,
symtab_hdr->sh_link,
isym.st_name);
{
Elf_Internal_Sym isym;
struct elf32_mn10300_link_hash_entry *sym_hash;
- asection *sym_sec;
+ asection *sym_sec = NULL;
const char *sym_name;
char *new_name;
sym_sec = bfd_abs_section_ptr;
else if (isym.st_shndx == SHN_COMMON)
sym_sec = bfd_com_section_ptr;
-
+ else
+ abort ();
+
sym_name = bfd_elf_string_from_elf_section (input_bfd,
symtab_hdr->sh_link,
isym.st_name);
if (ELF32_R_SYM (irel->r_info) < symtab_hdr->sh_info)
{
Elf_Internal_Sym isym;
- asection *sym_sec;
+ asection *sym_sec = NULL;
const char *sym_name;
char *new_name;
sym_sec = bfd_abs_section_ptr;
else if (isym.st_shndx == SHN_COMMON)
sym_sec = bfd_com_section_ptr;
-
+ else
+ abort ();
+
symval = (isym.st_value
+ sym_sec->output_section->vma
+ sym_sec->output_offset);
\f
static reloc_howto_type *
i370_elf_reloc_type_lookup (abfd, code)
- bfd *abfd;
+ bfd *abfd ATTRIBUTE_UNUSED;
bfd_reloc_code_real_type code;
{
enum i370_reloc_type i370_reloc = R_I370_NONE;
static boolean i370_elf_fake_sections PARAMS ((bfd *,
Elf32_Internal_Shdr *,
asection *));
-
+#if 0
static elf_linker_section_t *i370_elf_create_linker_section
PARAMS ((bfd *abfd,
struct bfd_link_info *info,
enum elf_linker_section_enum));
-
+#endif
static boolean i370_elf_check_relocs PARAMS ((bfd *,
struct bfd_link_info *,
asection *,
static void
i370_elf_info_to_howto (abfd, cache_ptr, dst)
- bfd *abfd;
+ bfd *abfd ATTRIBUTE_UNUSED;
arelent *cache_ptr;
Elf32_Internal_Rela *dst;
{
static boolean
i370_elf_fake_sections (abfd, shdr, asect)
- bfd *abfd;
+ bfd *abfd ATTRIBUTE_UNUSED;
Elf32_Internal_Shdr *shdr;
asection *asect;
{
}
\f
+#if 0
/* Create a special linker section */
/* XXX hack alert bogus This routine is mostly all junk and almost
* certainly does the wrong thing. Its here simply because it does
return lsect;
}
-
+#endif
\f
/* We have to create .dynsbss and .rela.sbss here so that they get mapped
to output sections (just like _bfd_elf_create_dynamic_sections has
bfd *dynobj = elf_hash_table (info)->dynobj;
asection *s;
unsigned int power_of_two;
- bfd_vma plt_offset;
#ifdef DEBUG
fprintf (stderr, "i370_elf_adjust_dynamic_symbol called for %s\n",
const Elf_Internal_Rela *rel;
const Elf_Internal_Rela *rel_end;
bfd_vma *local_got_offsets;
- elf_linker_section_t *sdata;
- elf_linker_section_t *sdata2;
asection *sreloc;
- asection *sgot;
- asection *srelgot = NULL;
if (info->relocateable)
return true;
#define elf_backend_add_symbol_hook \
(boolean (*) PARAMS ((bfd *, struct bfd_link_info *, \
- const char *, Elf_Internal_Sym *, \
- asection *))) i370_noop
+ const Elf_Internal_Sym *, const char **, flagword *, \
+ asection **, bfd_vma *))) i370_noop
#define elf_backend_finish_dynamic_symbol \
(boolean (*) PARAMS ((bfd *, struct bfd_link_info *, \
struct elf_link_hash_entry *, \
unsigned long r_symndx;
struct elf_link_hash_entry *h;
bfd *dynobj;
- asection *sgot;
- asection *srelgot;
+ asection *sgot = NULL;
+ asection *srelgot = NULL;
symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
sym_hashes = elf_sym_hashes (abfd);
Elf_Internal_Sym * sym = (Elf_Internal_Sym *) 0;
unsigned long r_symndx;
struct elf_link_hash_entry * h = (struct elf_link_hash_entry *) 0;
- unsigned short oldinst;
+ unsigned short oldinst = 0;
/* Unknown relocation handling */
if ((unsigned) r_type >= (unsigned) R_MCORE_max
PARAMS ((bfd *, const Elf32_External_gptab *, Elf32_gptab *));
static void bfd_mips_elf32_swap_gptab_out
PARAMS ((bfd *, const Elf32_gptab *, Elf32_External_gptab *));
+#if 0
static void bfd_mips_elf_swap_msym_in
PARAMS ((bfd *, const Elf32_External_Msym *, Elf32_Internal_Msym *));
+#endif
static void bfd_mips_elf_swap_msym_out
PARAMS ((bfd *, const Elf32_Internal_Msym *, Elf32_External_Msym *));
static boolean mips_elf_sym_is_global PARAMS ((bfd *, asymbol *));
bfd_h_put_16 (abfd, in->section, ex->section);
bfd_h_put_32 (abfd, in->info, ex->info);
}
-
+#if 0
/* Swap in an MSYM entry. */
static void
in->ms_hash_value = bfd_h_get_32 (abfd, ex->ms_hash_value);
in->ms_info = bfd_h_get_32 (abfd, ex->ms_info);
}
-
+#endif
/* Swap out an MSYM entry. */
static void
struct mips_got_info *g;
bfd_byte *entry;
bfd_byte *last_entry;
- bfd_vma index;
+ bfd_vma index = 0;
bfd_vma address;
g = mips_elf_got_info (elf_hash_table (info)->dynobj, &sgot);
struct mips_got_info *g;
bfd_byte *entry;
bfd_byte *last_entry;
- bfd_vma index;
+ bfd_vma index = 0;
bfd_vma address;
/* Although the ABI says that it is "the high-order 16 bits" that we
{
Elf_Internal_Rela *rel;
const Elf_Internal_Rela *relend;
- bfd_vma addend;
+ bfd_vma addend = 0;
boolean use_saved_addend_p = false;
struct elf_backend_data *bed;
{
flagword flags = elf_elfheader (abfd)->e_flags;
- switch (elf_elfheader (abfd)->e_flags & EF_SH_MACH_MASK)
+ switch (flags & EF_SH_MACH_MASK)
{
case EF_SH1:
bfd_default_set_arch_mach (abfd, bfd_arch_sh, bfd_mach_sh);
/* Return true iff this is a non-common definition of a symbol. */
static boolean
is_global_symbol_definition (abfd, sym)
- bfd * abfd;
+ bfd * abfd ATTRIBUTE_UNUSED;
Elf_Internal_Sym * sym;
{
/* Local symbols do not count, but target specific ones might. */
struct coff_link_hash_entry *, struct internal_syment *,
bfd_vma *));
-
+#if 0
static void mips_ecoff_swap_reloc_in PARAMS ((bfd *, PTR,
struct internal_reloc *));
static void mips_ecoff_swap_reloc_out PARAMS ((bfd *,
arelent *));
static void mips_adjust_reloc_out PARAMS ((bfd *, const arelent *,
struct internal_reloc *));
-
+#endif
#define COFF_DEFAULT_SECTION_ALIGNMENT_POWER (2)
/* The page size is a guess based on ELF. */
arelent *reloc_entry;
asymbol *symbol;
PTR data;
- asection *input_section;
+ asection *input_section ATTRIBUTE_UNUSED;
bfd *output_bfd;
- char **error_message;
+ char **error_message ATTRIBUTE_UNUSED;
{
symvalue diff;
appear in the output .reloc section. */
static boolean in_reloc_p(abfd, howto)
- bfd * abfd;
+ bfd * abfd ATTRIBUTE_UNUSED;
reloc_howto_type *howto;
{
return ! howto->pc_relative && howto->type != MIPS_R_RVA;
0xffff, /* dst_mask */
false), /* pcrel_offset */
- { 8 },
- { 9 },
- { 10 },
- { 11 },
- { 12 },
- { 13 },
- { 14 },
- { 15 },
- { 16 },
- { 17 },
- { 18 },
- { 19 },
- { 20 },
- { 21 },
- { 22 },
- { 23 },
- { 24 },
- { 25 },
- { 26 },
- { 27 },
- { 28 },
- { 29 },
- { 30 },
- { 31 },
- { 32 },
- { 33 },
+ EMPTY_HOWTO (8),
+ EMPTY_HOWTO (9),
+ EMPTY_HOWTO (10),
+ EMPTY_HOWTO (11),
+ EMPTY_HOWTO (12),
+ EMPTY_HOWTO (13),
+ EMPTY_HOWTO (14),
+ EMPTY_HOWTO (15),
+ EMPTY_HOWTO (16),
+ EMPTY_HOWTO (17),
+ EMPTY_HOWTO (18),
+ EMPTY_HOWTO (19),
+ EMPTY_HOWTO (20),
+ EMPTY_HOWTO (21),
+ EMPTY_HOWTO (22),
+ EMPTY_HOWTO (23),
+ EMPTY_HOWTO (24),
+ EMPTY_HOWTO (25),
+ EMPTY_HOWTO (26),
+ EMPTY_HOWTO (27),
+ EMPTY_HOWTO (28),
+ EMPTY_HOWTO (29),
+ EMPTY_HOWTO (30),
+ EMPTY_HOWTO (31),
+ EMPTY_HOWTO (32),
+ EMPTY_HOWTO (33),
HOWTO (MIPS_R_RVA, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
0xffffffff, /* src_mask */
0xffffffff, /* dst_mask */
false), /* pcrel_offset */
- { 35 },
- { 36 },
+ EMPTY_HOWTO (35),
+ EMPTY_HOWTO (36),
HOWTO (MIPS_R_PAIR, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
static reloc_howto_type *
coff_mips_rtype_to_howto (abfd, sec, rel, h, sym, addendp)
- bfd *abfd;
+ bfd *abfd ATTRIBUTE_UNUSED;
asection *sec;
struct internal_reloc *rel;
struct coff_link_hash_entry *h;
static reloc_howto_type *
coff_mips_reloc_type_lookup (abfd, code)
- bfd *abfd;
+ bfd *abfd ATTRIBUTE_UNUSED;
bfd_reloc_code_real_type code;
{
int mips_type;
struct internal_syment *syms;
asection **sections;
{
- asection **symndx_to_section;
- struct ecoff_link_hash_entry **sym_hashes;
- struct coff_link_hash_entry *h;
bfd_vma gp;
boolean gp_undefined;
size_t adjust;
- long *offsets;
struct internal_reloc *rel;
struct internal_reloc *rel_end;
unsigned int i;
boolean got_lo;
- struct internal_reloc lo_int_rel;
if (info->relocateable)
{
bfd_vma addend = 0;
bfd_vma val, tmp, targ, src, low;
reloc_howto_type *howto;
- bfd_reloc_status_type rstat;
unsigned char *mem = contents + rel->r_vaddr;
symndx = rel->r_symndx;
case MIPS_R_JMPADDR:
tmp = bfd_get_32(input_bfd, mem);
targ = val + (tmp&0x03ffffff)*4;
- if (src & 0xf0000000 != targ & 0xf0000000)
+ if ((src & 0xf0000000) != (targ & 0xf0000000))
{
(*_bfd_error_handler)(_("%s: jump too far away\n"),
bfd_get_filename (input_bfd));
tmp = bfd_get_32 (input_bfd, mem);
/* printf("rva: src=%08x targ=%08x+%08x\n", src, tmp, val); */
tmp += val
- - pe_data (input_section->output_section->owner)->pe_opthdr.ImageBase;
+ - pe_data (input_section->output_section->owner)->pe_opthdr.ImageBase;
bfd_put_32 (input_bfd, tmp, mem);
break;
/* Support for the generic parts of PE/PEI, for BFD.
- Copyright 1995, 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
+ Copyright 1995, 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
Written by Cygnus Solutions.
This file is part of BFD, the Binary File Descriptor library.
}
jump_table;
-jump_table jtab[] =
+static jump_table jtab[] =
{
#ifdef I386MAGIC
{ I386MAGIC,
struct internal_filehdr internal_f;
unsigned int import_type;
unsigned int import_name_type;
- asection_ptr id2, id4, id5, id6, id7, text;
+ asection_ptr id2, id4, id5, id6 = NULL, id7, text;
text = NULL;
source_dll = ptr + strlen (ptr) + 1;
/* Verify that the strings are null terminated. */
- if (ptr[size - 1] != 0 || ((source_dll - ptr) >= size))
+ if (ptr[size - 1] != 0 || ((unsigned long)(source_dll - ptr) >= size))
{
_bfd_error_handler
(_("%s: string not null terminated in ILF object file."),