summaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorMaciej W. Rozycki <macro@linux-mips.org>2010-07-27 21:18:52 +0000
committerMaciej W. Rozycki <macro@linux-mips.org>2010-07-27 21:18:52 +0000
commit9684f07814af5cabe84dfeb3f4a178b9a828e44d (patch)
tree32e10ebbf817ac9a652c3738e017d6eb95926e48 /bfd
parent2b2c11bd2d615b62f1e69de2e2dd64a4bb3252de (diff)
downloadbinutils-gdb-9684f07814af5cabe84dfeb3f4a178b9a828e44d.tar.gz
* elfxx-mips.h: Include "elf/mips.h".
(gprel16_reloc_p): New static inline function. * elfxx-mips.c (_bfd_mips_elf_check_relocs) [R_MIPS16_GOT16, R_MIPS_GOT16, R_MIPS_GOT_HI16, R_MIPS_GOT_LO16]: Use got16_reloc_p. (_bfd_mips_elf_relocate_section)[bfd_reloc_overflow]: Use gprel16_reloc_p. * elf32-mips.c (mips_info_to_howto_rel): Likewise. * elfn32-mips.c (mips_info_to_howto_rel): Likewise.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog12
-rw-r--r--bfd/elf32-mips.c3
-rw-r--r--bfd/elfn32-mips.c3
-rw-r--r--bfd/elfxx-mips.c4
-rw-r--r--bfd/elfxx-mips.h7
5 files changed, 23 insertions, 6 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 4a26186203a..cc36cfab873 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,5 +1,17 @@
2010-07-27 Maciej W. Rozycki <macro@codesourcery.com>
+ * elfxx-mips.h: Include "elf/mips.h".
+ (gprel16_reloc_p): New static inline function.
+ * elfxx-mips.c (_bfd_mips_elf_check_relocs)
+ [R_MIPS16_GOT16, R_MIPS_GOT16, R_MIPS_GOT_HI16, R_MIPS_GOT_LO16]:
+ Use got16_reloc_p.
+ (_bfd_mips_elf_relocate_section)[bfd_reloc_overflow]: Use
+ gprel16_reloc_p.
+ * elf32-mips.c (mips_info_to_howto_rel): Likewise.
+ * elfn32-mips.c (mips_info_to_howto_rel): Likewise.
+
+2010-07-27 Maciej W. Rozycki <macro@codesourcery.com>
+
* elf64-mips.c (mips_elf64_howto_table_rela)
[R_MIPS_TLS_DTPMOD64]: Clear partial_inplace.
[R_MIPS_TLS_DTPREL64, R_MIPS_TLS_GD, R_MIPS_TLS_LDM]: Likewise.
diff --git a/bfd/elf32-mips.c b/bfd/elf32-mips.c
index c987ff9b249..51555579137 100644
--- a/bfd/elf32-mips.c
+++ b/bfd/elf32-mips.c
@@ -1422,8 +1422,7 @@ mips_info_to_howto_rel (bfd *abfd, arelent *cache_ptr, Elf_Internal_Rela *dst)
when we do the relocation, because the symbol manipulations done
by the linker may cause us to lose track of the input BFD. */
if (((*cache_ptr->sym_ptr_ptr)->flags & BSF_SECTION_SYM) != 0
- && (r_type == (unsigned int) R_MIPS_GPREL16
- || r_type == (unsigned int) R_MIPS_LITERAL))
+ && (gprel16_reloc_p (r_type) || r_type == (unsigned int) R_MIPS_LITERAL))
cache_ptr->addend = elf_gp (abfd);
}
diff --git a/bfd/elfn32-mips.c b/bfd/elfn32-mips.c
index d48046aa09e..a0725943e54 100644
--- a/bfd/elfn32-mips.c
+++ b/bfd/elfn32-mips.c
@@ -2259,8 +2259,7 @@ mips_info_to_howto_rel (bfd *abfd, arelent *cache_ptr, Elf_Internal_Rela *dst)
when we do the relocation, because the symbol manipulations done
by the linker may cause us to lose track of the input BFD. */
if (((*cache_ptr->sym_ptr_ptr)->flags & BSF_SECTION_SYM) != 0
- && (r_type == (unsigned int) R_MIPS_GPREL16
- || r_type == (unsigned int) R_MIPS_LITERAL))
+ && (gprel16_reloc_p (r_type) || r_type == (unsigned int) R_MIPS_LITERAL))
cache_ptr->addend = elf_gp (abfd);
}
diff --git a/bfd/elfxx-mips.c b/bfd/elfxx-mips.c
index a94e60945a1..7b89a83c615 100644
--- a/bfd/elfxx-mips.c
+++ b/bfd/elfxx-mips.c
@@ -7727,7 +7727,7 @@ _bfd_mips_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
howto = MIPS_ELF_RTYPE_TO_HOWTO (abfd, r_type, FALSE);
addend = mips_elf_read_rel_addend (abfd, rel,
howto, contents);
- if (r_type == R_MIPS_GOT16)
+ if (got16_reloc_p (r_type))
mips_elf_add_lo16_rel_addend (abfd, rel, rel_end,
contents, &addend);
else
@@ -9196,7 +9196,7 @@ _bfd_mips_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
BFD_ASSERT (htab != NULL);
BFD_ASSERT (name != NULL);
if (!htab->small_data_overflow_reported
- && (howto->type == R_MIPS_GPREL16
+ && (gprel16_reloc_p (howto->type)
|| howto->type == R_MIPS_LITERAL))
{
msg = _("small-data section exceeds 64KB;"
diff --git a/bfd/elfxx-mips.h b/bfd/elfxx-mips.h
index 0b2226d26cd..096bd132478 100644
--- a/bfd/elfxx-mips.h
+++ b/bfd/elfxx-mips.h
@@ -21,6 +21,7 @@
#include "elf/common.h"
#include "elf/internal.h"
+#include "elf/mips.h"
extern bfd_boolean _bfd_mips_elf_new_section_hook
(bfd *, asection *);
@@ -153,6 +154,12 @@ extern const struct bfd_elf_special_section _bfd_mips_elf_special_sections [];
extern bfd_boolean _bfd_mips_elf_common_definition (Elf_Internal_Sym *);
+static inline bfd_boolean
+gprel16_reloc_p (unsigned int r_type)
+{
+ return r_type == R_MIPS_GPREL16 || r_type == R_MIPS16_GPREL;
+}
+
#define elf_backend_common_definition _bfd_mips_elf_common_definition
#define elf_backend_name_local_section_symbols \
_bfd_mips_elf_name_local_section_symbols