aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf32-mips.c
diff options
context:
space:
mode:
authorFred Fish <fnf@specifix.com>1995-10-31 23:29:05 +0000
committerFred Fish <fnf@specifix.com>1995-10-31 23:29:05 +0000
commit6ab826bd986e25ff65bf78451866a618d704411e (patch)
treeebb963024936cc55372694128806f98473943ba5 /bfd/elf32-mips.c
parent02a5d235259cb3e5a478ce4a81833bdfa3cce457 (diff)
downloadgdb-6ab826bd986e25ff65bf78451866a618d704411e.zip
gdb-6ab826bd986e25ff65bf78451866a618d704411e.tar.gz
gdb-6ab826bd986e25ff65bf78451866a618d704411e.tar.bz2
* libelf.h: Rename to elf-bfd.h to avoid conflict with
systems that have a system <libelf.h>. * Makefile.in: Globally replace libelf.h with elf-bfd.h. * bfd.c, elf.c, elf32-arc.c, elf32-gen.c, elf32-hppa.c, elf32-hppa.h, elf32-i386.c, elf32-i860.c, elf32-m68k.c, elf32-m88k.c, elf32-mips.c, elf32-ppc.c, elf32-sparc.c, elf64-gen.c, elf64-sparc.c, elfcode.h, elflink.c, elfxx-target.h: Include elf-bfd.h rather than libelf.h. * elfxx-target.h: Change libelf.h reference to elf-bfd.h.
Diffstat (limited to 'bfd/elf32-mips.c')
-rw-r--r--bfd/elf32-mips.c30
1 files changed, 24 insertions, 6 deletions
diff --git a/bfd/elf32-mips.c b/bfd/elf32-mips.c
index 09f144f..a4e10d3 100644
--- a/bfd/elf32-mips.c
+++ b/bfd/elf32-mips.c
@@ -25,7 +25,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#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. */
@@ -882,7 +882,7 @@ bfd_elf32_bfd_reloc_type_lookup (abfd, code)
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++)
{
@@ -1352,7 +1352,7 @@ mips_elf_symbol_processing (abfd, asym)
{
/* 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;
@@ -1526,10 +1526,18 @@ mips_elf_find_nearest_line (abfd, section, symbols, offset, filename_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)
{
@@ -1543,13 +1551,17 @@ mips_elf_find_nearest_line (abfd, section, symbols, offset, filename_ptr,
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 *)
@@ -1559,6 +1571,7 @@ mips_elf_find_nearest_line (abfd, section, symbols, offset, filename_ptr,
if (fi->d.fdr == NULL)
{
bfd_set_error (bfd_error_no_memory);
+ msec->flags = origflags;
return false;
}
external_fdr_size = swap->external_fdr_size;
@@ -1582,7 +1595,12 @@ mips_elf_find_nearest_line (abfd, section, symbols, offset, filename_ptr,
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. */
@@ -2525,7 +2543,7 @@ mips_elf_relocate_section (output_bfd, info, input_bfd, input_section,
{
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;