public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Daniel Jacobowitz <drow@false.org>
To: binutils@sources.redhat.com
Subject: RFA: Don't canonicalize STT_SECTION syms
Date: Wed, 08 Dec 2004 21:50:00 -0000	[thread overview]
Message-ID: <20041208215011.GA8795@nevyn.them.org> (raw)

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;

             reply	other threads:[~2004-12-08 21:50 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-12-08 21:50 Daniel Jacobowitz [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20041208215011.GA8795@nevyn.them.org \
    --to=drow@false.org \
    --cc=binutils@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).