You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
-Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "bfd.h"
#include "sysdep.h"
#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;
swap = get_elf_backend_data (abfd)->elf_backend_ecoff_debug_swap;
- ext_hdr = (char *) malloc (swap->external_hdr_size);
+ ext_hdr = (char *) malloc ((size_t) swap->external_hdr_size);
if (ext_hdr == NULL && swap->external_hdr_size != 0)
{
bfd_set_error (bfd_error_no_memory);
debug->ptr = NULL; \
else \
{ \
- debug->ptr = (type) malloc (size * symhdr->count); \
+ debug->ptr = (type) malloc ((size_t) (size * symhdr->count)); \
if (debug->ptr == NULL) \
{ \
bfd_set_error (bfd_error_no_memory); \
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. */
- return bfd_elf32_find_nearest_line (abfd, section, symbols, offset,
- filename_ptr, functionname_ptr,
- line_ptr);
+ return _bfd_elf_find_nearest_line (abfd, section, symbols, offset,
+ filename_ptr, functionname_ptr,
+ line_ptr);
}
\f
/* The MIPS ELF linker needs additional information for each symbol in
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;
name = h->root.root.string;
else
{
- name = elf_string_from_elf_section (input_bfd,
- symtab_hdr->sh_link,
- sym->st_name);
+ name = bfd_elf_string_from_elf_section (input_bfd,
+ symtab_hdr->sh_link,
+ sym->st_name);
if (name == NULL)
return false;
if (*name == '\0')
arelent **parent;
/* for mips */
int gp_found;
- bfd_vma gp;
+ bfd_vma gp = 0x12345678; /* initialize just to shut gcc up */
{
struct bfd_hash_entry *h;