aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf32-mips.c
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>1994-10-17 18:27:40 +0000
committerIan Lance Taylor <ian@airs.com>1994-10-17 18:27:40 +0000
commit24f13b03316bafcc34781122bdc371c06e5224c7 (patch)
treeb0c224ccb45a561cbd60c3532d4a2517569775b4 /bfd/elf32-mips.c
parent5e643795a3cad22ba84a0b0a93b72061d6fc64c3 (diff)
downloadgdb-24f13b03316bafcc34781122bdc371c06e5224c7.zip
gdb-24f13b03316bafcc34781122bdc371c06e5224c7.tar.gz
gdb-24f13b03316bafcc34781122bdc371c06e5224c7.tar.bz2
* elfcode.h (elf_swap_shdr_in): Use rawdata, not bfd_section.
Clear contents field. (bfd_section_from_shdr): In SHT_STRTAB case, check bfd_section, not rawdata. Don't set rawdata if e_shstrndx. Use bfd_section rather than rawdata in commented out code. In SHT_REL[A] case, don't bother to check elf_section_data of section returned by section_from_elf_index. (elf_fake_sections): Set bfd_section, not rawdata. Don't set size. (elf_map_symbols): Don't set elf_num_section_syms. Don't create section symbols that already exist. (assign_file_position_for_section): Use bfd_section, not rawdata. (section_from_elf_index): Just check bfd_section field. (elf_section_from_bfd_section): Likewise. (elf_debug_section): Don't print rawdata, contents, or size. (elf_link_add_object_symbols): Don't error out if section_from_elf_index returns NULL. (elf_bfd_final_link): Check return value from section_from_elf_index against NULL, not bfd_is_abs_section. (elf_link_input_bfd): Don't check section_from_elf_index return value. * libelf.h (struct elf_obj_tdata): Remove num_section_syms field. (elf_num_section_syms): Don't define. * elf.c (elf_get_str_section): Store section contents in contents field rather than rawdata field. (elf_string_from_elf_section): Likewise. (_bfd_elf_make_section_from_shdr): Store BFD section pointer in bfd_section field rather than rawdata field. * elf32-hppa.c (elf32_hppa_read_symext_info): Use bfd_section rather than rawdata. (elf32_hppa_size_stubs): Likewise. * elf32-mips.c (mips_elf_final_write_processing): Use bfd_section rathern than rawdata. (mips_elf_section_from_shdr): Likewise. (mips_elf_section_processing): Likewise. (mips_elf_section_from_bfd_section): Remove rawdata check.
Diffstat (limited to 'bfd/elf32-mips.c')
-rw-r--r--bfd/elf32-mips.c37
1 files changed, 19 insertions, 18 deletions
diff --git a/bfd/elf32-mips.c b/bfd/elf32-mips.c
index 6148a5a..08d2d7f 100644
--- a/bfd/elf32-mips.c
+++ b/bfd/elf32-mips.c
@@ -71,7 +71,8 @@ static void mips_info_to_howto_rel
PARAMS ((bfd *, arelent *, Elf32_Internal_Rel *));
static boolean mips_elf_sym_is_global PARAMS ((bfd *, asymbol *));
static boolean mips_elf_object_p PARAMS ((bfd *));
-static void mips_elf_final_write_processing PARAMS ((bfd *));
+static void mips_elf_final_write_processing
+ PARAMS ((bfd *, boolean));
static boolean mips_elf_section_from_shdr
PARAMS ((bfd *, Elf32_Internal_Shdr *, char *));
static boolean mips_elf_fake_sections
@@ -95,7 +96,7 @@ static void mips_elf_relocate_hi16
bfd_vma));
static boolean mips_elf_relocate_section
PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
- Elf_Internal_Rela *, Elf_Internal_Sym *, asection **));
+ Elf_Internal_Rela *, Elf_Internal_Sym *, asection **, char *));
static boolean mips_elf_add_symbol_hook
PARAMS ((bfd *, struct bfd_link_info *, const Elf_Internal_Sym *,
const char **, flagword *, asection **, bfd_vma *));
@@ -362,7 +363,7 @@ mips_elf_hi16_reloc (abfd,
abort ();
ret = bfd_reloc_ok;
- if (symbol->section == &bfd_und_section
+ if (bfd_is_und_section (symbol->section)
&& output_bfd == (bfd *) NULL)
ret = bfd_reloc_undefined;
@@ -548,7 +549,7 @@ mips_elf_gprel16_reloc (abfd,
output_bfd = symbol->section->output_section->owner;
}
- if (symbol->section == &bfd_und_section
+ if (bfd_is_und_section (symbol->section)
&& relocateable == false)
return bfd_reloc_undefined;
@@ -839,9 +840,11 @@ mips_elf_object_p (abfd)
file. This gets the MIPS architecture right based on the machine
number. */
+/*ARGSUSED*/
static void
-mips_elf_final_write_processing (abfd)
+mips_elf_final_write_processing (abfd, linker)
bfd *abfd;
+ boolean linker;
{
unsigned long val;
unsigned int i;
@@ -878,8 +881,8 @@ mips_elf_final_write_processing (abfd)
const char *name;
asection *sec;
- BFD_ASSERT ((*hdrpp)->rawdata != NULL);
- name = ((asection *) (*hdrpp)->rawdata)->name;
+ BFD_ASSERT ((*hdrpp)->bfd_section != NULL);
+ name = bfd_get_section_name (abfd, (*hdrpp)->bfd_section);
BFD_ASSERT (name != NULL
&& strncmp (name, ".gptab.", sizeof ".gptab." - 1) == 0);
sec = bfd_get_section_by_name (abfd, name + sizeof ".gptab" - 1);
@@ -944,7 +947,7 @@ mips_elf_section_from_shdr (abfd, hdr, name)
if (! _bfd_elf_make_section_from_shdr (abfd, hdr, name))
return false;
- newsect = (asection *) hdr->rawdata;
+ newsect = hdr->bfd_section;
if (hdr->sh_type == SHT_MIPS_DEBUG)
{
@@ -1042,8 +1045,6 @@ mips_elf_section_from_bfd_section (abfd, hdr, sec, retval)
*retval = SHN_MIPS_SCOMMON;
return true;
}
- if ((asection *) hdr->rawdata == sec)
- return true;
return false;
}
@@ -1073,9 +1074,9 @@ mips_elf_section_processing (abfd, hdr)
return false;
}
- if (hdr->rawdata != NULL)
+ if (hdr->bfd_section != NULL)
{
- const char *name = ((asection *) hdr->rawdata)->name;
+ const char *name = bfd_get_section_name (abfd, hdr->bfd_section);
if (strcmp (name, ".sdata") == 0)
{
@@ -1173,7 +1174,7 @@ mips_elf_symbol_processing (abfd, asym)
break;
case SHN_MIPS_SUNDEFINED:
- asym->section = &bfd_und_section;
+ asym->section = bfd_und_section_ptr;
break;
}
}
@@ -1409,7 +1410,7 @@ mips_elf_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp)
break;
case SHN_MIPS_SUNDEFINED:
- *secp = &bfd_und_section;
+ *secp = bfd_und_section_ptr;
break;
}
@@ -2150,7 +2151,8 @@ mips_elf_relocate_hi16 (input_bfd, relhi, rello, contents, addend)
static boolean
mips_elf_relocate_section (output_bfd, info, input_bfd, input_section,
- contents, relocs, local_syms, local_sections)
+ contents, relocs, local_syms, local_sections,
+ output_names)
bfd *output_bfd;
struct bfd_link_info *info;
bfd *input_bfd;
@@ -2159,6 +2161,7 @@ mips_elf_relocate_section (output_bfd, info, input_bfd, input_section,
Elf_Internal_Rela *relocs;
Elf_Internal_Sym *local_syms;
asection **local_sections;
+ char *output_names;
{
Elf_Internal_Shdr *symtab_hdr;
size_t locsymcount;
@@ -2372,9 +2375,7 @@ mips_elf_relocate_section (output_bfd, info, input_bfd, input_section,
name = h->root.root.string;
else
{
- name = elf_string_from_elf_section (input_bfd,
- symtab_hdr->sh_link,
- sym->st_name);
+ name = output_names + sym->st_name;
if (name == NULL)
return false;
if (*name == '\0')