public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Ian Lance Taylor <ian@zembu.com>
To: mark@codesourcery.com
Cc: binutils@sourceware.cygnus.com
Subject: Re: Your change to ldlang.c
Date: Thu, 01 Jul 1999 20:34:00 -0000	[thread overview]
Message-ID: <19990702033408.27051.qmail@daffy.airs.com> (raw)
In-Reply-To: <19990701203004Q.mitchell@codesourcery.com>

   From: Mark Mitchell <mark@codesourcery.com>
   Date: Thu, 01 Jul 1999 20:30:04 -0700

       Ian> My main concern was that it would mess up relocations.  If an
       Ian> input section disappears, relocations against symbols in that
       Ian> section need to be adjusted to use different symbols, and
       Ian> relocations for that section need to disappear.  I doubt the
       Ian> backends do either of these correctly.

   I see.  Of course, in this case, there are no relocations against the
   section.  

   I guess I don't see why your solution is really any better.  On the
   one hand, we may have bogus relocations.  On the other, we've violated
   the SEC_LINK_ONCE semantics, especially for fixed-sized sections like
   .reginfo. 

It's not clear to me what SEC_LINK_ONCE semantics are in the case of a
relocateable link.  My first reaction when I noticed this was actually
that a relocateable link should keep all the sections, and that the
current behaviour was simply a bug.

SEC_LINK_ONCE was originally meant to be something along the lines of
PE COMDAT sections.  Can anybody check what the Microsoft linker does
when doing a relocateable link with multiple COMDAT sections?

   I guess I'm thinking we should undo your change, and then attack the
   problem of making the back-ends handle the relocations correctly.
   That should not be *that* hard.

It's not trivial, actually, when you consider relocations against
local symbols in a linkonce section.  In some cases those relocations
can simply be removed, as in a debugging section, but in other cases
you need to actually modify the relocation to a different section.  I
think every backend would have to be modified.

       Ian> We could go back to letting the emultempl file handle the
       Ian> .reginfo sections for MIPS files when doing a relocateable
       Ian> link, I suppose.  Does anybody have a better suggestion?

   I don't know what you mean by this suggestion.  I guess I'm too new to
   binutils-land.  Could you elaborate on the emultempl file solution?

Until quite recently (February 1999), .reginfo sections were not
marked as LINK_ONCE, and they were instead handled in the emultempl
file.  The special handling was removed by this patch:

Wed Feb 17 12:10:06 1999  Stan Cox  <scox@cygnus.com>

	* mpw-elfmips.c (gldelf32ebmip_before_allocation): Remove special
	.reginfo section handling. 
	* emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): Likewise.
	* emulparams/elf32elmip.sh (INITIAL_READONLY_SECTIONS): Removed
	* emulparams/elf32ebmip.sh (INITIAL_READONLY_SECTIONS): Removed

Index: elf32.em
===================================================================
RCS file: /cvs/cvsfiles/devo/ld/emultempl/elf32.em,v
retrieving revision 1.57
retrieving revision 1.58
diff -u -r1.57 -r1.58
--- elf32.em	1998/09/20 04:16:36	1.57
+++ elf32.em	1999/02/17 19:58:05	1.58
@@ -762,37 +762,6 @@
 	s->_raw_size = 0;
       }
   }
-
-#if defined (TARGET_IS_elf32bmip) || defined (TARGET_IS_elf32lmip)
-  /* For MIPS ELF the .reginfo section requires special handling.
-     Each input section is 24 bytes, and the final output section must
-     also be 24 bytes.  We handle this by clobbering all but the first
-     input section size to 0.  The .reginfo section is handled
-     specially by the backend code anyhow.  */
-  {
-    boolean found = false;
-    LANG_FOR_EACH_INPUT_STATEMENT (is)
-      {
-	asection *s;
-
-	if (is->just_syms_flag)
-	  continue;
-
-	s = bfd_get_section_by_name (is->the_bfd, ".reginfo");
-	if (s == NULL)
-	  continue;
-
-	if (! found)
-	  {
-	    found = true;
-	    continue;
-	  }
-
-	s->_raw_size = 0;
-	s->_cooked_size = 0;
-      }
-  }
-#endif
 }
 
 /* This is called by the before_allocation routine via

  reply	other threads:[~1999-07-01 20:34 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-07-01 17:54 Mark Mitchell
1999-07-01 19:43 ` Ian Lance Taylor
1999-07-01 20:25   ` Mark Mitchell
1999-07-01 20:34     ` Ian Lance Taylor [this message]
1999-07-01 23:12       ` Mark Mitchell
1999-07-01 23:51         ` H.J. Lu
1999-07-02  7:27           ` Ian Lance Taylor
1999-07-02 16:31             ` Ralf Baechle
1999-07-02  1:00         ` Mikey
1999-07-02  7:25           ` Ian Lance Taylor
1999-07-02  7:40         ` Ian Lance Taylor
1999-07-02 10:30           ` Mark Mitchell
1999-07-06 18:35           ` Richard Henderson

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=19990702033408.27051.qmail@daffy.airs.com \
    --to=ian@zembu.com \
    --cc=binutils@sourceware.cygnus.com \
    --cc=mark@codesourcery.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).