aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorMark Mitchell <mark@codesourcery.com>1999-07-13 15:23:22 +0000
committerMark Mitchell <mark@codesourcery.com>1999-07-13 15:23:22 +0000
commit97a4bb053f80d5c0aaf586131e82b8593443d320 (patch)
treea99261e1664547f398a22c60c37a56808e9da47e /bfd
parent5dcf458ac40b6826cab194c2b8665b703bb6637e (diff)
downloadgdb-97a4bb053f80d5c0aaf586131e82b8593443d320.zip
gdb-97a4bb053f80d5c0aaf586131e82b8593443d320.tar.gz
gdb-97a4bb053f80d5c0aaf586131e82b8593443d320.tar.bz2
* elf32-mips.c (mips_elf_calculate_relocation): Do not complain
when _gp_disp is undefined. Do not check R_MIPS_LO16 for overflow when the relocation is against _gp_disp.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog6
-rw-r--r--bfd/elf32-mips.c29
2 files changed, 29 insertions, 6 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index c274a44..78787ad 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,9 @@
+1999-07-13 Mark Mitchell <mark@codesourcery.com>
+
+ * elf32-mips.c (mips_elf_calculate_relocation): Do not complain
+ when _gp_disp is undefined. Do not check R_MIPS_LO16 for overflow
+ when the relocation is against _gp_disp.
+
1999-07-12 Mark Mitchell <mark@codesourcery.com>
* dwarf2.c (read_attribute): Support DW_FORM_ref8.
diff --git a/bfd/elf32-mips.c b/bfd/elf32-mips.c
index 9d7a074..03d7f3f 100644
--- a/bfd/elf32-mips.c
+++ b/bfd/elf32-mips.c
@@ -5770,11 +5770,13 @@ mips_elf_calculate_relocation (abfd,
gp_disp_p = true;
}
-
- /* If this symbol is defined, calculate its address. */
- if ((h->root.root.type == bfd_link_hash_defined
- || h->root.root.type == bfd_link_hash_defweak)
- && h->root.root.u.def.section)
+ /* If this symbol is defined, calculate its address. Note that
+ _gp_disp is a magic symbol, always implicitly defined by the
+ linker, so it's inappropriate to check to see whether or not
+ its defined. */
+ else if ((h->root.root.type == bfd_link_hash_defined
+ || h->root.root.type == bfd_link_hash_defweak)
+ && h->root.root.u.def.section)
{
sec = h->root.root.u.def.section;
if (sec->output_section)
@@ -5908,7 +5910,22 @@ mips_elf_calculate_relocation (abfd,
else
{
value = addend + gp - p + 4;
- overflowed_p = mips_elf_overflow_p (value, 16);
+ /* The MIPS ABI requires checking the R_MIPS_LO16 relocation
+ for overflow. But, on, say, Irix 5, relocations against
+ _gp_disp are normally generated from the .cpload
+ pseudo-op. It generates code that normally looks like
+ this:
+
+ lui $gp,%hi(_gp_disp)
+ addiu $gp,$gp,%lo(_gp_disp)
+ addu $gp,$gp,$t9
+
+ Here $t9 holds the address of the function being called,
+ as required by the MIPS ELF ABI. The R_MIPS_LO16
+ relocation can easily overlfow in this situation, but the
+ R_MIPS_HI16 relocation will handle the overflow.
+ Therefore, we consider this a bug in the MIPS ABI, and do
+ not check for overflow here. */
}
break;