Since r_offset in dynamic relocation isn't section relative, we can't
check it like relocations in relocatable objets. This fixes:
https://bugzilla.redhat.com/show_bug.cgi?id=1205789
* elflint.c (check_one_reloc): Skip dynamic relocations.
---
src/elflint.c | 20 ++++++++++++++------
1 file changed, 14 insertions(+), 6 deletions(-)
diff --git a/src/elflint.c b/src/elflint.c
index a6f9b68..d881419 100644
--- a/src/elflint.c
+++ b/src/elflint.c
@@ -1392,12 +1392,20 @@ section [%2d] '%s': relocation %zu: only symbol
'_GLOBAL_OFFSET_TABLE_' can be u
else if (!known_broken)
{
if (destshdr != NULL
- && GELF_R_TYPE (r_info) != 0
- && (r_offset - (ehdr->e_type == ET_REL ? 0
- : destshdr->sh_addr)) >= destshdr->sh_size)
- ERROR (gettext ("\
-section [%2d] '%s': relocation %zu: offset out of bounds\n"),
- idx, section_name (ebl, idx), cnt);
+ && GELF_R_TYPE (r_info) != 0)
+ {
+ if (ehdr->e_type == ET_REL)
+ {
+ if (r_offset >= destshdr->sh_size)
+ ERROR (gettext ("\
+ section [%2d] '%s': relocation %zu: offset out of bounds\n"),
+ idx, section_name (ebl, idx), cnt);
+ }
+ else
+ {
+ // XXX TODO Check .rel.xxx section addresses.
+ }
+ }
}
GElf_Sym sym_mem;
--
2.1.0