This is the mail archive of the binutils@sources.redhat.com 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]

RFA: Don't canonicalize STT_SECTION syms


I received a bug report about processing the output of a commercial linker
(Diab) using objcopy / strip.  This linker merges sections in ld -r, but
does not merge the section symbols.  Instead, the output contains an
STT_SECTION symbol with a non-zero value for the second input section.  Some
relocations point to the first section symbol, others to the second.  After
objcopy, they all point to the first.

My options were to fix the coalescing, by updating relocation addends, or
stop the coalescing.  Which turned out to be much easier.  Tested on
i686-pc-linux-gnu, and on the troublesome input files.

Thanks to Ian for advice about this problem.  Patch OK?

-- 
Daniel Jacobowitz

2004-12-08  Daniel Jacobowitz  <dan@codesourcery.com>

	* elfcode.h (elf_slurp_reloc_table_from_section): Don't canonicalize
	ELF section symbols.

Index: elfcode.h
===================================================================
RCS file: /big/fsf/rsync/src-cvs/src/bfd/elfcode.h,v
retrieving revision 1.59
diff -u -p -r1.59 elfcode.h
--- elfcode.h	25 Nov 2004 02:14:10 -0000	1.59
+++ elfcode.h	8 Dec 2004 21:37:19 -0000
@@ -1293,11 +1293,7 @@ elf_slurp_reloc_table_from_section (bfd 
 	  ps = symbols + ELF_R_SYM (rela.r_info) - 1;
 	  s = *ps;
 
-	  /* Canonicalize ELF section symbols.  FIXME: Why?  */
-	  if ((s->flags & BSF_SECTION_SYM) == 0)
-	    relent->sym_ptr_ptr = ps;
-	  else
-	    relent->sym_ptr_ptr = s->section->symbol_ptr_ptr;
+	  relent->sym_ptr_ptr = ps;
 	}
 
       relent->addend = rela.r_addend;


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