PATCH: PR binutils/4756: addr2line fails on relocatable linux kernel

H.J. Lu hjl@lucon.org
Mon Jul 9 18:56:00 GMT 2007


bfd_simple_get_relocated_section_content shouldn't apply relocations
on executable and shared library with relocations. This patch uses
the same check in binutils/objdump.c.


H.J.
---
2007-07-09  H.J. Lu  <hongjiu.lu@intel.com>

	PR binutils/4756
	* simple.c (bfd_simple_get_relocated_section_content): Don't
	apply relocation on executable and shared library.

--- bfd/simple.c.reloc	2007-07-03 10:51:13.000000000 -0700
+++ bfd/simple.c	2007-07-09 11:28:26.000000000 -0700
@@ -162,7 +162,8 @@ bfd_simple_get_relocated_section_content
   int storage_needed;
   void *saved_offsets;
 
-  if (! (sec->flags & SEC_RELOC))
+  if ((abfd->flags & (HAS_RELOC | EXEC_P | DYNAMIC)) != HAS_RELOC
+      || ! (sec->flags & SEC_RELOC))
     {
       bfd_size_type amt = sec->rawsize > sec->size ? sec->rawsize : sec->size;
       bfd_size_type size = sec->rawsize ? sec->rawsize : sec->size;



More information about the Binutils mailing list