aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bfd/ChangeLog6
-rw-r--r--bfd/elfxx-mips.c2
-rw-r--r--ld/ChangeLog7
-rw-r--r--ld/testsuite/ld-mips-elf/mips-elf.exp2
-rw-r--r--ld/testsuite/ld-mips-elf/reloc-local-overflow.d7
-rw-r--r--ld/testsuite/ld-mips-elf/reloc-local-overflow.s8
6 files changed, 31 insertions, 1 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index bb9cb3c..5bace1e 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,9 @@
+2016-05-27 Maciej W. Rozycki <macro@imgtec.com>
+
+ * elfxx-mips.c (mips_elf_calculate_relocation): Also use the
+ section name if `bfd_elf_string_from_elf_section' returns an
+ empty string.
+
2016-05-26 Maciej W. Rozycki <macro@imgtec.com>
* elfxx-mips.c (_bfd_mips_elf_relocate_section)
diff --git a/bfd/elfxx-mips.c b/bfd/elfxx-mips.c
index 3e7b488..2fff306 100644
--- a/bfd/elfxx-mips.c
+++ b/bfd/elfxx-mips.c
@@ -5322,7 +5322,7 @@ mips_elf_calculate_relocation (bfd *abfd, bfd *input_bfd,
*namep = bfd_elf_string_from_elf_section (input_bfd,
symtab_hdr->sh_link,
sym->st_name);
- if (*namep == '\0')
+ if (*namep == NULL || **namep == '\0')
*namep = bfd_section_name (input_bfd, sec);
target_is_16_bit_code_p = ELF_ST_IS_MIPS16 (sym->st_other);
diff --git a/ld/ChangeLog b/ld/ChangeLog
index 4462450..1d683ac 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,10 @@
+2016-05-27 Maciej W. Rozycki <macro@imgtec.com>
+
+ * testsuite/ld-mips-elf/reloc-local-overflow.d: New test.
+ * testsuite/ld-mips-elf/reloc-local-overflow.s: Source for the
+ new test.
+ * testsuite/ld-mips-elf/mips-elf.exp: Run the new test.
+
2016-05-26 Maciej W. Rozycki <macro@imgtec.com>
* testsuite/ld-mips-elf/unaligned-jalx-0.d: Fold
diff --git a/ld/testsuite/ld-mips-elf/mips-elf.exp b/ld/testsuite/ld-mips-elf/mips-elf.exp
index f9bbcec..0c2a93b 100644
--- a/ld/testsuite/ld-mips-elf/mips-elf.exp
+++ b/ld/testsuite/ld-mips-elf/mips-elf.exp
@@ -440,6 +440,8 @@ if { $has_newabi } {
"reloc-6b"]]
}
+run_dump_test "reloc-local-overflow" [list [list ld $abi_ldflags(o32)]]
+
if {$has_newabi && $linux_gnu} {
run_dump_test "eh-frame1-n32"
run_dump_test "eh-frame1-n64"
diff --git a/ld/testsuite/ld-mips-elf/reloc-local-overflow.d b/ld/testsuite/ld-mips-elf/reloc-local-overflow.d
new file mode 100644
index 0000000..b5512ee
--- /dev/null
+++ b/ld/testsuite/ld-mips-elf/reloc-local-overflow.d
@@ -0,0 +1,7 @@
+#name: MIPS reloc against local symbol overflow
+#source: reloc-local-overflow.s
+#as: -EB -32
+#ld: -EB -Tdata 0x10000 -e 0
+#error: \A[^\n]*:\(\.data\+0x1000\): relocation truncated to fit: R_MIPS_16 against `\.data'\Z
+
+# Verify that the section name (`.data') is printed rather than `no symbol'.
diff --git a/ld/testsuite/ld-mips-elf/reloc-local-overflow.s b/ld/testsuite/ld-mips-elf/reloc-local-overflow.s
new file mode 100644
index 0000000..a07255c
--- /dev/null
+++ b/ld/testsuite/ld-mips-elf/reloc-local-overflow.s
@@ -0,0 +1,8 @@
+ .data
+ .space 0x1000
+
+ .align 2
+ .type bar, @object
+bar:
+ .half bar
+ .size bar, . - bar