This is the mail archive of the elfutils-devel@sourceware.org mailing list for the elfutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: elflint versus gnu gold


On Sat, 2009-07-25 at 16:55 -0700, Roland McGrath wrote:
> Those seem like two separate changes.  Please make them separate patches.

OK, attached the relaxation of the _GLOBAL_OFFSET_TABLE_ check.

> Also update libebl/eblobjnotetypename.c for NT_GNU_GOLD_VERSION.  
> elf.h always comes verbatim from libc, so post the elf.h patch alone to
> libc-alpha(a)sourceware.

Sent. When it gets accepted the next attached patch merges elf.h. And
then finally adds it to eblobjnotetypename.c and recognizes it in
elflint.c

Cheers,

Mark
>From 5c0ef1786be924ad632ba321bdb69ea7a3a7c8ab Mon Sep 17 00:00:00 2001
From: Mark Wielaard <mjw@redhat.com>
Date: Sun, 26 Jul 2009 08:30:14 +0200
Subject: [PATCH 1/3] elflint.c (check_symtab): Allow _GLOBAL_OFFSET_TABLE_ inside got section.

---
 src/ChangeLog |    5 +++++
 src/elflint.c |   13 +++++++------
 2 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/src/ChangeLog b/src/ChangeLog
index 88e0c11..9044734 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,8 @@
+2009-07-26  Mark Wielaard  <mjw@redhat.com>
+
+	* elflint.c (check_symtab): Allow _GLOBAL_OFFSET_TABLE_ inside
+	got section.
+
 2009-07-25  Mark Wielaard  <mjw@redhat.com>
 
 	* Makefile.am (addr2line_LDADD): Add $(libelf).
diff --git a/src/elflint.c b/src/elflint.c
index 9915a54..5c37d57 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 ("\
-- 
1.6.2.5

>From 00d093b7a71e9c596a133a3f4737f23bb2714069 Mon Sep 17 00:00:00 2001
From: Mark Wielaard <mjw@redhat.com>
Date: Sun, 26 Jul 2009 08:32:03 +0200
Subject: [PATCH 2/3] elf.h: Update from glibc.

---
 libelf/ChangeLog |    4 ++++
 libelf/elf.h     |    2 ++
 2 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/libelf/ChangeLog b/libelf/ChangeLog
index d6f3415..50a86f8 100644
--- a/libelf/ChangeLog
+++ b/libelf/ChangeLog
@@ -1,3 +1,7 @@
+2009-07-26  Mark Wielaard  <mjw@redhat.com>
+
+	* elf.h: Update from glibc.
+
 2009-07-21  Ulrich Drepper  <drepper@redhat.com>
 
 	* 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
-- 
1.6.2.5

>From 094b5e85277cbb9c0a64b12d5796825fe973491b Mon Sep 17 00:00:00 2001
From: Mark Wielaard <mjw@redhat.com>
Date: Sun, 26 Jul 2009 08:36:59 +0200
Subject: [PATCH 3/3] Recognize NT_GNU_GOLD_VERSION in libebl and elflint.

---
 libebl/ChangeLog            |    5 +++++
 libebl/eblobjnotetypename.c |    1 +
 src/ChangeLog               |    4 ++++
 src/elflint.c               |    1 +
 4 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/libebl/ChangeLog b/libebl/ChangeLog
index 837a4d1..46a58c7 100644
--- a/libebl/ChangeLog
+++ b/libebl/ChangeLog
@@ -1,3 +1,8 @@
+2009-07-26  Mark Wielaard  <mjw@redhat.com>
+
+	* eblobjnotetypename.c (ebl_object_note_type_name): Recognize
+	NT_GNU_GOLD_VERSION.
+
 2009-07-08  Roland McGrath  <roland@redhat.com>
 
 	* ebl-hooks.h: Add abi_cfi hook.
diff --git a/libebl/eblobjnotetypename.c b/libebl/eblobjnotetypename.c
index ff9330f..1a54473 100644
--- a/libebl/eblobjnotetypename.c
+++ b/libebl/eblobjnotetypename.c
@@ -74,6 +74,7 @@ ebl_object_note_type_name (ebl, type, buf, len)
 	  KNOWNSTYPE (VERSION),
 	  KNOWNSTYPE (GNU_HWCAP),
 	  KNOWNSTYPE (GNU_BUILD_ID),
+	  KNOWNSTYPE (GNU_GOLD_VERSION),
 	};
 
       /* Handle standard names.  */
diff --git a/src/ChangeLog b/src/ChangeLog
index 9044734..d2ba639 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,9 @@
 2009-07-26  Mark Wielaard  <mjw@redhat.com>
 
+	* elflint.c (check_note_data): Recognize NT_GNU_GOLD_VERSION.
+
+2009-07-26  Mark Wielaard  <mjw@redhat.com>
+
 	* elflint.c (check_symtab): Allow _GLOBAL_OFFSET_TABLE_ inside
 	got section.
 
diff --git a/src/elflint.c b/src/elflint.c
index 5c37d57..66f2ccd 100644
--- a/src/elflint.c
+++ b/src/elflint.c
@@ -3970,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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]