#include "libbfd.h"
#include "bfdlink.h"
#include "genlink.h"
-#include "libelf.h"
+#include "elf-bfd.h"
#include "elf/mips.h"
/* Get the ECOFF swapping routines. */
bfd *abfd;
bfd_reloc_code_real_type code;
{
- int i;
+ unsigned int i;
for (i = 0; i < sizeof (mips_reloc_map) / sizeof (struct elf_reloc_map); i++)
{
{
/* Initialize the acommon section. */
mips_elf_acom_section.name = ".acommon";
- mips_elf_acom_section.flags = SEC_NO_FLAGS;
+ mips_elf_acom_section.flags = SEC_ALLOC;
mips_elf_acom_section.output_section = &mips_elf_acom_section;
mips_elf_acom_section.symbol = &mips_elf_acom_symbol;
mips_elf_acom_section.symbol_ptr_ptr = &mips_elf_acom_symbol_ptr;
msec = bfd_get_section_by_name (abfd, ".mdebug");
if (msec != NULL)
{
+ flagword origflags;
struct mips_elf_find_line *fi;
const struct ecoff_debug_swap * const swap =
get_elf_backend_data (abfd)->elf_backend_ecoff_debug_swap;
+ /* If we are called during a link, mips_elf_final_link may have
+ cleared the SEC_HAS_CONTENTS field. We force it back on here
+ if appropriate (which it normally will be). */
+ origflags = msec->flags;
+ if (elf_section_data (msec)->this_hdr.sh_type != SHT_NOBITS)
+ msec->flags |= SEC_HAS_CONTENTS;
+
fi = elf_tdata (abfd)->find_line_info;
if (fi == NULL)
{
bfd_alloc (abfd, sizeof (struct mips_elf_find_line)));
if (fi == NULL)
{
- bfd_set_error (bfd_error_no_memory);
+ msec->flags = origflags;
return false;
}
memset (fi, 0, sizeof (struct mips_elf_find_line));
if (! mips_elf_read_ecoff_info (abfd, msec, &fi->d))
- return false;
+ {
+ msec->flags = origflags;
+ return false;
+ }
/* Swap in the FDR information. */
fi->d.fdr = ((struct fdr *)
sizeof (struct fdr))));
if (fi->d.fdr == NULL)
{
- bfd_set_error (bfd_error_no_memory);
+ msec->flags = origflags;
return false;
}
external_fdr_size = swap->external_fdr_size;
if (_bfd_ecoff_locate_line (abfd, section, offset, &fi->d, swap,
&fi->i, filename_ptr, functionname_ptr,
line_ptr))
- return true;
+ {
+ msec->flags = origflags;
+ return true;
+ }
+
+ msec->flags = origflags;
}
/* Fall back on the generic ELF find_nearest_line routine. */
bfd_hash_allocate (table,
sizeof (struct mips_elf_link_hash_entry)));
if (ret == (struct mips_elf_link_hash_entry *) NULL)
- {
- bfd_set_error (bfd_error_no_memory);
- return (struct bfd_hash_entry *) ret;
- }
+ return (struct bfd_hash_entry *) ret;
/* Call the allocation method of the superclass. */
ret = ((struct mips_elf_link_hash_entry *)
ret = ((struct mips_elf_link_hash_table *)
bfd_alloc (abfd, sizeof (struct mips_elf_link_hash_table)));
if (ret == (struct mips_elf_link_hash_table *) NULL)
- {
- bfd_set_error (bfd_error_no_memory);
- return NULL;
- }
+ return NULL;
if (! _bfd_elf_link_hash_table_init (&ret->root, abfd,
mips_elf_link_hash_newfunc))
gptab_bss_sec = o;
else
{
+ (*_bfd_error_handler)
+ ("%s: illegal section name `%s'",
+ bfd_get_filename (abfd), o->name);
bfd_set_error (bfd_error_nonrepresentable_section);
return false;
}
bfd_alloc (abfd, c * sizeof (Elf32_External_gptab)));
if (ext_tab == NULL)
{
- bfd_set_error (bfd_error_no_memory);
free (tab);
return false;
}
{
int r_type;
reloc_howto_type *howto;
- long r_symndx;
+ unsigned long r_symndx;
bfd_vma addend;
struct elf_link_hash_entry *h;
asection *sec;