This is the mail archive of the binutils@sourceware.org mailing list for the binutils 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]

PATCH: binutils/1436: "readelf -u" doesn't work on Linux 2.6 kernel modules


Readelf -u doesn't work on relocatable files if there is a relocation
against a section with non-zero address:

http://sources.redhat.com/bugzilla/show_bug.cgi?id=1436

The comment for struct absaddr says

/* An absolute address consists of a section and an offset.  If the
   section is NULL, the offset itself is the address, otherwise, the
   address equals to LOAD_ADDRESS(section) + offset.  */

But it never adjusts for LOAD_ADDRESS(section). This patch does it.


H.J.
----
2005-10-07  H.J. Lu  <hongjiu.lu@intel.com>

	PR binutils/1436
	* readelf.c (ABSADDR): New.
	(dump_ia64_unwind): Use ABSADDR to get the unwind info address.

--- binutils/readelf.c.unw	2005-10-07 09:45:52.000000000 -0700
+++ binutils/readelf.c	2005-10-07 13:18:00.000000000 -0700
@@ -4585,6 +4585,11 @@ struct absaddr
     bfd_vma offset;
   };
 
+#define ABSADDR(a) \
+  ((a).section \
+   ? section_headers [(a).section].sh_addr + (a).offset \
+   : (a).offset)
+
 struct ia64_unw_aux_info
   {
     struct ia64_unw_table_entry
@@ -4677,7 +4682,7 @@ dump_ia64_unwind (struct ia64_unw_aux_in
       printf ("], info at +0x%lx\n",
 	      (unsigned long) (tp->info.offset - aux->seg_base));
 
-      head = aux->info + (tp->info.offset - aux->info_addr);
+      head = aux->info + (ABSADDR (tp->info) - aux->info_addr);
       stamp = byte_get ((unsigned char *) head, sizeof (stamp));
 
       printf ("  v%u, flags=0x%lx (%s%s), len=%lu bytes\n",


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