summaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorJan Kratochvil <jan.kratochvil@redhat.com>2008-09-17 07:50:29 +0000
committerJan Kratochvil <jan.kratochvil@redhat.com>2008-09-17 07:50:29 +0000
commit8701118c0a6ca2ea55e635274516f6ba7cd248b9 (patch)
treec9c3cb101d7ee4ed2b602d3e09461bd1acf87869 /bfd
parent3258a3b1ec9beaa5d48e985e56cbf9964b2f8be3 (diff)
downloadbinutils-redhat-8701118c0a6ca2ea55e635274516f6ba7cd248b9.tar.gz
bfd/
PR 6893 - Do not consider FDEs for discarded sections as invalid. * elf-eh-frame.c (_bfd_elf_parse_eh_frame): New REQUIRE_CLEARED_RELOCS. Consider FDEs with cleared relocations as valid and ignorable. ld/testsuite/ * ld-elf/eh-group.exp, ld-elf/eh-group1.s, ld-elf/eh-group2.s: New test. binutils/ Suppress warnings on NONE relocations to discarded sections. * readelf.c (is_none_reloc): New function. (debug_apply_relocations): Ignore is_none_reloc() relocations.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog6
-rw-r--r--bfd/elf-eh-frame.c33
2 files changed, 35 insertions, 4 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 705c6f7061..97c46de6e4 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,9 @@
+2008-09-17 Jan Kratochvil <jan.kratochvil@redhat.com>
+
+ PR 6893 - Do not consider FDEs for discarded sections as invalid.
+ * elf-eh-frame.c (_bfd_elf_parse_eh_frame): New REQUIRE_CLEARED_RELOCS.
+ Consider FDEs with cleared relocations as valid and ignorable.
+
2008-09-16 H.J. Lu <hongjiu.lu@intel.com>
PR ld/6877
diff --git a/bfd/elf-eh-frame.c b/bfd/elf-eh-frame.c
index 7151a39763..579a6b8967 100644
--- a/bfd/elf-eh-frame.c
+++ b/bfd/elf-eh-frame.c
@@ -549,6 +549,16 @@ _bfd_elf_parse_eh_frame (bfd *abfd, struct bfd_link_info *info,
< (bfd_size_type) ((buf) - ehbuf))) \
cookie->rel++
+#define REQUIRE_CLEARED_RELOCS(buf) \
+ while (cookie->rel < cookie->relend \
+ && (cookie->rel->r_offset \
+ < (bfd_size_type) ((buf) - ehbuf))) \
+ { \
+ REQUIRE (cookie->rel->r_info == 0); \
+ REQUIRE (cookie->rel->r_addend == 0); \
+ cookie->rel++; \
+ }
+
#define GET_RELOC(buf) \
((cookie->rel < cookie->relend \
&& (cookie->rel->r_offset \
@@ -766,9 +776,14 @@ _bfd_elf_parse_eh_frame (bfd *abfd, struct bfd_link_info *info,
/* Chain together the FDEs for each section. */
rsec = _bfd_elf_gc_mark_rsec (info, sec, gc_mark_hook, cookie);
- REQUIRE (rsec && rsec->owner == abfd);
- this_inf->u.fde.next_for_section = elf_fde_list (rsec);
- elf_fde_list (rsec) = this_inf;
+ /* RSEC will be NULL if FDE was cleared out as it was belonging to
+ a discarded SHT_GROUP. */
+ if (rsec)
+ {
+ REQUIRE (rsec->owner == abfd);
+ this_inf->u.fde.next_for_section = elf_fde_list (rsec);
+ elf_fde_list (rsec) = this_inf;
+ }
/* Skip the initial location and address range. */
start = buf;
@@ -801,7 +816,17 @@ _bfd_elf_parse_eh_frame (bfd *abfd, struct bfd_link_info *info,
insns = buf;
buf = last_fde + 4 + hdr_length;
- SKIP_RELOCS (buf);
+
+ /* Cleared FDE? The instructions will not be cleared but verify all
+ the relocation entries for them are cleared. */
+ if (rsec == NULL)
+ {
+ REQUIRE_CLEARED_RELOCS (buf);
+ }
+ else
+ {
+ SKIP_RELOCS (buf);
+ }
}
/* Try to interpret the CFA instructions and find the first