public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* RFA: Don't canonicalize STT_SECTION syms
@ 2004-12-08 21:50 Daniel Jacobowitz
  2004-12-08 23:57 ` Alan Modra
  2004-12-10  3:15 ` Hans-Peter Nilsson
  0 siblings, 2 replies; 18+ messages in thread
From: Daniel Jacobowitz @ 2004-12-08 21:50 UTC (permalink / raw)
  To: binutils

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;

^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2004-12-11  6:11 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-12-08 21:50 RFA: Don't canonicalize STT_SECTION syms Daniel Jacobowitz
2004-12-08 23:57 ` Alan Modra
2004-12-10  3:15 ` Hans-Peter Nilsson
2004-12-10  3:21   ` Daniel Jacobowitz
2004-12-10 12:14     ` Alan Modra
2004-12-10 12:56       ` Alan Modra
2004-12-10 14:04         ` Alan Modra
2004-12-10 15:14           ` Hans-Peter Nilsson
2004-12-10 15:19             ` Daniel Jacobowitz
2004-12-11  4:21               ` Alan Modra
2004-12-11  4:34                 ` Daniel Jacobowitz
2004-12-11  4:57                   ` Alan Modra
2004-12-11  5:08                     ` Daniel Jacobowitz
2004-12-11  5:32                       ` Alan Modra
2004-12-11  5:38                         ` Daniel Jacobowitz
2004-12-11  5:59                           ` Alan Modra
2004-12-11  6:11                             ` Daniel Jacobowitz
2004-12-11  5:52                         ` Alan Modra

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).