Hi, I looked a bit at the gnu gold linker. And it might have some real issues (PR 10450). But the two issues addressed in the attached patch seem like they should be allowed/recognized by elflint.
Cheers, Mark
>From 4493bb2562e594f4af96f51276b00212f2cbc23d Mon Sep 17 00:00:00 2001 From: Mark Wielaard <[email protected]> Date: Sun, 26 Jul 2009 00:23:12 +0200 Subject: [PATCH] Recognize NT_GNU_GOLD_VERSION and _GLOBAL_OFFSET_TABLE_ symbol value in got. --- libelf/ChangeLog | 4 ++++ libelf/elf.h | 2 ++ src/ChangeLog | 6 ++++++ src/elflint.c | 14 ++++++++------ 4 files changed, 20 insertions(+), 6 deletions(-) diff --git a/libelf/ChangeLog b/libelf/ChangeLog index d6f3415..80ebd96 100644 --- a/libelf/ChangeLog +++ b/libelf/ChangeLog @@ -1,3 +1,7 @@ +2009-07-26 Mark Wielaard <[email protected]> + + * elf.h (NT_GNU_GOLD_VERSION): Define. + 2009-07-21 Ulrich Drepper <[email protected]> * elf32_updatefile.c (__elfXX_updatemmap): Fix handling of gaps between diff --git a/libelf/elf.h b/libelf/elf.h index 7efdede..73e2803 100644 --- a/libelf/elf.h +++ b/libelf/elf.h @@ -1054,6 +1054,8 @@ typedef struct The descriptor consists of any nonzero number of bytes. */ #define NT_GNU_BUILD_ID 3 +/* Version note generated by GNU gold containing a version string. */ +#define NT_GNU_GOLD_VERSION 4 /* Move records. */ typedef struct diff --git a/src/ChangeLog b/src/ChangeLog index 88e0c11..3a59602 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2009-07-26 Mark Wielaard <[email protected]> + + * elflint.c (check_symtab): Allow _GLOBAL_OFFSET_TABLE_ inside + got section. + (check_note_data): Recognize NT_GNU_GOLD_VERSION. + 2009-07-25 Mark Wielaard <[email protected]> * Makefile.am (addr2line_LDADD): Add $(libelf). diff --git a/src/elflint.c b/src/elflint.c index 9915a54..66f2ccd 100644 --- a/src/elflint.c +++ b/src/elflint.c @@ -932,15 +932,16 @@ section [%2d] '%s'\n"), destshdr)) { if (ehdr->e_type != ET_REL - && sym->st_value != destshdr->sh_addr) - /* This test is more strict than the psABIs which - usually allow the symbol to be in the middle of - the .got section, allowing negative offsets. */ + && (sym->st_value < destshdr->sh_addr + || (sym->st_value - destshdr->sh_addr + + sym->st_size > destshdr->sh_size))) ERROR (gettext ("\ -section [%2d] '%s': _GLOBAL_OFFSET_TABLE_ symbol value %#" PRIx64 " does not match %s section address %#" PRIx64 "\n"), +section [%2d] '%s': _GLOBAL_OFFSET_TABLE_ symbol value %#" PRIx64 " not inside %s section address range %#" PRIx64 " - %#" PRIx64 "\n"), idx, section_name (ebl, idx), (uint64_t) sym->st_value, - sname, (uint64_t) destshdr->sh_addr); + sname, (uint64_t) destshdr->sh_addr, + (uint64_t) (destshdr->sh_addr + + destshdr->sh_size - 1)); if (!gnuld && sym->st_size != destshdr->sh_size) ERROR (gettext ("\ @@ -3969,6 +3970,7 @@ section [%2d] '%s': unknown core file note type %" PRIu32 case NT_GNU_ABI_TAG: case NT_GNU_HWCAP: case NT_GNU_BUILD_ID: + case NT_GNU_GOLD_VERSION: break; case 0: -- 1.6.2.5
_______________________________________________ elfutils-devel mailing list [email protected] https://fedorahosted.org/mailman/listinfo/elfutils-devel
