aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Mitchell <mark@codesourcery.com>1999-08-01 20:58:19 +0000
committerMark Mitchell <mark@codesourcery.com>1999-08-01 20:58:19 +0000
commit972875741c90668bcb6d0f5f78ffdc3f89d4ec19 (patch)
treef502497d7cc9dc8fe1060c9cd8d45701e2ed2f70
parenta11c78e7ddcbb5b7c6d703334a3e5a5cabf1919d (diff)
downloadgdb-972875741c90668bcb6d0f5f78ffdc3f89d4ec19.zip
gdb-972875741c90668bcb6d0f5f78ffdc3f89d4ec19.tar.gz
gdb-972875741c90668bcb6d0f5f78ffdc3f89d4ec19.tar.bz2
* elf32-mips.c (mips_elf_calculate_relocation): Undefined weak
symbols are considered to have the value zero. (_bfd_mips_elf_relocate_section): Don't try to perform a relocation for an undefined symbol. (_bfd_mips_elf_check_relocs): Allocate locate GOT space for local GOT16 relocations.
-rw-r--r--bfd/ChangeLog9
-rw-r--r--bfd/elf32-mips.c25
2 files changed, 26 insertions, 8 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index b995110..bb7c409 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,12 @@
+1999-08-01 Mark Mitchell <mark@codesourcery.com>
+
+ * elf32-mips.c (mips_elf_calculate_relocation): Undefined weak
+ symbols are considered to have the value zero.
+ (_bfd_mips_elf_relocate_section): Don't try to perform a
+ relocation for an undefined symbol.
+ (_bfd_mips_elf_check_relocs): Allocate locate GOT space for local
+ GOT16 relocations.
+
1999-07-30 Jakub Jelinek <jj@ultra.linux.cz>
* elf64-sparc.c (sparc64_elf_build_plt): Cosmetic change - ABI
diff --git a/bfd/elf32-mips.c b/bfd/elf32-mips.c
index b5596bd..6cf85c8 100644
--- a/bfd/elf32-mips.c
+++ b/bfd/elf32-mips.c
@@ -5870,6 +5870,12 @@ mips_elf_calculate_relocation (abfd,
else
symbol = h->root.root.u.def.value;
}
+ else if (h->root.root.type == bfd_link_hash_undefweak)
+ /* We allow relocations against undefined weak symbols, giving
+ it the value zero, so that you can undefined weak functions
+ and check to see if they exist by looking at their
+ addresses. */
+ symbol = 0;
else
{
(*info->callbacks->undefined_symbol)
@@ -6637,8 +6643,10 @@ _bfd_mips_elf_relocate_section (output_bfd, info, input_bfd, input_section,
case bfd_reloc_undefined:
/* mips_elf_calculate_relocation already called the
- undefined_symbol callback. */
- break;
+ undefined_symbol callback. There's no real point in
+ trying to perform the relocation at this point, so we
+ just skip ahead to the next relocation. */
+ continue;
case bfd_reloc_notsupported:
abort ();
@@ -7331,14 +7339,15 @@ _bfd_mips_elf_check_relocs (abfd, info, sec, relocs)
if (!h && (r_type == R_MIPS_CALL_LO16
|| r_type == R_MIPS_GOT_LO16
- || r_type == R_MIPS_GOT_DISP))
+ || r_type == R_MIPS_GOT_DISP
+ || r_type == R_MIPS_GOT16))
{
/* We may need a local GOT entry for this relocation. We
- don't count R_MIPS_HI16 or R_MIPS_GOT16 relocations
- because they are always followed by a R_MIPS_LO16
- relocation for the value. We don't R_MIPS_GOT_PAGE
- because we can estimate the maximum number of pages
- needed by looking at the size of the segment.
+ don't count R_MIPS_GOT_PAGE because we can estimate the
+ maximum number of pages needed by looking at the size of
+ the segment. We don't count R_MIPS_GOT_HI16, or
+ R_MIPS_CALL_HI16 because these are always followed by an
+ R_MIPS_GOT_LO16 or R_MIPS_CALL_LO16.
This estimation is very conservative since we can merge
duplicate entries in the GOT. In order to be less