aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorKazu Hirata <kazu@codesourcery.com>2000-11-29 04:56:32 +0000
committerKazu Hirata <kazu@codesourcery.com>2000-11-29 04:56:32 +0000
commitbe3ccd9c2b879034525ceceed75d60fb86648551 (patch)
treec1a49dfe1141efe6a979bfc8a3b6e4a1d4810ddd /bfd
parente46fee709911489697109fedd5c900ba677b8ab3 (diff)
downloadgdb-be3ccd9c2b879034525ceceed75d60fb86648551.zip
gdb-be3ccd9c2b879034525ceceed75d60fb86648551.tar.gz
gdb-be3ccd9c2b879034525ceceed75d60fb86648551.tar.bz2
2000-11-28 Kazu Hirata <kazu@hxi.com>
* elf32-mips.c: Fix formatting.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog1
-rw-r--r--bfd/elf32-mips.c848
2 files changed, 415 insertions, 434 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 6e6270b..b95b583 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -9,6 +9,7 @@
* coffcode.h: Likewise.
* coffswap.h: Likewise.
* corefile.c: Likewise.
+ * elf32-mips.c: Likewise.
2000-11-27 Kazu Hirata <kazu@hxi.com>
diff --git a/bfd/elf32-mips.c b/bfd/elf32-mips.c
index 3266678..b9b99c7 100644
--- a/bfd/elf32-mips.c
+++ b/bfd/elf32-mips.c
@@ -1,5 +1,6 @@
/* MIPS-specific support for 32-bit ELF
- Copyright 1993, 94, 95, 96, 97, 98, 1999 Free Software Foundation, Inc.
+ Copyright 1993, 94, 95, 96, 97, 98, 99, 2000
+ Free Software Foundation, Inc.
Most of the information added by Ian Lance Taylor, Cygnus Support,
<ian@cygnus.com>.
@@ -48,8 +49,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/* This structure is used to hold .got information when linking. It
is stored in the tdata field of the bfd_elf_section_data structure. */
-struct mips_got_info
-{
+struct mips_got_info {
/* The global symbol in the GOT with the lowest index in the dynamic
symbol table. */
struct elf_link_hash_entry *global_gotsym;
@@ -64,15 +64,14 @@ struct mips_got_info
/* The MIPS ELF linker needs additional information for each symbol in
the global hash table. */
-struct mips_elf_link_hash_entry
-{
+struct mips_elf_link_hash_entry {
struct elf_link_hash_entry root;
/* External symbol information. */
EXTR esym;
/* Number of R_MIPS_32, R_MIPS_REL32, or R_MIPS_64 relocs against
- this symbol. */
+ this symbol. */
unsigned int possibly_dynamic_relocs;
/* The index of the first dynamic relocation (in the .rel.dyn
@@ -111,7 +110,7 @@ static void bfd_mips_elf32_swap_gptab_in
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
+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
@@ -141,9 +140,9 @@ static bfd_reloc_status_type mips_elf_final_gp
static bfd_byte *elf32_mips_get_relocated_section_contents
PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_order *,
bfd_byte *, boolean, asymbol **));
-static asection *mips_elf_create_msym_section
+static asection *mips_elf_create_msym_section
PARAMS ((bfd *));
-static void mips_elf_irix6_finish_dynamic_symbol
+static void mips_elf_irix6_finish_dynamic_symbol
PARAMS ((bfd *, const char *, Elf_Internal_Sym *));
static bfd_vma mips_elf_sign_extend PARAMS ((bfd_vma, int));
static boolean mips_elf_overflow_p PARAMS ((bfd_vma, int));
@@ -156,13 +155,13 @@ static bfd_vma mips_elf_local_got_index
PARAMS ((bfd *, struct bfd_link_info *, bfd_vma));
static bfd_vma mips_elf_got_offset_from_index
PARAMS ((bfd *, bfd *, bfd_vma));
-static boolean mips_elf_record_global_got_symbol
+static boolean mips_elf_record_global_got_symbol
PARAMS ((struct elf_link_hash_entry *, struct bfd_link_info *,
struct mips_got_info *));
static bfd_vma mips_elf_got_page
PARAMS ((bfd *, struct bfd_link_info *, bfd_vma, bfd_vma *));
static const Elf_Internal_Rela *mips_elf_next_relocation
- PARAMS ((unsigned int, const Elf_Internal_Rela *,
+ PARAMS ((unsigned int, const Elf_Internal_Rela *,
const Elf_Internal_Rela *));
static bfd_reloc_status_type mips_elf_calculate_relocation
PARAMS ((bfd *, bfd *, asection *, struct bfd_link_info *,
@@ -172,30 +171,30 @@ static bfd_reloc_status_type mips_elf_calculate_relocation
static bfd_vma mips_elf_obtain_contents
PARAMS ((reloc_howto_type *, const Elf_Internal_Rela *, bfd *, bfd_byte *));
static boolean mips_elf_perform_relocation
- PARAMS ((struct bfd_link_info *, reloc_howto_type *,
+ PARAMS ((struct bfd_link_info *, reloc_howto_type *,
const Elf_Internal_Rela *, bfd_vma,
bfd *, asection *, bfd_byte *, boolean));
static boolean mips_elf_assign_gp PARAMS ((bfd *, bfd_vma *));
-static boolean mips_elf_sort_hash_table_f
+static boolean mips_elf_sort_hash_table_f
PARAMS ((struct mips_elf_link_hash_entry *, PTR));
-static boolean mips_elf_sort_hash_table
+static boolean mips_elf_sort_hash_table
PARAMS ((struct bfd_link_info *, unsigned long));
static asection * mips_elf_got_section PARAMS ((bfd *));
-static struct mips_got_info *mips_elf_got_info
+static struct mips_got_info *mips_elf_got_info
PARAMS ((bfd *, asection **));
static boolean mips_elf_local_relocation_p
PARAMS ((bfd *, const Elf_Internal_Rela *, asection **, boolean));
-static bfd_vma mips_elf_create_local_got_entry
+static bfd_vma mips_elf_create_local_got_entry
PARAMS ((bfd *, struct mips_got_info *, asection *, bfd_vma));
-static bfd_vma mips_elf_got16_entry
+static bfd_vma mips_elf_got16_entry
PARAMS ((bfd *, struct bfd_link_info *, bfd_vma, boolean));
-static boolean mips_elf_create_dynamic_relocation
+static boolean mips_elf_create_dynamic_relocation
PARAMS ((bfd *, struct bfd_link_info *, const Elf_Internal_Rela *,
struct mips_elf_link_hash_entry *, asection *,
bfd_vma, bfd_vma *, asection *, boolean local_p));
-static void mips_elf_allocate_dynamic_relocations
+static void mips_elf_allocate_dynamic_relocations
PARAMS ((bfd *, unsigned int));
-static boolean mips_elf_stub_section_p
+static boolean mips_elf_stub_section_p
PARAMS ((bfd *, asection *));
static int sort_dynamic_relocs
PARAMS ((const void *, const void *));
@@ -224,7 +223,7 @@ static bfd *reldyn_sorting_bfd;
((elf_elfheader (abfd)->e_ident[EI_CLASS] == ELFCLASS64) != 0)
/* Depending on the target vector we generate some version of Irix
- executables or "normal" MIPS ELF ABI executables. */
+ executables or "normal" MIPS ELF ABI executables. */
#define IRIX_COMPAT(abfd) \
(abfd->xvec == &bfd_elf32_tradbigmips_vec ? ict_none : \
@@ -322,8 +321,7 @@ static bfd *reldyn_sorting_bfd;
/* Names of sections which appear in the .dynsym section in an Irix 5
executable. */
-static const char * const mips_elf_dynsym_sec_names[] =
-{
+static const char * const mips_elf_dynsym_sec_names[] = {
".text",
".init",
".fini",
@@ -347,8 +345,7 @@ static const char * const mips_elf_dynsym_sec_names[] =
/* The names of the runtime procedure table symbols used on Irix 5. */
-static const char * const mips_elf_dynsym_rtproc_names[] =
-{
+static const char * const mips_elf_dynsym_rtproc_names[] = {
"_procedure_table",
"_procedure_string_table",
"_procedure_table_size",
@@ -358,8 +355,7 @@ static const char * const mips_elf_dynsym_rtproc_names[] =
/* These structures are used to generate the .compact_rel section on
Irix 5. */
-typedef struct
-{
+typedef struct {
unsigned long id1; /* Always one? */
unsigned long num; /* Number of compact relocation entries. */
unsigned long id2; /* Always two? */
@@ -368,8 +364,7 @@ typedef struct
unsigned long reserved1; /* Zero? */
} Elf32_compact_rel;
-typedef struct
-{
+typedef struct {
bfd_byte id1[4];
bfd_byte num[4];
bfd_byte id2[4];
@@ -378,34 +373,30 @@ typedef struct
bfd_byte reserved1[4];
} Elf32_External_compact_rel;
-typedef struct
-{
+typedef struct {
unsigned int ctype : 1; /* 1: long 0: short format. See below. */
- unsigned int rtype : 4; /* Relocation types. See below. */
+ unsigned int rtype : 4; /* Relocation types. See below. */
unsigned int dist2to : 8;
unsigned int relvaddr : 19; /* (VADDR - vaddr of the previous entry)/ 4 */
unsigned long konst; /* KONST field. See below. */
unsigned long vaddr; /* VADDR to be relocated. */
} Elf32_crinfo;
-typedef struct
-{
+typedef struct {
unsigned int ctype : 1; /* 1: long 0: short format. See below. */
- unsigned int rtype : 4; /* Relocation types. See below. */
+ unsigned int rtype : 4; /* Relocation types. See below. */
unsigned int dist2to : 8;
unsigned int relvaddr : 19; /* (VADDR - vaddr of the previous entry)/ 4 */
unsigned long konst; /* KONST field. See below. */
} Elf32_crinfo2;
-typedef struct
-{
+typedef struct {
bfd_byte info[4];
bfd_byte konst[4];
bfd_byte vaddr[4];
} Elf32_External_crinfo;
-typedef struct
-{
+typedef struct {
bfd_byte info[4];
bfd_byte konst[4];
} Elf32_External_crinfo2;
@@ -458,8 +449,7 @@ static void bfd_elf32_swap_crinfo_out
from smaller values. Start with zero, widen, *then* decrement. */
#define MINUS_ONE (((bfd_vma)0) - 1)
-static reloc_howto_type elf_mips_howto_table[] =
-{
+static reloc_howto_type elf_mips_howto_table[] = {
/* No relocation. */
HOWTO (R_MIPS_NONE, /* type */
0, /* rightshift */
@@ -886,7 +876,7 @@ static reloc_howto_type elf_mips_howto_table[] =
EMPTY_HOWTO (R_MIPS_PJUMP),
EMPTY_HOWTO (R_MIPS_RELGOT),
- /* Protected jump conversion. This is an optimization hint. No
+ /* Protected jump conversion. This is an optimization hint. No
relocation is required for correctness. */
HOWTO (R_MIPS_JALR, /* type */
0, /* rightshift */
@@ -1077,8 +1067,7 @@ static reloc_howto_type elf_mips_gnu_vtentry_howto =
reloc. This extension permits gcc to output the HI and LO relocs
itself. */
-struct mips_hi16
-{
+struct mips_hi16 {
struct mips_hi16 *next;
bfd_byte *addr;
bfd_vma addend;
@@ -1231,7 +1220,7 @@ _bfd_mips_elf_lo16_reloc (abfd,
if ((val & 0x8000) != 0)
val += 0x10000;
- insn = (insn &~ 0xffff) | ((val >> 16) & 0xffff);
+ insn = (insn & ~0xffff) | ((val >> 16) & 0xffff);
bfd_put_32 (abfd, insn, l->addr);
if (strcmp (bfd_asymbol_name (symbol), "_gp_disp") == 0)
@@ -1523,7 +1512,7 @@ gprel16_with_gp (abfd, symbol, reloc_entry, input_section, relocateable, data,
|| (symbol->flags & BSF_SECTION_SYM) != 0)
val += relocation - gp;
- insn = (insn &~ 0xffff) | (val & 0xffff);
+ insn = (insn & ~0xffff) | (val & 0xffff);
bfd_put_32 (abfd, insn, (bfd_byte *) data + reloc_entry->address);
if (relocateable)
@@ -1876,9 +1865,9 @@ elf_mips_mach (flags)
return 0;
}
-/* Return printable name for ABI. */
+/* Return printable name for ABI. */
-static INLINE char*
+static INLINE char *
elf_mips_abi_name (abfd)
bfd *abfd;
{
@@ -1888,7 +1877,7 @@ elf_mips_abi_name (abfd)
return "N32";
else if (ABI_64_P (abfd))
return "64";
-
+
flags = elf_elfheader (abfd)->e_flags;
switch (flags & EF_MIPS_ABI)
{
@@ -1914,8 +1903,7 @@ struct elf_reloc_map {
enum elf_mips_reloc_type elf_reloc_val;
};
-static CONST struct elf_reloc_map mips_reloc_map[] =
-{
+static CONST struct elf_reloc_map mips_reloc_map[] = {
{ BFD_RELOC_NONE, R_MIPS_NONE, },
{ BFD_RELOC_16, R_MIPS_16 },
{ BFD_RELOC_32, R_MIPS_32 },
@@ -2261,7 +2249,6 @@ bfd_mips_elf_swap_msym_out (abfd, in, ex)
bfd_h_put_32 (abfd, in->ms_hash_value, ex->ms_hash_value);
bfd_h_put_32 (abfd, in->ms_info, ex->ms_info);
}
-
/* Determine whether a symbol is global for the purposes of splitting
the symbol table into global symbols and local symbols. At least
@@ -2269,7 +2256,6 @@ bfd_mips_elf_swap_msym_out (abfd, in, ex)
symbols. On most ELF targets the split is between static symbols
and externally visible symbols. */
-/*ARGSUSED*/
static boolean
mips_elf_sym_is_global (abfd, sym)
bfd *abfd ATTRIBUTE_UNUSED;
@@ -2299,7 +2285,6 @@ _bfd_mips_elf_object_p (abfd)
file. This gets the MIPS architecture right based on the machine
number. This is used by both the 32-bit and the 64-bit ABI. */
-/*ARGSUSED*/
void
_bfd_mips_elf_final_write_processing (abfd, linker)
bfd *abfd;
@@ -2356,7 +2341,7 @@ _bfd_mips_elf_final_write_processing (abfd, linker)
break;
}
- elf_elfheader (abfd)->e_flags &= ~ (EF_MIPS_ARCH | EF_MIPS_MACH);
+ elf_elfheader (abfd)->e_flags &= ~(EF_MIPS_ARCH | EF_MIPS_MACH);
elf_elfheader (abfd)->e_flags |= val;
/* Set the sh_info field for .gptab sections and other appropriate
@@ -2428,7 +2413,7 @@ _bfd_mips_elf_final_write_processing (abfd, linker)
}
}
-/* Function to keep MIPS specific file flags like as EF_MIPS_PIC. */
+/* Function to keep MIPS specific file flags like as EF_MIPS_PIC. */
boolean
_bfd_mips_elf_set_private_flags (abfd, flags)
@@ -2492,7 +2477,7 @@ _bfd_mips_elf_merge_private_bfd_data (ibfd, obfd)
{
elf_flags_init (obfd) = true;
elf_elfheader (obfd)->e_flags = new_flags;
- elf_elfheader (obfd)->e_ident[EI_CLASS]
+ elf_elfheader (obfd)->e_ident[EI_CLASS]
= elf_elfheader (ibfd)->e_ident[EI_CLASS];
if (bfd_get_arch (obfd) == bfd_get_arch (ibfd)
@@ -2536,7 +2521,7 @@ _bfd_mips_elf_merge_private_bfd_data (ibfd, obfd)
ok = false;
}
- /* Compare the ISA's. */
+ /* Compare the ISA's. */
if ((new_flags & (EF_MIPS_ARCH | EF_MIPS_MACH))
!= (old_flags & (EF_MIPS_ARCH | EF_MIPS_MACH)))
{
@@ -2546,8 +2531,8 @@ _bfd_mips_elf_merge_private_bfd_data (ibfd, obfd)
int old_isa = elf_mips_isa (old_flags);
/* If either has no machine specified, just compare the general isa's.
- Some combinations of machines are ok, if the isa's match. */
- if (! new_mach
+ Some combinations of machines are ok, if the isa's match. */
+ if (! new_mach
|| ! old_mach
|| new_mach == old_mach
)
@@ -2577,19 +2562,19 @@ _bfd_mips_elf_merge_private_bfd_data (ibfd, obfd)
ok = false;
}
- new_flags &= ~ (EF_MIPS_ARCH | EF_MIPS_MACH);
- old_flags &= ~ (EF_MIPS_ARCH | EF_MIPS_MACH);
+ new_flags &= ~(EF_MIPS_ARCH | EF_MIPS_MACH);
+ old_flags &= ~(EF_MIPS_ARCH | EF_MIPS_MACH);
}
/* Compare ABI's. The 64-bit ABI does not use EF_MIPS_ABI. But, it
does set EI_CLASS differently from any 32-bit ABI. */
if ((new_flags & EF_MIPS_ABI) != (old_flags & EF_MIPS_ABI)
- || (elf_elfheader (ibfd)->e_ident[EI_CLASS]
+ || (elf_elfheader (ibfd)->e_ident[EI_CLASS]
!= elf_elfheader (obfd)->e_ident[EI_CLASS]))
{
- /* Only error if both are set (to different values). */
+ /* Only error if both are set (to different values). */
if (((new_flags & EF_MIPS_ABI) && (old_flags & EF_MIPS_ABI))
- || (elf_elfheader (ibfd)->e_ident[EI_CLASS]
+ || (elf_elfheader (ibfd)->e_ident[EI_CLASS]
!= elf_elfheader (obfd)->e_ident[EI_CLASS]))
{
(*_bfd_error_handler)
@@ -2635,40 +2620,40 @@ _bfd_mips_elf_print_private_bfd_data (abfd, ptr)
_bfd_elf_print_private_bfd_data (abfd, ptr);
/* xgettext:c-format */
- fprintf (file, _ ("private flags = %lx:"), elf_elfheader (abfd)->e_flags);
+ fprintf (file, _("private flags = %lx:"), elf_elfheader (abfd)->e_flags);
if ((elf_elfheader (abfd)->e_flags & EF_MIPS_ABI) == E_MIPS_ABI_O32)
- fprintf (file, _ (" [abi=O32]"));
+ fprintf (file, _(" [abi=O32]"));
else if ((elf_elfheader (abfd)->e_flags & EF_MIPS_ABI) == E_MIPS_ABI_O64)
- fprintf (file, _ (" [abi=O64]"));
+ fprintf (file, _(" [abi=O64]"));
else if ((elf_elfheader (abfd)->e_flags & EF_MIPS_ABI) == E_MIPS_ABI_EABI32)
- fprintf (file, _ (" [abi=EABI32]"));
+ fprintf (file, _(" [abi=EABI32]"));
else if ((elf_elfheader (abfd)->e_flags & EF_MIPS_ABI) == E_MIPS_ABI_EABI64)
- fprintf (file, _ (" [abi=EABI64]"));
+ fprintf (file, _(" [abi=EABI64]"));
else if ((elf_elfheader (abfd)->e_flags & EF_MIPS_ABI))
- fprintf (file, _ (" [abi unknown]"));
+ fprintf (file, _(" [abi unknown]"));
else if (ABI_N32_P (abfd))
- fprintf (file, _ (" [abi=N32]"));
+ fprintf (file, _(" [abi=N32]"));
else if (ABI_64_P (abfd))
- fprintf (file, _ (" [abi=64]"));
+ fprintf (file, _(" [abi=64]"));
else
- fprintf (file, _ (" [no abi set]"));
+ fprintf (file, _(" [no abi set]"));
if ((elf_elfheader (abfd)->e_flags & EF_MIPS_ARCH) == E_MIPS_ARCH_1)
- fprintf (file, _ (" [mips1]"));
+ fprintf (file, _(" [mips1]"));
else if ((elf_elfheader (abfd)->e_flags & EF_MIPS_ARCH) == E_MIPS_ARCH_2)
- fprintf (file, _ (" [mips2]"));
+ fprintf (file, _(" [mips2]"));
else if ((elf_elfheader (abfd)->e_flags & EF_MIPS_ARCH) == E_MIPS_ARCH_3)
- fprintf (file, _ (" [mips3]"));
+ fprintf (file, _(" [mips3]"));
else if ((elf_elfheader (abfd)->e_flags & EF_MIPS_ARCH) == E_MIPS_ARCH_4)
- fprintf (file, _ (" [mips4]"));
+ fprintf (file, _(" [mips4]"));
else
- fprintf (file, _ (" [unknown ISA]"));
+ fprintf (file, _(" [unknown ISA]"));
if (elf_elfheader (abfd)->e_flags & EF_MIPS_32BITMODE)
- fprintf (file, _ (" [32bitmode]"));
+ fprintf (file, _(" [32bitmode]"));
else
- fprintf (file, _ (" [not 32bitmode]"));
+ fprintf (file, _(" [not 32bitmode]"));
fputc ('\n', file);
@@ -2889,22 +2874,22 @@ _bfd_mips_elf_fake_sections (abfd, hdr, sec)
/* In a shared object on Irix 5.3, the .reginfo section has an
entsize of 0x18. FIXME: Does this matter? */
if (SGI_COMPAT (abfd))
- {
- if ((abfd->flags & DYNAMIC) != 0)
- hdr->sh_entsize = sizeof (Elf32_External_RegInfo);
- else
- hdr->sh_entsize = 1;
- }
+ {
+ if ((abfd->flags & DYNAMIC) != 0)
+ hdr->sh_entsize = sizeof (Elf32_External_RegInfo);
+ else
+ hdr->sh_entsize = 1;
+ }
else
- hdr->sh_entsize = sizeof (Elf32_External_RegInfo);
+ hdr->sh_entsize = sizeof (Elf32_External_RegInfo);
}
else if (SGI_COMPAT (abfd)
&& (strcmp (name, ".hash") == 0
|| strcmp (name, ".dynamic") == 0
|| strcmp (name, ".dynstr") == 0))
{
- if ( SGI_COMPAT(abfd))
- hdr->sh_entsize = 0;
+ if (SGI_COMPAT (abfd))
+ hdr->sh_entsize = 0;
#if 0
/* This isn't how the Irix 6 linker behaves. */
hdr->sh_info = SIZEOF_MIPS_DYNSYM_SECNAMES;
@@ -2966,7 +2951,7 @@ _bfd_mips_elf_fake_sections (abfd, hdr, sec)
esd = elf_section_data (sec);
BFD_ASSERT (esd->rel_hdr2 == NULL);
- esd->rel_hdr2
+ esd->rel_hdr2
= (Elf_Internal_Shdr *) bfd_zalloc (abfd, sizeof (Elf_Internal_Shdr));
if (!esd->rel_hdr2)
return false;
@@ -3122,7 +3107,7 @@ _bfd_mips_elf_section_processing (abfd, hdr)
+ (l - contents)
+ sizeof (Elf_External_Options)
+ (sizeof (Elf32_External_RegInfo) - 4)),
- SEEK_SET) == -1)
+ SEEK_SET) == -1)
return false;
bfd_h_put_32 (abfd, elf_gp (abfd), buf);
if (bfd_write (buf, 1, 4, abfd) != 4)
@@ -3173,7 +3158,6 @@ _bfd_mips_elf_section_processing (abfd, hdr)
return true;
}
-
/* MIPS ELF uses two common sections. One is the usual one, and the
other is for small objects. All the small objects are kept
@@ -3284,7 +3268,7 @@ _bfd_mips_elf_additional_program_headers (abfd)
/* See if we need a PT_MIPS_OPTIONS segment. */
if (IRIX_COMPAT (abfd) == ict_irix6
- && bfd_get_section_by_name (abfd,
+ && bfd_get_section_by_name (abfd,
MIPS_ELF_OPTIONS_SECTION_NAME (abfd)))
++ret;
@@ -3356,13 +3340,13 @@ _bfd_mips_elf_modify_segment_map (abfd)
there's not (like when running the `ld' testsuite). So,
if there's no program header table, we just put the
options segement at the end. */
- for (pm = &elf_tdata (abfd)->segment_map;
+ for (pm = &elf_tdata (abfd)->segment_map;
*pm != NULL;
pm = &(*pm)->next)
if ((*pm)->p_type == PT_PHDR)
break;
- options_segment = bfd_zalloc (abfd,
+ options_segment = bfd_zalloc (abfd,
sizeof (struct elf_segment_map));
options_segment->next = *pm;
options_segment->p_type = PT_MIPS_OPTIONS;
@@ -3432,7 +3416,7 @@ _bfd_mips_elf_modify_segment_map (abfd)
/* For a normal mips executable the permissions for the PT_DYNAMIC
segment are read, write and execute. We do that here since
the code in elf.c sets only the read permission. This matters
- sometimes for the dynamic linker. */
+ sometimes for the dynamic linker. */
if (bfd_get_section_by_name (abfd, ".dynamic") != NULL)
{
m->p_flags = PF_R | PF_W | PF_X;
@@ -3442,8 +3426,9 @@ _bfd_mips_elf_modify_segment_map (abfd)
if (m != NULL
&& m->count == 1 && strcmp (m->sections[0]->name, ".dynamic") == 0)
{
- static const char *sec_names[] =
- { ".dynamic", ".dynstr", ".dynsym", ".hash" };
+ static const char *sec_names[] = {
+ ".dynamic", ".dynstr", ".dynsym", ".hash"
+ };
bfd_vma low, high;
unsigned int i, c;
struct elf_segment_map *n;
@@ -3520,7 +3505,7 @@ typedef struct runtime_pdr {
long reserved;
struct exception_info *exception_info;/* pointer to exception array */
} RPDR, *pRPDR;
-#define cbRPDR sizeof(RPDR)
+#define cbRPDR sizeof (RPDR)
#define rpdNil ((pRPDR) 0)
/* Swap RPDR (runtime procedure table entry) for output. */
@@ -3565,7 +3550,7 @@ _bfd_mips_elf_read_ecoff_info (abfd, section, debug)
char *ext_hdr = NULL;
swap = get_elf_backend_data (abfd)->elf_backend_ecoff_debug_swap;
- memset (debug, 0, sizeof(*debug));
+ memset (debug, 0, sizeof (*debug));
ext_hdr = (char *) bfd_malloc ((size_t) swap->external_hdr_size);
if (ext_hdr == NULL && swap->external_hdr_size != 0)
@@ -3644,7 +3629,6 @@ _bfd_mips_elf_read_ecoff_info (abfd, section, debug)
/* MIPS ELF local labels start with '$', not 'L'. */
-/*ARGSUSED*/
static boolean
mips_elf_is_local_label_name (abfd, name)
bfd *abfd;
@@ -3661,8 +3645,7 @@ mips_elf_is_local_label_name (abfd, name)
/* MIPS ELF uses a special find_nearest_line routine in order the
handle the ECOFF debugging information. */
-struct mips_elf_find_line
-{
+struct mips_elf_find_line {
struct ecoff_debug_info d;
struct ecoff_find_line i;
};
@@ -3687,7 +3670,7 @@ _bfd_mips_elf_find_nearest_line (abfd, section, symbols, offset, filename_ptr,
if (_bfd_dwarf2_find_nearest_line (abfd, section, symbols, offset,
filename_ptr, functionname_ptr,
- line_ptr,
+ line_ptr,
ABI_64_P (abfd) ? 8 : 0))
return true;
@@ -3814,8 +3797,7 @@ _bfd_mips_elf_find_nearest_line (abfd, section, symbols, offset, filename_ptr,
/* MIPS ELF linker hash table. */
-struct mips_elf_link_hash_table
-{
+struct mips_elf_link_hash_table {
struct elf_link_hash_table root;
#if 0
/* We no longer use this. */
@@ -3827,11 +3809,11 @@ struct mips_elf_link_hash_table
/* The size of the .compact_rel section (if SGI_COMPAT). */
bfd_size_type compact_rel_size;
/* This flag indicates that the value of DT_MIPS_RLD_MAP dynamic
- entry is set to the address of __rld_obj_head as in Irix 5. */
+ entry is set to the address of __rld_obj_head as in Irix 5. */
boolean use_rld_obj_head;
/* This is the value of the __rld_map or __rld_obj_head symbol. */
bfd_vma rld_value;
- /* This is set if we see any mips16 stub sections. */
+ /* This is set if we see any mips16 stub sections. */
boolean mips16_stubs_seen;
};
@@ -3901,7 +3883,7 @@ mips_elf_link_hash_newfunc (entry, table, string)
}
void
-_bfd_mips_elf_hide_symbol(info, h)
+_bfd_mips_elf_hide_symbol (info, h)
struct bfd_link_info *info;
struct mips_elf_link_hash_entry *h;
{
@@ -3958,7 +3940,6 @@ _bfd_mips_elf_link_hash_table_create (abfd)
/* Hook called by the linker routine which adds symbols from an object
file. We must handle the special MIPS section numbers here. */
-/*ARGSUSED*/
boolean
_bfd_mips_elf_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp)
bfd *abfd;
@@ -4089,7 +4070,7 @@ _bfd_mips_elf_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp)
get_elf_backend_data (abfd)->collect,
(struct bfd_link_hash_entry **) &h)))
return false;
- h->elf_link_hash_flags &=~ ELF_LINK_NON_ELF;
+ h->elf_link_hash_flags &= ~ELF_LINK_NON_ELF;
h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR;
h->type = STT_OBJECT;
@@ -4110,8 +4091,7 @@ _bfd_mips_elf_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp)
/* Structure used to pass information to mips_elf_output_extsym. */
-struct extsym_info
-{
+struct extsym_info {
bfd *abfd;
struct bfd_link_info *info;
struct ecoff_debug_info *debug;
@@ -4172,7 +4152,7 @@ mips_elf_output_extsym (h, data)
h->esym.asym.st = stGlobal;
if (h->root.root.type == bfd_link_hash_undefined
- || h->root.root.type == bfd_link_hash_undefweak)
+ || h->root.root.type == bfd_link_hash_undefweak)
{
const char *name;
@@ -4486,11 +4466,14 @@ _bfd_mips_elf_final_link (abfd, info)
EXTR esym;
bfd_vma last;
unsigned int i;
- static const char * const name[] =
- { ".text", ".init", ".fini", ".data",
- ".rodata", ".sdata", ".sbss", ".bss" };
- static const int sc[] = { scText, scInit, scFini, scData,
- scRData, scSData, scSBss, scBss };
+ static const char * const name[] = {
+ ".text", ".init", ".fini", ".data",
+ ".rodata", ".sdata", ".sbss", ".bss"
+ };
+ static const int sc[] = {
+ scText, scInit, scFini, scData,
+ scRData, scSData, scSBss, scBss
+ };
/* If all the things we linked together were PIC, but we're
producing an executable (rather than a shared object), then the
@@ -4519,10 +4502,10 @@ _bfd_mips_elf_final_link (abfd, info)
adds these symbols when building a shared object. Note that
we count the sections after (possibly) removing the .options
section above. */
- if (!mips_elf_sort_hash_table (info, (info->shared
+ if (!mips_elf_sort_hash_table (info, (info->shared
? bfd_count_sections (abfd) + 1
: 1)))
- return false;
+ return false;
/* Make sure we didn't grow the global .got region. */
dynobj = elf_hash_table (info)->dynobj;
@@ -4546,11 +4529,11 @@ _bfd_mips_elf_final_link (abfd, info)
{
for (p = (*secpp)->link_order_head; p != NULL; p = p->next)
if (p->type == bfd_indirect_link_order)
- p->u.indirect.section->flags &=~ SEC_HAS_CONTENTS;
+ p->u.indirect.section->flags &= ~SEC_HAS_CONTENTS;
(*secpp)->link_order_head = NULL;
*secpp = (*secpp)->next;
--abfd->section_count;
-
+
break;
}
}
@@ -4573,7 +4556,7 @@ _bfd_mips_elf_final_link (abfd, info)
/* Find the GP-relative section with the lowest offset. */
lo = (bfd_vma) -1;
for (o = abfd->sections; o != (asection *) NULL; o = o->next)
- if (o->vma < lo
+ if (o->vma < lo
&& (elf_section_data (o)->this_hdr.sh_flags & SHF_MIPS_GPREL))
lo = o->vma;
@@ -4647,7 +4630,7 @@ _bfd_mips_elf_final_link (abfd, info)
/* Hack: reset the SEC_HAS_CONTENTS flag so that
elf_link_input_bfd ignores this section. */
- input_section->flags &=~ SEC_HAS_CONTENTS;
+ input_section->flags &= ~SEC_HAS_CONTENTS;
}
/* Size has been set in mips_elf_always_size_sections */
@@ -4701,31 +4684,31 @@ _bfd_mips_elf_final_link (abfd, info)
if (mdebug_handle == (PTR) NULL)
return false;
- esym.jmptbl = 0;
- esym.cobol_main = 0;
- esym.weakext = 0;
- esym.reserved = 0;
- esym.ifd = ifdNil;
- esym.asym.iss = issNil;
- esym.asym.st = stLocal;
- esym.asym.reserved = 0;
- esym.asym.index = indexNil;
- last = 0;
- for (i = 0; i < 8; i++)
- {
- esym.asym.sc = sc[i];
- s = bfd_get_section_by_name (abfd, name[i]);
- if (s != NULL)
- {
- esym.asym.value = s->vma;
- last = s->vma + s->_raw_size;
- }
- else
- esym.asym.value = last;
- if (!bfd_ecoff_debug_one_external (abfd, &debug, swap,
- name[i], &esym))
- return false;
- }
+ esym.jmptbl = 0;
+ esym.cobol_main = 0;
+ esym.weakext = 0;
+ esym.reserved = 0;
+ esym.ifd = ifdNil;
+ esym.asym.iss = issNil;
+ esym.asym.st = stLocal;
+ esym.asym.reserved = 0;
+ esym.asym.index = indexNil;
+ last = 0;
+ for (i = 0; i < 8; i++)
+ {
+ esym.asym.sc = sc[i];
+ s = bfd_get_section_by_name (abfd, name[i]);
+ if (s != NULL)
+ {
+ esym.asym.value = s->vma;
+ last = s->vma + s->_raw_size;
+ }
+ else
+ esym.asym.value = last;
+ if (!bfd_ecoff_debug_one_external (abfd, &debug, swap,
+ name[i], &esym))
+ return false;
+ }
for (p = o->link_order_head;
p != (struct bfd_link_order *) NULL;
@@ -4828,7 +4811,7 @@ _bfd_mips_elf_final_link (abfd, info)
/* Hack: reset the SEC_HAS_CONTENTS flag so that
elf_link_input_bfd ignores this section. */
- input_section->flags &=~ SEC_HAS_CONTENTS;
+ input_section->flags &= ~SEC_HAS_CONTENTS;
}
if (SGI_COMPAT (abfd) && info->shared)
@@ -4907,7 +4890,7 @@ _bfd_mips_elf_final_link (abfd, info)
/* Hack: reset the SEC_HAS_CONTENTS flag so that
elf_link_input_bfd ignores this section. */
- input_section->flags &=~ SEC_HAS_CONTENTS;
+ input_section->flags &= ~SEC_HAS_CONTENTS;
}
/* Skip this section later on (I don't think this
@@ -5066,7 +5049,7 @@ _bfd_mips_elf_final_link (abfd, info)
/* Hack: reset the SEC_HAS_CONTENTS flag so that
elf_link_input_bfd ignores this section. */
- input_section->flags &=~ SEC_HAS_CONTENTS;
+ input_section->flags &= ~SEC_HAS_CONTENTS;
}
/* The table must be sorted by -G value. */
@@ -5170,9 +5153,9 @@ _bfd_mips_elf_final_link (abfd, info)
entries by increasing r_symndx value. */
static int
-sort_dynamic_relocs (arg1,arg2)
- const PTR arg1;
- const PTR arg2;
+sort_dynamic_relocs (arg1, arg2)
+ const PTR arg1;
+ const PTR arg2;
{
const Elf32_External_Rel *ext_reloc1 = (const Elf32_External_Rel *) arg1;
const Elf32_External_Rel *ext_reloc2 = (const Elf32_External_Rel *) arg2;
@@ -5180,10 +5163,10 @@ sort_dynamic_relocs (arg1,arg2)
Elf_Internal_Rel int_reloc1;
Elf_Internal_Rel int_reloc2;
- bfd_elf32_swap_reloc_in(reldyn_sorting_bfd, ext_reloc1, &int_reloc1);
- bfd_elf32_swap_reloc_in(reldyn_sorting_bfd, ext_reloc2, &int_reloc2);
+ bfd_elf32_swap_reloc_in (reldyn_sorting_bfd, ext_reloc1, &int_reloc1);
+ bfd_elf32_swap_reloc_in (reldyn_sorting_bfd, ext_reloc2, &int_reloc2);
- return (ELF32_R_SYM(int_reloc1.r_info) - ELF32_R_SYM(int_reloc2.r_info));
+ return (ELF32_R_SYM (int_reloc1.r_info) - ELF32_R_SYM (int_reloc2.r_info));
}
/* Returns the GOT section for ABFD. */
@@ -5196,7 +5179,7 @@ mips_elf_got_section (abfd)
}
/* Returns the GOT information associated with the link indicated by
- INFO. If SGOTP is non-NULL, it is filled in with the GOT
+ INFO. If SGOTP is non-NULL, it is filled in with the GOT
section. */
static struct mips_got_info *
@@ -5230,7 +5213,7 @@ mips_elf_local_relocation_p (input_bfd, relocation, local_sections,
{
unsigned long r_symndx;
Elf_Internal_Shdr *symtab_hdr;
- struct mips_elf_link_hash_entry* h;
+ struct mips_elf_link_hash_entry *h;
size_t extsymoff;
r_symndx = ELF32_R_SYM (relocation->r_info);
@@ -5244,16 +5227,16 @@ mips_elf_local_relocation_p (input_bfd, relocation, local_sections,
if (check_forced)
{
- /* Look up the hash table to check whether the symbol
+ /* Look up the hash table to check whether the symbol
was forced local. */
- h = (struct mips_elf_link_hash_entry *)
- elf_sym_hashes (input_bfd) [r_symndx - extsymoff];
- /* Find the real hash-table entry for this symbol. */
- while (h->root.root.type == bfd_link_hash_indirect
+ h = (struct mips_elf_link_hash_entry *)
+ elf_sym_hashes (input_bfd) [r_symndx - extsymoff];
+ /* Find the real hash-table entry for this symbol. */
+ while (h->root.root.type == bfd_link_hash_indirect
|| h->root.root.type == bfd_link_hash_warning)
- h = (struct mips_elf_link_hash_entry *) h->root.root.u.i.link;
- if ((h->root.elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0)
- return true;
+ h = (struct mips_elf_link_hash_entry *) h->root.root.u.i.link;
+ if ((h->root.elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0)
+ return true;
}
return false;
@@ -5266,10 +5249,10 @@ mips_elf_sign_extend (value, bits)
bfd_vma value;
int bits;
{
- if (value & ((bfd_vma)1 << (bits - 1)))
+ if (value & ((bfd_vma) 1 << (bits - 1)))
/* VALUE is negative. */
- value |= ((bfd_vma) - 1) << bits;
-
+ value |= ((bfd_vma) - 1) << bits;
+
return value;
}
@@ -5290,7 +5273,7 @@ mips_elf_overflow_p (value, bits)
else if (svalue < -(1 << (bits - 1)))
/* The value is too small. */
return true;
-
+
/* All is well. */
return false;
}
@@ -5320,7 +5303,7 @@ mips_elf_higher (value)
/* Calculate the %highest function. */
-static bfd_vma
+static bfd_vma
mips_elf_highest (value)
bfd_vma value ATTRIBUTE_UNUSED;
{
@@ -5334,7 +5317,7 @@ mips_elf_highest (value)
/* Returns the GOT index for the global symbol indicated by H. */
-static bfd_vma
+static bfd_vma
mips_elf_global_got_index (abfd, h)
bfd *abfd;
struct elf_link_hash_entry *h;
@@ -5350,7 +5333,7 @@ mips_elf_global_got_index (abfd, h)
indices into the GOT. That makes it easy to calculate the GOT
offset. */
BFD_ASSERT (h->dynindx >= g->global_gotsym->dynindx);
- index = ((h->dynindx - g->global_gotsym->dynindx + g->local_gotno)
+ index = ((h->dynindx - g->global_gotsym->dynindx + g->local_gotno)
* MIPS_ELF_GOT_SIZE (abfd));
BFD_ASSERT (index < sgot->_raw_size);
@@ -5371,7 +5354,7 @@ mips_elf_got_offset_from_index (dynobj, output_bfd, index)
sgot = mips_elf_got_section (dynobj);
gp = _bfd_get_gp_value (output_bfd);
- return (sgot->output_section->vma + sgot->output_offset + index -
+ return (sgot->output_section->vma + sgot->output_offset + index -
gp);
}
@@ -5390,7 +5373,7 @@ mips_elf_record_global_got_symbol (h, info, g)
if (h->dynindx == -1
&& !bfd_elf32_link_record_dynamic_symbol (info, h))
return false;
-
+
/* If we've already marked this entry as need GOT space, we don't
need to do it again. */
if (h->got.offset != (bfd_vma) - 1)
@@ -5405,9 +5388,8 @@ mips_elf_record_global_got_symbol (h, info, g)
/* This structure is passed to mips_elf_sort_hash_table_f when sorting
the dynamic symbols. */
-
-struct mips_elf_hash_sort_data
-{
+
+struct mips_elf_hash_sort_data {
/* The symbol in the global GOT with the lowest dynamic symbol table
index. */
struct elf_link_hash_entry *low;
@@ -5420,7 +5402,7 @@ struct mips_elf_hash_sort_data
};
/* If H needs a GOT entry, assign it the highest available dynamic
- index. Otherwise, assign it the lowest available dynamic
+ index. Otherwise, assign it the lowest available dynamic
index. */
static boolean
@@ -5428,7 +5410,7 @@ mips_elf_sort_hash_table_f (h, data)
struct mips_elf_link_hash_entry *h;
PTR data;
{
- struct mips_elf_hash_sort_data *hsd
+ struct mips_elf_hash_sort_data *hsd
= (struct mips_elf_hash_sort_data *) data;
/* Symbols without dynamic symbol table entries aren't interesting
@@ -5468,9 +5450,9 @@ mips_elf_sort_hash_table (info, max_local)
hsd.low = NULL;
hsd.min_got_dynindx = elf_hash_table (info)->dynsymcount;
hsd.max_non_got_dynindx = max_local;
- mips_elf_link_hash_traverse (((struct mips_elf_link_hash_table *)
- elf_hash_table (info)),
- mips_elf_sort_hash_table_f,
+ mips_elf_link_hash_traverse (((struct mips_elf_link_hash_table *)
+ elf_hash_table (info)),
+ mips_elf_sort_hash_table_f,
&hsd);
/* There shoud have been enough room in the symbol table to
@@ -5505,7 +5487,7 @@ mips_elf_create_local_got_entry (abfd, g, sgot, value)
}
MIPS_ELF_PUT_WORD (abfd, value,
- (sgot->contents
+ (sgot->contents
+ MIPS_ELF_GOT_SIZE (abfd) * g->assigned_gotno));
return MIPS_ELF_GOT_SIZE (abfd) * g->assigned_gotno++;
}
@@ -5527,8 +5509,8 @@ mips_elf_local_got_index (abfd, info, value)
g = mips_elf_got_info (elf_hash_table (info)->dynobj, &sgot);
/* Look to see if we already have an appropriate entry. */
- for (entry = (sgot->contents
- + MIPS_ELF_GOT_SIZE (abfd) * MIPS_RESERVED_GOTNO);
+ for (entry = (sgot->contents
+ + MIPS_ELF_GOT_SIZE (abfd) * MIPS_RESERVED_GOTNO);
entry != sgot->contents + MIPS_ELF_GOT_SIZE (abfd) * g->assigned_gotno;
entry += MIPS_ELF_GOT_SIZE (abfd))
{
@@ -5564,7 +5546,7 @@ mips_elf_got_page (abfd, info, value, offsetp)
/* Look to see if we aleady have an appropriate entry. */
last_entry = sgot->contents + MIPS_ELF_GOT_SIZE (abfd) * g->assigned_gotno;
- for (entry = (sgot->contents
+ for (entry = (sgot->contents
+ MIPS_ELF_GOT_SIZE (abfd) * MIPS_RESERVED_GOTNO);
entry != last_entry;
entry += MIPS_ELF_GOT_SIZE (abfd))
@@ -5623,7 +5605,7 @@ mips_elf_got16_entry (abfd, info, value, external)
/* Look to see if we already have an appropriate entry. */
last_entry = sgot->contents + MIPS_ELF_GOT_SIZE (abfd) * g->assigned_gotno;
- for (entry = (sgot->contents
+ for (entry = (sgot->contents
+ MIPS_ELF_GOT_SIZE (abfd) * MIPS_RESERVED_GOTNO);
entry != last_entry;
entry += MIPS_ELF_GOT_SIZE (abfd))
@@ -5699,7 +5681,7 @@ mips_elf_create_dynamic_relocation (output_bfd, info, rel, h, sec,
r_type = ELF32_R_TYPE (rel->r_info);
dynobj = elf_hash_table (info)->dynobj;
- sreloc
+ sreloc
= bfd_get_section_by_name (dynobj,
MIPS_ELF_REL_DYN_SECTION_NAME (output_bfd));
BFD_ASSERT (sreloc != NULL);
@@ -5718,7 +5700,7 @@ mips_elf_create_dynamic_relocation (output_bfd, info, rel, h, sec,
Because we compress stab information, the offset given in the
relocation may not be the one we want; we must let the stabs
machinery tell us the offset. */
- outrel.r_offset
+ outrel.r_offset
= (_bfd_stab_section_offset
(output_bfd, &elf_hash_table (info)->stab_info,
input_section,
@@ -5750,7 +5732,7 @@ mips_elf_create_dynamic_relocation (output_bfd, info, rel, h, sec,
/* h->root.dynindx may be -1 if this symbol was marked to
become local. */
if (indx == -1)
- indx = 0;
+ indx = 0;
}
else
{
@@ -5778,10 +5760,10 @@ mips_elf_create_dynamic_relocation (output_bfd, info, rel, h, sec,
/* Now, the relocation is just against the section. */
symbol = sec->output_section->vma;
}
-
- /* If the relocation is against a local symbol was previously an absolute
- relocation, we must adjust it by the value we give it in the dynamic
- symbol table. */
+
+ /* If the relocation is against a local symbol was previously an
+ absolute relocation, we must adjust it by the value we give
+ it in the dynamic symbol table. */
if (local_p && r_type != R_MIPS_REL32)
*addendp += symbol;
@@ -5802,7 +5784,7 @@ mips_elf_create_dynamic_relocation (output_bfd, info, rel, h, sec,
{
(*get_elf_backend_data (output_bfd)->s->swap_reloc_out)
(output_bfd, &outrel,
- (sreloc->contents
+ (sreloc->contents
+ sreloc->reloc_count * sizeof (Elf64_Mips_External_Rel)));
}
else
@@ -5814,7 +5796,7 @@ mips_elf_create_dynamic_relocation (output_bfd, info, rel, h, sec,
/* Record the index of the first relocation referencing H. This
information is later emitted in the .msym section. */
if (h != NULL
- && (h->min_dyn_reloc_index == 0
+ && (h->min_dyn_reloc_index == 0
|| sreloc->reloc_count < h->min_dyn_reloc_index))
h->min_dyn_reloc_index = sreloc->reloc_count;
@@ -5829,7 +5811,7 @@ mips_elf_create_dynamic_relocation (output_bfd, info, rel, h, sec,
/* On IRIX5, make an entry of compact relocation info. */
if (! skip && IRIX_COMPAT (output_bfd) == ict_irix5)
{
- asection* scpt = bfd_get_section_by_name (dynobj, ".compact_rel");
+ asection *scpt = bfd_get_section_by_name (dynobj, ".compact_rel");
bfd_byte *cr;
if (scpt)
@@ -5873,7 +5855,7 @@ mips_elf_create_dynamic_relocation (output_bfd, info, rel, h, sec,
overflow occurs, and bfd_reloc_ok to indicate success. */
static bfd_reloc_status_type
-mips_elf_calculate_relocation (abfd,
+mips_elf_calculate_relocation (abfd,
input_bfd,
input_section,
info,
@@ -5884,7 +5866,7 @@ mips_elf_calculate_relocation (abfd,
local_sections,
valuep,
namep,
- require_jalxp)
+ require_jalxp)
bfd *abfd;
bfd *input_bfd;
asection *input_section;
@@ -5918,7 +5900,7 @@ mips_elf_calculate_relocation (abfd,
/* The section in which the symbol referenced by the relocation is
located. */
asection *sec = NULL;
- struct mips_elf_link_hash_entry* h = NULL;
+ struct mips_elf_link_hash_entry *h = NULL;
/* True if the symbol referred to by this relocation is a local
symbol. */
boolean local_p;
@@ -5937,7 +5919,7 @@ mips_elf_calculate_relocation (abfd,
/* Parse the relocation. */
r_symndx = ELF32_R_SYM (relocation->r_info);
r_type = ELF32_R_TYPE (relocation->r_info);
- p = (input_section->output_section->vma
+ p = (input_section->output_section->vma
+ input_section->output_offset
+ relocation->r_offset);
@@ -5957,7 +5939,7 @@ mips_elf_calculate_relocation (abfd,
must come before globals. */
extsymoff = 0;
}
-
+
/* Figure out the value of the symbol. */
if (local_p)
{
@@ -5986,13 +5968,13 @@ mips_elf_calculate_relocation (abfd,
else
{
/* For global symbols we look up the symbol in the hash-table. */
- h = ((struct mips_elf_link_hash_entry *)
+ h = ((struct mips_elf_link_hash_entry *)
elf_sym_hashes (input_bfd) [r_symndx - extsymoff]);
/* Find the real hash-table entry for this symbol. */
while (h->root.root.type == bfd_link_hash_indirect
|| h->root.root.type == bfd_link_hash_warning)
h = (struct mips_elf_link_hash_entry *) h->root.root.u.i.link;
-
+
/* Record the name of this symbol, for our caller. */
*namep = h->root.root.root.string;
@@ -6017,7 +5999,7 @@ mips_elf_calculate_relocation (abfd,
{
sec = h->root.root.u.def.section;
if (sec->output_section)
- symbol = (h->root.root.u.def.value
+ symbol = (h->root.root.u.def.value
+ sec->output_section->vma
+ sec->output_offset);
else
@@ -6036,7 +6018,7 @@ mips_elf_calculate_relocation (abfd,
strcmp (h->root.root.root.string, "_DYNAMIC_LINKING") == 0)
{
/* If this is a dynamic link, we should have created a
- _DYNAMIC_LINK symbol or _DYNAMIC_LINKING(for normal mips) symbol
+ _DYNAMIC_LINK symbol or _DYNAMIC_LINKING(for normal mips) symbol
in in mips_elf_create_dynamic_sections.
Otherwise, we should define the symbol with a value of 0.
FIXME: It should probably get into the symbol table
@@ -6058,7 +6040,7 @@ mips_elf_calculate_relocation (abfd,
target_is_16_bit_code_p = (h->root.other == STO_MIPS16);
}
-
+
/* If this is a 32-bit call to a 16-bit function with a stub, we
need to redirect the call to the stub, unless we're already *in*
a stub. */
@@ -6084,7 +6066,7 @@ mips_elf_calculate_relocation (abfd,
/* If this is a 16-bit call to a 32-bit function with a stub, we
need to redirect the call to the stub. */
else if (r_type == R_MIPS16_26 && !info->relocateable
- && h != NULL
+ && h != NULL
&& (h->call_stub != NULL || h->call_fp_stub != NULL)
&& !target_is_16_bit_code_p)
{
@@ -6140,9 +6122,9 @@ mips_elf_calculate_relocation (abfd,
if (!local_p)
{
BFD_ASSERT (addend == 0);
- g = mips_elf_global_got_index
+ g = mips_elf_global_got_index
(elf_hash_table (info)->dynobj,
- (struct elf_link_hash_entry*) h);
+ (struct elf_link_hash_entry *) h);
if (! elf_hash_table(info)->dynamic_sections_created
|| (info->shared
&& (info->symbolic || h->root.dynindx == -1)
@@ -6172,7 +6154,7 @@ mips_elf_calculate_relocation (abfd,
g = mips_elf_got_offset_from_index (elf_hash_table (info)->dynobj,
abfd, g);
break;
-
+
case R_MIPS_HI16:
case R_MIPS_LO16:
case R_MIPS_GPREL16:
@@ -6213,8 +6195,8 @@ mips_elf_calculate_relocation (abfd,
record in the output, and leave the job up to the dynamic
linker. */
value = addend;
- if (!mips_elf_create_dynamic_relocation (abfd,
- info,
+ if (!mips_elf_create_dynamic_relocation (abfd,
+ info,
relocation,
h,
sec,
@@ -6323,12 +6305,12 @@ mips_elf_calculate_relocation (abfd,
value = mips_elf_sign_extend (addend, 16) + symbol - gp;
overflowed_p = mips_elf_overflow_p (value, 16);
break;
-
+
case R_MIPS_GOT16:
if (local_p)
{
boolean forced;
-
+
/* The special case is when the symbol is forced to be local. We
need the full address in the GOT since no R_MIPS_LO16 relocation
follows. */
@@ -6337,7 +6319,7 @@ mips_elf_calculate_relocation (abfd,
value = mips_elf_got16_entry (abfd, info, symbol + addend, forced);
if (value == (bfd_vma) -1)
return false;
- value
+ value
= mips_elf_got_offset_from_index (elf_hash_table (info)->dynobj,
abfd,
value);
@@ -6387,7 +6369,7 @@ mips_elf_calculate_relocation (abfd,
value);
overflowed_p = mips_elf_overflow_p (value, 16);
break;
-
+
case R_MIPS_GOT_OFST:
mips_elf_got_page (abfd, info, symbol + addend, &value);
overflowed_p = mips_elf_overflow_p (value, 16);
@@ -6407,7 +6389,7 @@ mips_elf_calculate_relocation (abfd,
value = mips_elf_highest (addend + symbol);
value &= howto->dst_mask;
break;
-
+
case R_MIPS_SCN_DISP:
value = symbol + addend - sec->output_offset;
value &= howto->dst_mask;
@@ -6470,7 +6452,7 @@ mips_elf_obtain_contents (howto, relocation, input_bfd, contents)
static boolean
mips_elf_perform_relocation (info, howto, relocation, value,
- input_bfd, input_section,
+ input_bfd, input_section,
contents, require_jalx)
struct bfd_link_info *info;
reloc_howto_type *howto;
@@ -6509,7 +6491,7 @@ mips_elf_perform_relocation (info, howto, relocation, value,
+--------------+--------------------------------+
! Immediate 15:0 !
+-----------------------------------------------+
-
+
JALX is the 5-bit value 00011. X is 0 for jal, 1 for jalx.
Note that the immediate value in the first word is swapped.
@@ -6534,14 +6516,14 @@ mips_elf_perform_relocation (info, howto, relocation, value,
To put it in MIPS ABI terms, the relocation field is T-targ26-16,
defined as
-
+
big-endian:
+--------+----------------------+
| | |
| | targ26-16 |
|31 26|25 0|
+--------+----------------------+
-
+
little-endian:
+----------+------+-------------+
| | | |
@@ -6550,7 +6532,7 @@ mips_elf_perform_relocation (info, howto, relocation, value,
+----------+--------------------+
where targ26-16 is sub1 followed by sub2 (i.e., the addend field A is
((sub1 << 16) | sub2)).
-
+
When producing a relocateable object file, the calculation is
(((A < 2) | (P & 0xf0000000) + S) >> 2)
When producing a fully linked file, the calculation is
@@ -6559,10 +6541,10 @@ mips_elf_perform_relocation (info, howto, relocation, value,
if (!info->relocateable)
/* Shuffle the bits according to the formula above. */
- value = (((value & 0x1f0000) << 5)
- | ((value & 0x3e00000) >> 5)
+ value = (((value & 0x1f0000) << 5)
+ | ((value & 0x3e00000) >> 5)
| (value & 0xffff));
-
+
}
else if (r_type == R_MIPS16_GPREL)
{
@@ -6574,13 +6556,13 @@ mips_elf_perform_relocation (info, howto, relocation, value,
+--------------+--------------------------------+
! Major ! rx ! ry ! Imm 4:0 !
+--------------+--------------------------------+
-
+
EXTEND is the five bit value 11110. Major is the instruction
opcode.
-
+
This is handled exactly like R_MIPS_GPREL16, except that the
addend is retrieved and stored as shown in this diagram; that
- is, the Imm fields above replace the V-rel16 field.
+ is, the Imm fields above replace the V-rel16 field.
All we need to do here is shuffle the bits appropriately. As
above, the two 16-bit halves must be swapped on a
@@ -6633,7 +6615,7 @@ mips_elf_perform_relocation (info, howto, relocation, value,
if ((r_type == R_MIPS16_GPREL || r_type == R_MIPS16_26)
&& bfd_little_endian (input_bfd))
x = (((x & 0xffff) << 16) | ((x & 0xffff0000) >> 16));
-
+
/* Put the value into the output. */
bfd_put (8 * bfd_get_reloc_size (howto), input_bfd, x, location);
return true;
@@ -6690,7 +6672,7 @@ _bfd_mips_elf_relocate_section (output_bfd, info, input_bfd, input_section,
if (r_type == R_MIPS_64 && !ABI_64_P (output_bfd))
{
/* Some 32-bit code uses R_MIPS_64. In particular, people use
- 64-bit code, but make sure all their addresses are in the
+ 64-bit code, but make sure all their addresses are in the
lowermost or uppermost 32-bit section of the 64-bit address
space. Thus, when they use an R_MIPS_64 they mean what is
usually meant by R_MIPS_32, with the exception that the
@@ -6700,7 +6682,7 @@ _bfd_mips_elf_relocate_section (output_bfd, info, input_bfd, input_section,
/* On big-endian systems, we need to lie about the position
of the reloc. */
if (bfd_big_endian (input_bfd))
- rel->r_offset += 4;
+ rel->r_offset += 4;
}
else
howto = mips_rtype_to_howto (r_type);
@@ -6726,7 +6708,7 @@ _bfd_mips_elf_relocate_section (output_bfd, info, input_bfd, input_section,
rela_relocation_p = false;
/* Get the addend, which is stored in the input file. */
- addend = mips_elf_obtain_contents (howto,
+ addend = mips_elf_obtain_contents (howto,
rel,
input_bfd,
contents);
@@ -6750,15 +6732,15 @@ _bfd_mips_elf_relocate_section (output_bfd, info, input_bfd, input_section,
left-shifted by sixteen bits, and the LO16
addend, sign extended. (Usually, the code does
a `lui' of the HI16 value, and then an `addiu' of
- the LO16 value.)
+ the LO16 value.)
Scan ahead to find a matching LO16 relocation. */
if (r_type == R_MIPS_GNU_REL_HI16)
lo = R_MIPS_GNU_REL_LO16;
else
lo = R_MIPS_LO16;
- lo16_relocation
- = mips_elf_next_relocation (lo, rel, relend);
+ lo16_relocation
+ = mips_elf_next_relocation (lo, rel, relend);
if (lo16_relocation == NULL)
return false;
@@ -6810,7 +6792,7 @@ _bfd_mips_elf_relocate_section (output_bfd, info, input_bfd, input_section,
/* There's nothing to do for non-local relocations. */
continue;
- if (r_type == R_MIPS16_GPREL
+ if (r_type == R_MIPS16_GPREL
|| r_type == R_MIPS_GPREL16
|| r_type == R_MIPS_GPREL32
|| r_type == R_MIPS_LITERAL)
@@ -6829,7 +6811,7 @@ _bfd_mips_elf_relocate_section (output_bfd, info, input_bfd, input_section,
if (ELF_ST_TYPE (sym->st_info) == STT_SECTION)
/* Adjust the addend appropriately. */
addend += local_sections[r_symndx]->output_offset;
-
+
/* If the relocation is for a R_MIPS_HI16 or R_MIPS_GOT16,
then we only want to write out the high-order 16 bits.
The subsequent R_MIPS_LO16 will handle the low-order bits. */
@@ -6865,12 +6847,12 @@ _bfd_mips_elf_relocate_section (output_bfd, info, input_bfd, input_section,
bfd_vma sign_bits;
bfd_vma low_bits;
bfd_vma high_bits;
-
+
if (addend & ((bfd_vma) 1 << 31))
sign_bits = ((bfd_vma) 1 << 32) - 1;
else
sign_bits = 0;
-
+
/* If we don't know that we have a 64-bit type,
do two separate stores. */
if (bfd_big_endian (input_bfd))
@@ -6885,15 +6867,15 @@ _bfd_mips_elf_relocate_section (output_bfd, info, input_bfd, input_section,
low_bits = addend;
high_bits = sign_bits;
}
- bfd_put_32 (input_bfd, low_bits,
+ bfd_put_32 (input_bfd, low_bits,
contents + rel->r_offset);
- bfd_put_32 (input_bfd, high_bits,
+ bfd_put_32 (input_bfd, high_bits,
contents + rel->r_offset + 4);
continue;
}
if (!mips_elf_perform_relocation (info, howto, rel, addend,
- input_bfd, input_section,
+ input_bfd, input_section,
contents, false))
return false;
}
@@ -6906,7 +6888,7 @@ _bfd_mips_elf_relocate_section (output_bfd, info, input_bfd, input_section,
relocations for the same offset. In that case we are
supposed to treat the output of each relocation as the addend
for the next. */
- if (rel + 1 < relend
+ if (rel + 1 < relend
&& rel->r_offset == rel[1].r_offset
&& ELF32_R_TYPE (rel[1].r_info) != R_MIPS_NONE)
use_saved_addend_p = true;
@@ -6914,7 +6896,7 @@ _bfd_mips_elf_relocate_section (output_bfd, info, input_bfd, input_section,
use_saved_addend_p = false;
/* Figure out what value we are supposed to relocate. */
- switch (mips_elf_calculate_relocation (output_bfd,
+ switch (mips_elf_calculate_relocation (output_bfd,
input_bfd,
input_section,
info,
@@ -7007,15 +6989,15 @@ _bfd_mips_elf_relocate_section (output_bfd, info, input_bfd, input_section,
low_bits = value;
high_bits = sign_bits;
}
- bfd_put_32 (input_bfd, low_bits,
+ bfd_put_32 (input_bfd, low_bits,
contents + rel->r_offset);
- bfd_put_32 (input_bfd, high_bits,
+ bfd_put_32 (input_bfd, high_bits,
contents + rel->r_offset + 4);
continue;
}
/* Actually perform the relocation. */
- if (!mips_elf_perform_relocation (info, howto, rel, value, input_bfd,
+ if (!mips_elf_perform_relocation (info, howto, rel, value, input_bfd,
input_section, contents,
require_jalx))
return false;
@@ -7028,7 +7010,6 @@ _bfd_mips_elf_relocate_section (output_bfd, info, input_bfd, input_section,
symbol. We mark symbols as small common if appropriate. This is
also where we undo the increment of the value for a mips16 symbol. */
-/*ARGSIGNORED*/
boolean
_bfd_mips_elf_link_output_symbol_hook (abfd, info, name, sym, input_sec)
bfd *abfd ATTRIBUTE_UNUSED;
@@ -7094,9 +7075,9 @@ _bfd_mips_elf_create_dynamic_sections (abfd, info)
if (IRIX_COMPAT (abfd) == ict_irix6
&& !mips_elf_create_msym_section (abfd))
return false;
-
+
/* Create .stub section. */
- if (bfd_get_section_by_name (abfd,
+ if (bfd_get_section_by_name (abfd,
MIPS_ELF_STUB_SECTION_NAME (abfd)) == NULL)
{
s = bfd_make_section (abfd, MIPS_ELF_STUB_SECTION_NAME (abfd));
@@ -7134,7 +7115,7 @@ _bfd_mips_elf_create_dynamic_sections (abfd, info)
get_elf_backend_data (abfd)->collect,
(struct bfd_link_hash_entry **) &h)))
return false;
- h->elf_link_hash_flags &=~ ELF_LINK_NON_ELF;
+ h->elf_link_hash_flags &= ~ELF_LINK_NON_ELF;
h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR;
h->type = STT_SECTION;
@@ -7144,10 +7125,10 @@ _bfd_mips_elf_create_dynamic_sections (abfd, info)
/* We need to create a .compact_rel section. */
if (SGI_COMPAT (abfd))
- {
- if (!mips_elf_create_compact_rel_section (abfd, info))
+ {
+ if (!mips_elf_create_compact_rel_section (abfd, info))
return false;
- }
+ }
/* Change aligments of some sections. */
s = bfd_get_section_by_name (abfd, ".hash");
@@ -7171,25 +7152,25 @@ _bfd_mips_elf_create_dynamic_sections (abfd, info)
{
h = NULL;
if (SGI_COMPAT (abfd))
- {
- if (!(_bfd_generic_link_add_one_symbol
- (info, abfd, "_DYNAMIC_LINK", BSF_GLOBAL, bfd_abs_section_ptr,
- (bfd_vma) 0, (const char *) NULL, false,
- get_elf_backend_data (abfd)->collect,
- (struct bfd_link_hash_entry **) &h)))
+ {
+ if (!(_bfd_generic_link_add_one_symbol
+ (info, abfd, "_DYNAMIC_LINK", BSF_GLOBAL, bfd_abs_section_ptr,
+ (bfd_vma) 0, (const char *) NULL, false,
+ get_elf_backend_data (abfd)->collect,
+ (struct bfd_link_hash_entry **) &h)))
return false;
- }
+ }
else
- {
- /* For normal mips it is _DYNAMIC_LINKING. */
- if (!(_bfd_generic_link_add_one_symbol
- (info, abfd, "_DYNAMIC_LINKING", BSF_GLOBAL,
- bfd_abs_section_ptr, (bfd_vma) 0, (const char *) NULL, false,
- get_elf_backend_data (abfd)->collect,
- (struct bfd_link_hash_entry **) &h)))
- return false;
- }
- h->elf_link_hash_flags &=~ ELF_LINK_NON_ELF;
+ {
+ /* For normal mips it is _DYNAMIC_LINKING. */
+ if (!(_bfd_generic_link_add_one_symbol
+ (info, abfd, "_DYNAMIC_LINKING", BSF_GLOBAL,
+ bfd_abs_section_ptr, (bfd_vma) 0, (const char *) NULL, false,
+ get_elf_backend_data (abfd)->collect,
+ (struct bfd_link_hash_entry **) &h)))
+ return false;
+ }
+ h->elf_link_hash_flags &= ~ELF_LINK_NON_ELF;
h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR;
h->type = STT_SECTION;
@@ -7206,26 +7187,26 @@ _bfd_mips_elf_create_dynamic_sections (abfd, info)
BFD_ASSERT (s != NULL);
h = NULL;
- if (SGI_COMPAT (abfd))
- {
- if (!(_bfd_generic_link_add_one_symbol
- (info, abfd, "__rld_map", BSF_GLOBAL, s,
- (bfd_vma) 0, (const char *) NULL, false,
- get_elf_backend_data (abfd)->collect,
- (struct bfd_link_hash_entry **) &h)))
- return false;
- }
- else
- {
- /* For normal mips the symbol is __RLD_MAP. */
- if (!(_bfd_generic_link_add_one_symbol
- (info, abfd, "__RLD_MAP", BSF_GLOBAL, s,
- (bfd_vma) 0, (const char *) NULL, false,
- get_elf_backend_data (abfd)->collect,
- (struct bfd_link_hash_entry **) &h)))
- return false;
- }
- h->elf_link_hash_flags &=~ ELF_LINK_NON_ELF;
+ if (SGI_COMPAT (abfd))
+ {
+ if (!(_bfd_generic_link_add_one_symbol
+ (info, abfd, "__rld_map", BSF_GLOBAL, s,
+ (bfd_vma) 0, (const char *) NULL, false,
+ get_elf_backend_data (abfd)->collect,
+ (struct bfd_link_hash_entry **) &h)))
+ return false;
+ }
+ else
+ {
+ /* For normal mips the symbol is __RLD_MAP. */
+ if (!(_bfd_generic_link_add_one_symbol
+ (info, abfd, "__RLD_MAP", BSF_GLOBAL, s,
+ (bfd_vma) 0, (const char *) NULL, false,
+ get_elf_backend_data (abfd)->collect,
+ (struct bfd_link_hash_entry **) &h)))
+ return false;
+ }
+ h->elf_link_hash_flags &= ~ELF_LINK_NON_ELF;
h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR;
h->type = STT_OBJECT;
@@ -7265,7 +7246,7 @@ mips_elf_create_compact_rel_section (abfd, info)
return true;
}
-/* Create the .got section to hold the global offset table. */
+/* Create the .got section to hold the global offset table. */
static boolean
mips_elf_create_got_section (abfd, info)
@@ -7300,7 +7281,7 @@ mips_elf_create_got_section (abfd, info)
get_elf_backend_data (abfd)->collect,
(struct bfd_link_hash_entry **) &h)))
return false;
- h->elf_link_hash_flags &=~ ELF_LINK_NON_ELF;
+ h->elf_link_hash_flags &= ~ELF_LINK_NON_ELF;
h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR;
h->type = STT_OBJECT;
@@ -7326,7 +7307,7 @@ mips_elf_create_got_section (abfd, info)
return false;
}
elf_section_data (s)->tdata = (PTR) g;
- elf_section_data (s)->this_hdr.sh_flags
+ elf_section_data (s)->this_hdr.sh_flags
|= SHF_ALLOC | SHF_WRITE | SHF_MIPS_GPREL;
return true;
@@ -7342,15 +7323,15 @@ mips_elf_create_msym_section (abfd)
asection *s;
s = bfd_get_section_by_name (abfd, MIPS_ELF_MSYM_SECTION_NAME (abfd));
- if (!s)
+ if (!s)
{
s = bfd_make_section (abfd, MIPS_ELF_MSYM_SECTION_NAME (abfd));
if (!s
- || !bfd_set_section_flags (abfd, s,
+ || !bfd_set_section_flags (abfd, s,
SEC_ALLOC
| SEC_LOAD
| SEC_HAS_CONTENTS
- | SEC_LINKER_CREATED
+ | SEC_LINKER_CREATED
| SEC_READONLY)
|| !bfd_set_section_alignment (abfd, s,
MIPS_ELF_LOG_FILE_ALIGN (abfd)))
@@ -7371,10 +7352,10 @@ mips_elf_allocate_dynamic_relocations (abfd, n)
s = bfd_get_section_by_name (abfd, MIPS_ELF_REL_DYN_SECTION_NAME (abfd));
BFD_ASSERT (s != NULL);
-
+
if (s->_raw_size == 0)
{
- /* Make room for a null element. */
+ /* Make room for a null element. */
s->_raw_size += MIPS_ELF_REL_SIZE (abfd);
++s->reloc_count;
}
@@ -7479,7 +7460,7 @@ _bfd_mips_elf_check_relocs (abfd, info, sec, relocs)
}
/* Record this stub in an array of local symbol stubs for
- this BFD. */
+ this BFD. */
if (elf_tdata (abfd)->local_stubs == NULL)
{
unsigned long symcount;
@@ -7755,7 +7736,7 @@ _bfd_mips_elf_check_relocs (abfd, info, sec, relocs)
hmips = (struct mips_elf_link_hash_entry *) h;
++hmips->possibly_dynamic_relocs;
}
-
+
/* Even though we don't directly need a GOT entry for
this symbol, a symbol must have a dynamic symbol
table index greater that DT_MIPS_GOTSYM if there are
@@ -7799,7 +7780,7 @@ _bfd_mips_elf_check_relocs (abfd, info, sec, relocs)
/* If this reloc is not a 16 bit call, and it has a global
symbol, then we will need the fn_stub if there is one.
- References from a stub section do not count. */
+ References from a stub section do not count. */
if (h != NULL
&& r_type != R_MIPS16_26
&& strncmp (bfd_get_section_name (abfd, sec), FN_STUB,
@@ -7903,7 +7884,7 @@ _bfd_mips_elf_gc_sweep_hook (abfd, info, sec, relocs)
/* ??? It would seem that the existing MIPS code does no sort
of reference counting or whatnot on its GOT and PLT entries,
so it is not possible to garbage collect them at this time. */
- break;
+ break;
default:
break;
@@ -7930,7 +7911,7 @@ _bfd_mips_elf_copy_indirect_symbol (dir, ind)
dirmips->possibly_dynamic_relocs += indmips->possibly_dynamic_relocs;
if (dirmips->min_dyn_reloc_index == 0
|| (indmips->min_dyn_reloc_index != 0
- && indmips->min_dyn_reloc_index < dirmips->min_dyn_reloc_index))
+ && indmips->min_dyn_reloc_index < dirmips->min_dyn_reloc_index))
dirmips->min_dyn_reloc_index = indmips->min_dyn_reloc_index;
}
@@ -7969,10 +7950,10 @@ _bfd_mips_elf_adjust_dynamic_symbol (info, h)
if (! info->relocateable
&& hmips->possibly_dynamic_relocs != 0
&& (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
- mips_elf_allocate_dynamic_relocations (dynobj,
+ mips_elf_allocate_dynamic_relocations (dynobj,
hmips->possibly_dynamic_relocs);
- /* For a function, create a stub, if needed. */
+ /* For a function, create a stub, if needed. */
if ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) != 0)
{
if (! elf_hash_table (info)->dynamic_sections_created)
@@ -7985,7 +7966,7 @@ _bfd_mips_elf_adjust_dynamic_symbol (info, h)
if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
{
/* We need .stub section. */
- s = bfd_get_section_by_name (dynobj,
+ s = bfd_get_section_by_name (dynobj,
MIPS_ELF_STUB_SECTION_NAME (dynobj));
BFD_ASSERT (s != NULL);
@@ -8004,10 +7985,10 @@ _bfd_mips_elf_adjust_dynamic_symbol (info, h)
}
}
else if ((h->type == STT_FUNC)
- && (h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) == 0)
+ && (h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) == 0)
{
/* This will set the entry for this symbol in the GOT to 0, and
- the dynamic linker will take care of this. */
+ the dynamic linker will take care of this. */
h->root.u.def.value = 0;
return true;
}
@@ -8063,7 +8044,6 @@ _bfd_mips_elf_always_size_sections (output_bfd, info)
/* Check the mips16 stubs for a particular symbol, and see if we can
discard them. */
-/*ARGSUSED*/
static boolean
mips_elf_check_mips16_stubs (h, data)
struct mips_elf_link_hash_entry *h;
@@ -8077,7 +8057,7 @@ mips_elf_check_mips16_stubs (h, data)
being included in the link. */
h->fn_stub->_raw_size = 0;
h->fn_stub->_cooked_size = 0;
- h->fn_stub->flags &= ~ SEC_RELOC;
+ h->fn_stub->flags &= ~SEC_RELOC;
h->fn_stub->reloc_count = 0;
h->fn_stub->flags |= SEC_EXCLUDE;
}
@@ -8090,7 +8070,7 @@ mips_elf_check_mips16_stubs (h, data)
to 0 to prevent it from being included in the link. */
h->call_stub->_raw_size = 0;
h->call_stub->_cooked_size = 0;
- h->call_stub->flags &= ~ SEC_RELOC;
+ h->call_stub->flags &= ~SEC_RELOC;
h->call_stub->reloc_count = 0;
h->call_stub->flags |= SEC_EXCLUDE;
}
@@ -8103,7 +8083,7 @@ mips_elf_check_mips16_stubs (h, data)
to 0 to prevent it from being included in the link. */
h->call_fp_stub->_raw_size = 0;
h->call_fp_stub->_cooked_size = 0;
- h->call_fp_stub->flags &= ~ SEC_RELOC;
+ h->call_fp_stub->flags &= ~SEC_RELOC;
h->call_fp_stub->reloc_count = 0;
h->call_fp_stub->flags |= SEC_EXCLUDE;
}
@@ -8133,9 +8113,9 @@ _bfd_mips_elf_size_dynamic_sections (output_bfd, info)
{
s = bfd_get_section_by_name (dynobj, ".interp");
BFD_ASSERT (s != NULL);
- s->_raw_size
+ s->_raw_size
= strlen (ELF_DYNAMIC_INTERPRETER (output_bfd)) + 1;
- s->contents
+ s->contents
= (bfd_byte *) ELF_DYNAMIC_INTERPRETER (output_bfd);
}
}
@@ -8190,13 +8170,13 @@ _bfd_mips_elf_size_dynamic_sections (output_bfd, info)
if ((target != NULL
&& (target->flags & SEC_READONLY) != 0
&& (target->flags & SEC_ALLOC) != 0)
- || strcmp (outname,
+ || strcmp (outname,
MIPS_ELF_REL_DYN_SECTION_NAME (output_bfd)) == 0)
reltext = true;
/* We use the reloc_count field as a counter if we need
to copy relocs into the output file. */
- if (strcmp (name,
+ if (strcmp (name,
MIPS_ELF_REL_DYN_SECTION_NAME (output_bfd)) != 0)
s->reloc_count = 0;
}
@@ -8204,49 +8184,49 @@ _bfd_mips_elf_size_dynamic_sections (output_bfd, info)
else if (strncmp (name, ".got", 4) == 0)
{
int i;
- bfd_size_type loadable_size = 0;
- bfd_size_type local_gotno;
- struct _bfd *sub;
+ bfd_size_type loadable_size = 0;
+ bfd_size_type local_gotno;
+ struct _bfd *sub;
- BFD_ASSERT (elf_section_data (s) != NULL);
+ BFD_ASSERT (elf_section_data (s) != NULL);
g = (struct mips_got_info *) elf_section_data (s)->tdata;
- BFD_ASSERT (g != NULL);
-
- /* Calculate the total loadable size of the output. That
- will give us the maximum number of GOT_PAGE entries
- required. */
- for (sub = info->input_bfds; sub; sub = sub->link_next)
- {
- asection *subsection;
-
- for (subsection = sub->sections;
- subsection;
- subsection = subsection->next)
- {
- if ((subsection->flags & SEC_ALLOC) == 0)
- continue;
- loadable_size += (subsection->_raw_size + 0xf) & ~0xf;
- }
- }
- loadable_size += MIPS_FUNCTION_STUB_SIZE;
-
- /* Assume there are two loadable segments consisting of
- contiguous sections. Is 5 enough? */
- local_gotno = (loadable_size >> 16) + 5;
+ BFD_ASSERT (g != NULL);
+
+ /* Calculate the total loadable size of the output. That
+ will give us the maximum number of GOT_PAGE entries
+ required. */
+ for (sub = info->input_bfds; sub; sub = sub->link_next)
+ {
+ asection *subsection;
+
+ for (subsection = sub->sections;
+ subsection;
+ subsection = subsection->next)
+ {
+ if ((subsection->flags & SEC_ALLOC) == 0)
+ continue;
+ loadable_size += (subsection->_raw_size + 0xf) & ~0xf;
+ }
+ }
+ loadable_size += MIPS_FUNCTION_STUB_SIZE;
+
+ /* Assume there are two loadable segments consisting of
+ contiguous sections. Is 5 enough? */
+ local_gotno = (loadable_size >> 16) + 5;
if (IRIX_COMPAT (output_bfd) == ict_irix6)
/* It's possible we will need GOT_PAGE entries as well as
GOT16 entries. Often, these will be able to share GOT
entries, but not always. */
local_gotno *= 2;
- g->local_gotno += local_gotno;
- s->_raw_size += local_gotno * MIPS_ELF_GOT_SIZE (dynobj);
+ g->local_gotno += local_gotno;
+ s->_raw_size += local_gotno * MIPS_ELF_GOT_SIZE (dynobj);
- /* There has to be a global GOT entry for every symbol with
- a dynamic symbol table index of DT_MIPS_GOTSYM or
- higher. Therefore, it make sense to put those symbols
- that need GOT entries at the end of the symbol table. We
- do that here. */
+ /* There has to be a global GOT entry for every symbol with
+ a dynamic symbol table index of DT_MIPS_GOTSYM or
+ higher. Therefore, it make sense to put those symbols
+ that need GOT entries at the end of the symbol table. We
+ do that here. */
if (!mips_elf_sort_hash_table (info, 1))
return false;
@@ -8278,7 +8258,7 @@ _bfd_mips_elf_size_dynamic_sections (output_bfd, info)
s->_raw_size += mips_elf_hash_table (info)->compact_rel_size;
else if (strcmp (name, MIPS_ELF_MSYM_SECTION_NAME (output_bfd))
== 0)
- s->_raw_size = (sizeof (Elf32_External_Msym)
+ s->_raw_size = (sizeof (Elf32_External_Msym)
* (elf_hash_table (info)->dynsymcount
+ bfd_count_sections (output_bfd)));
else if (strncmp (name, ".init", 5) != 0)
@@ -8311,26 +8291,26 @@ _bfd_mips_elf_size_dynamic_sections (output_bfd, info)
dynamic linker and used by the debugger. */
if (! info->shared)
{
- /* SGI object has the equivalence of DT_DEBUG in the
- DT_MIPS_RLD_MAP entry. */
- if (!MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_RLD_MAP, 0))
- return false;
- if (!SGI_COMPAT (output_bfd))
- {
- if (!MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_DEBUG, 0))
- return false;
- }
- }
+ /* SGI object has the equivalence of DT_DEBUG in the
+ DT_MIPS_RLD_MAP entry. */
+ if (!MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_RLD_MAP, 0))
+ return false;
+ if (!SGI_COMPAT (output_bfd))
+ {
+ if (!MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_DEBUG, 0))
+ return false;
+ }
+ }
else
- {
- /* Shared libraries on traditional mips have DT_DEBUG. */
- if (!SGI_COMPAT (output_bfd))
- {
- if (!MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_DEBUG, 0))
- return false;
- }
- }
- if (reltext && SGI_COMPAT(output_bfd))
+ {
+ /* Shared libraries on traditional mips have DT_DEBUG. */
+ if (!SGI_COMPAT (output_bfd))
+ {
+ if (!MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_DEBUG, 0))
+ return false;
+ }
+ }
+ if (reltext && SGI_COMPAT (output_bfd))
{
if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_TEXTREL, 0))
return false;
@@ -8354,16 +8334,16 @@ _bfd_mips_elf_size_dynamic_sections (output_bfd, info)
}
if (SGI_COMPAT (output_bfd))
- {
- if (!MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_CONFLICTNO, 0))
+ {
+ if (!MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_CONFLICTNO, 0))
return false;
- }
+ }
if (SGI_COMPAT (output_bfd))
- {
- if (!MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_LIBLISTNO, 0))
+ {
+ if (!MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_LIBLISTNO, 0))
return false;
- }
+ }
if (bfd_get_section_by_name (dynobj, ".conflict") != NULL)
{
@@ -8419,12 +8399,12 @@ _bfd_mips_elf_size_dynamic_sections (output_bfd, info)
return false;
if (IRIX_COMPAT (dynobj) == ict_irix6
- && (bfd_get_section_by_name
+ && (bfd_get_section_by_name
(dynobj, MIPS_ELF_OPTIONS_SECTION_NAME (dynobj)))
&& !MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_OPTIONS, 0))
return false;
- if (bfd_get_section_by_name (dynobj,
+ if (bfd_get_section_by_name (dynobj,
MIPS_ELF_MSYM_SECTION_NAME (dynobj))
&& !MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_MSYM, 0))
return false;
@@ -8465,7 +8445,7 @@ mips_elf_irix6_finish_dynamic_symbol (abfd, name, sym)
int i;
for (i = 0; i < 2; ++i)
- for (p = (i == 0) ? text_section_symbols : data_section_symbols;
+ for (p = (i == 0) ? text_section_symbols : data_section_symbols;
*p;
++p)
if (strcmp (*p, name) == 0)
@@ -8473,13 +8453,13 @@ mips_elf_irix6_finish_dynamic_symbol (abfd, name, sym)
/* All of these symbols are given type STT_SECTION by the
IRIX6 linker. */
sym->st_info = ELF_ST_INFO (STB_GLOBAL, STT_SECTION);
-
+
/* The IRIX linker puts these symbols in special sections. */
if (i == 0)
sym->st_shndx = SHN_MIPS_TEXT;
else
sym->st_shndx = SHN_MIPS_DATA;
-
+
break;
}
}
@@ -8516,15 +8496,15 @@ _bfd_mips_elf_finish_dynamic_symbol (output_bfd, info, h, sym)
BFD_ASSERT (h->dynindx != -1);
- s = bfd_get_section_by_name (dynobj,
+ s = bfd_get_section_by_name (dynobj,
MIPS_ELF_STUB_SECTION_NAME (dynobj));
BFD_ASSERT (s != NULL);
/* Fill the stub. */
p = stub;
- bfd_put_32 (output_bfd, STUB_LW(output_bfd), p);
+ bfd_put_32 (output_bfd, STUB_LW (output_bfd), p);
p += 4;
- bfd_put_32 (output_bfd, STUB_MOVE(output_bfd), p);
+ bfd_put_32 (output_bfd, STUB_MOVE (output_bfd), p);
p += 4;
/* FIXME: Can h->dynindex be more than 64K? */
@@ -8533,7 +8513,7 @@ _bfd_mips_elf_finish_dynamic_symbol (output_bfd, info, h, sym)
bfd_put_32 (output_bfd, STUB_JALR, p);
p += 4;
- bfd_put_32 (output_bfd, STUB_LI16(output_bfd) + h->dynindx, p);
+ bfd_put_32 (output_bfd, STUB_LI16 (output_bfd) + h->dynindx, p);
BFD_ASSERT (h->plt.offset <= s->_raw_size);
memcpy (s->contents + h->plt.offset, stub, MIPS_FUNCTION_STUB_SIZE);
@@ -8569,24 +8549,24 @@ _bfd_mips_elf_finish_dynamic_symbol (output_bfd, info, h, sym)
if (sym->st_value)
value = sym->st_value;
else
- {
- /* For an entity defined in a shared object, this will be
- NULL. (For functions in shared objects for
- which we have created stubs, ST_VALUE will be non-NULL.
- That's because such the functions are now no longer defined
- in a shared object.) */
-
- if (info->shared && h->root.type == bfd_link_hash_undefined)
- value = 0;
- else
- value = h->root.u.def.value;
- }
+ {
+ /* For an entity defined in a shared object, this will be
+ NULL. (For functions in shared objects for
+ which we have created stubs, ST_VALUE will be non-NULL.
+ That's because such the functions are now no longer defined
+ in a shared object.) */
+
+ if (info->shared && h->root.type == bfd_link_hash_undefined)
+ value = 0;
+ else
+ value = h->root.u.def.value;
+ }
offset = mips_elf_global_got_index (dynobj, h);
MIPS_ELF_PUT_WORD (output_bfd, value, sgot->contents + offset);
}
/* Create a .msym entry, if appropriate. */
- smsym = bfd_get_section_by_name (dynobj,
+ smsym = bfd_get_section_by_name (dynobj,
MIPS_ELF_MSYM_SECTION_NAME (dynobj));
if (smsym)
{
@@ -8596,7 +8576,7 @@ _bfd_mips_elf_finish_dynamic_symbol (output_bfd, info, h, sym)
/* It is undocumented what the `1' indicates, but IRIX6 uses
this value. */
msym.ms_info = ELF32_MS_INFO (mh->min_dyn_reloc_index, 1);
- bfd_mips_elf_swap_msym_out
+ bfd_mips_elf_swap_msym_out
(dynobj, &msym,
((Elf32_External_Msym *) smsym->contents) + h->dynindx);
}
@@ -8607,7 +8587,7 @@ _bfd_mips_elf_finish_dynamic_symbol (output_bfd, info, h, sym)
|| strcmp (name, "_GLOBAL_OFFSET_TABLE_") == 0)
sym->st_shndx = SHN_ABS;
else if (strcmp (name, "_DYNAMIC_LINK") == 0
- || strcmp (name, "_DYNAMIC_LINKING") == 0)
+ || strcmp (name, "_DYNAMIC_LINKING") == 0)
{
sym->st_shndx = SHN_ABS;
sym->st_info = ELF_ST_INFO (STB_GLOBAL, STT_SECTION);
@@ -8622,7 +8602,7 @@ _bfd_mips_elf_finish_dynamic_symbol (output_bfd, info, h, sym)
else if (SGI_COMPAT (output_bfd))
{
if (strcmp (name, mips_elf_dynsym_rtproc_names[0]) == 0
- || strcmp (name, mips_elf_dynsym_rtproc_names[1]) == 0)
+ || strcmp (name, mips_elf_dynsym_rtproc_names[1]) == 0)
{
sym->st_info = ELF_ST_INFO (STB_GLOBAL, STT_SECTION);
sym->st_other = STO_PROTECTED;
@@ -8668,7 +8648,7 @@ _bfd_mips_elf_finish_dynamic_symbol (output_bfd, info, h, sym)
/* IRIX6 does not use a .rld_map section. */
if (IRIX_COMPAT (output_bfd) == ict_irix5
|| IRIX_COMPAT (output_bfd) == ict_none)
- BFD_ASSERT (bfd_get_section_by_name (dynobj, ".rld_map")
+ BFD_ASSERT (bfd_get_section_by_name (dynobj, ".rld_map")
!= NULL);
mips_elf_hash_table (info)->rld_value = sym->st_value;
}
@@ -8727,14 +8707,14 @@ _bfd_mips_elf_finish_dynamic_sections (output_bfd, info)
/* Read in the current dynamic entry. */
(*get_elf_backend_data (dynobj)->s->swap_dyn_in) (dynobj, b, &dyn);
-
+
/* Assume that we're going to modify it and write it out. */
swap_out_p = true;
switch (dyn.d_tag)
{
case DT_RELENT:
- s = (bfd_get_section_by_name
+ s = (bfd_get_section_by_name
(dynobj,
MIPS_ELF_REL_DYN_SECTION_NAME (dynobj)));
BFD_ASSERT (s != NULL);
@@ -8787,7 +8767,7 @@ _bfd_mips_elf_finish_dynamic_sections (output_bfd, info)
dyn.d_un.d_val = s->_raw_size / elemsize;
}
else
- dyn.d_un.d_val = 0;
+ dyn.d_un.d_val = 0;
break;
case DT_MIPS_TIME_STAMP:
@@ -8852,13 +8832,13 @@ _bfd_mips_elf_finish_dynamic_sections (output_bfd, info)
break;
case DT_MIPS_OPTIONS:
- s = (bfd_get_section_by_name
+ s = (bfd_get_section_by_name
(output_bfd, MIPS_ELF_OPTIONS_SECTION_NAME (output_bfd)));
dyn.d_un.d_ptr = s->vma;
break;
case DT_MIPS_MSYM:
- s = (bfd_get_section_by_name
+ s = (bfd_get_section_by_name
(output_bfd, MIPS_ELF_MSYM_SECTION_NAME (output_bfd)));
dyn.d_un.d_ptr = s->vma;
break;
@@ -8869,18 +8849,18 @@ _bfd_mips_elf_finish_dynamic_sections (output_bfd, info)
}
if (swap_out_p)
- (*get_elf_backend_data (dynobj)->s->swap_dyn_out)
+ (*get_elf_backend_data (dynobj)->s->swap_dyn_out)
(dynobj, &dyn, b);
}
}
/* The first entry of the global offset table will be filled at
runtime. The second entry will be used by some runtime loaders.
- This isn't the case of Irix rld. */
+ This isn't the case of Irix rld. */
if (sgot != NULL && sgot->_raw_size > 0)
{
MIPS_ELF_PUT_WORD (output_bfd, (bfd_vma) 0, sgot->contents);
- MIPS_ELF_PUT_WORD (output_bfd, (bfd_vma) 0x80000000,
+ MIPS_ELF_PUT_WORD (output_bfd, (bfd_vma) 0x80000000,
sgot->contents + MIPS_ELF_GOT_SIZE (output_bfd));
}
@@ -8897,7 +8877,7 @@ _bfd_mips_elf_finish_dynamic_sections (output_bfd, info)
_bfd_elf_final_link. SGI sets the STT_NOTYPE attribute for these
symbols. Should we do so? */
- smsym = bfd_get_section_by_name (dynobj,
+ smsym = bfd_get_section_by_name (dynobj,
MIPS_ELF_MSYM_SECTION_NAME (dynobj));
if (smsym != NULL)
{
@@ -8910,7 +8890,7 @@ _bfd_mips_elf_finish_dynamic_sections (output_bfd, info)
{
long dynindx = elf_section_data (s)->dynindx;
- bfd_mips_elf_swap_msym_out
+ bfd_mips_elf_swap_msym_out
(output_bfd, &msym,
(((Elf32_External_Msym *) smsym->contents)
+ dynindx));
@@ -8935,7 +8915,7 @@ _bfd_mips_elf_finish_dynamic_sections (output_bfd, info)
s->contents));
/* Clean up a dummy stub function entry in .text. */
- s = bfd_get_section_by_name (dynobj,
+ s = bfd_get_section_by_name (dynobj,
MIPS_ELF_STUB_SECTION_NAME (dynobj));
if (s != NULL)
{
@@ -8953,21 +8933,21 @@ _bfd_mips_elf_finish_dynamic_sections (output_bfd, info)
if (!ABI_64_P (output_bfd))
{
- asection *reldyn;
-
- reldyn = bfd_get_section_by_name (dynobj,
- MIPS_ELF_REL_DYN_SECTION_NAME (dynobj));
- if (reldyn != NULL && reldyn->reloc_count > 2)
- {
- reldyn_sorting_bfd = output_bfd;
- qsort ((Elf32_External_Rel *) reldyn->contents + 1,
- (size_t) reldyn->reloc_count - 1,
- sizeof (Elf32_External_Rel), sort_dynamic_relocs);
- }
+ asection *reldyn;
+
+ reldyn = bfd_get_section_by_name (dynobj,
+ MIPS_ELF_REL_DYN_SECTION_NAME (dynobj));
+ if (reldyn != NULL && reldyn->reloc_count > 2)
+ {
+ reldyn_sorting_bfd = output_bfd;
+ qsort ((Elf32_External_Rel *) reldyn->contents + 1,
+ (size_t) reldyn->reloc_count - 1,
+ sizeof (Elf32_External_Rel), sort_dynamic_relocs);
+ }
}
/* Clean up a first relocation in .rel.dyn. */
- s = bfd_get_section_by_name (dynobj,
+ s = bfd_get_section_by_name (dynobj,
MIPS_ELF_REL_DYN_SECTION_NAME (dynobj));
if (s != NULL && s->_raw_size > 0)
memset (s->contents, 0, MIPS_ELF_REL_SIZE (dynobj));
@@ -9159,13 +9139,13 @@ error_return:
free (reloc_vector);
return NULL;
}
+
#define bfd_elf32_bfd_get_relocated_section_contents \
elf32_mips_get_relocated_section_contents
/* ECOFF swapping routines. These are used when dealing with the
.mdebug section, which is in the ECOFF debugging format. */
-static const struct ecoff_debug_swap mips_elf32_ecoff_debug_swap =
-{
+static const struct ecoff_debug_swap mips_elf32_ecoff_debug_swap = {
/* Symbol table magic number. */
magicSym,
/* Alignment of debugging information. E.g., 4. */