public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* PATCH for IRIX6/linkonce sections
@ 1999-07-18 22:03 Mark P. Mitchell
  1999-07-19  9:37 ` Ian Lance Taylor
  0 siblings, 1 reply; 5+ messages in thread
From: Mark P. Mitchell @ 1999-07-18 22:03 UTC (permalink / raw)
  To: binutils

In order to get linkonce sections working on IRIX6, we need something like
the following patch.  It's ugly to put this is elf.sc, but putting
it in elf32bmipn32.sh didn't work because RELOCATING is not defined
at the point that file is sourced.  (Another approach would be to change
that, but that change would be obtrusive, and could subtly affect other
emulations.)

OK to check in?

--

Sun Jul 18 23:00:52 1999  Mark P. Mitchell  <mark@codesourcery.com>

	* scripttempl/elf.sc: Handle .MIPS.events and .MIPS.content sections
	in conjunction with linkonce sections.

Index: scripttempl/elf.sc
===================================================================
RCS file: /cvs/binutils/binutils/ld/scripttempl/elf.sc,v
retrieving revision 1.3
diff -c -p -r1.3 elf.sc
*** elf.sc	1999/07/14 16:45:54	1.3
--- elf.sc	1999/07/19 05:00:33
*************** SECTIONS
*** 279,284 ****
--- 279,322 ----
    .debug_typenames 0 : { *(.debug_typenames) }
    .debug_varnames  0 : { *(.debug_varnames) }
  
+   /* SGI extensions.  */
+   .MIPS.events.text ${RELOCATING-0} : 
+     {
+        *(.MIPS.events.text)
+        *(.MIPS.events.text.*)
+        ${RELOCATING+*(.MIPS.events.gnu.linkonce.t*)}
+     }
+   .MIPS.content.text ${RELOCATING-0} : 
+     {
+        *(.MIPS.content.text)
+        *(.MIPS.content.text*)
+        ${RELOCATING+*(.MIPS.content.gnu.linkonce.t*)}
+     }
+   .MIPS.events.data ${RELOCATING-0} : 
+     {
+        *(.MIPS.events.data)
+        *(.MIPS.events.data.*)
+        ${RELOCATING+*(.MIPS.events.gnu.linkonce.d*)}
+     }
+   .MIPS.content.data ${RELOCATING-0} : 
+     {
+        *(.MIPS.content.data)
+        *(.MIPS.content.data*)
+        ${RELOCATING+*(.MIPS.content.gnu.linkonce.d*)}
+     }
+   .MIPS.events.rodata ${RELOCATING-0} : 
+     {
+        *(.MIPS.events.rodata)
+        *(.MIPS.events.rodata.*)
+        ${RELOCATING+*(.MIPS.events.gnu.linkonce.r*)}
+     }
+   .MIPS.content.rodata ${RELOCATING-0} : 
+     {
+        *(.MIPS.content.rodata)
+        *(.MIPS.content.rodata*)
+        ${RELOCATING+*(.MIPS.content.gnu.linkonce.r*)}
+     }
+ 
    ${RELOCATING+${OTHER_RELOCATING_SECTIONS}}
  
    /* These must appear regardless of ${RELOCATING}.  */

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

* Re: PATCH for IRIX6/linkonce sections
  1999-07-18 22:03 PATCH for IRIX6/linkonce sections Mark P. Mitchell
@ 1999-07-19  9:37 ` Ian Lance Taylor
  1999-07-19  9:45   ` Mark Mitchell
  0 siblings, 1 reply; 5+ messages in thread
From: Ian Lance Taylor @ 1999-07-19  9:37 UTC (permalink / raw)
  To: mark; +Cc: binutils

   Date: Sun, 18 Jul 1999 23:03:33 -0600 (MDT)
   From: "Mark P. Mitchell" <mark@codesourcery.com>

   In order to get linkonce sections working on IRIX6, we need something like
   the following patch.  It's ugly to put this is elf.sc, but putting
   it in elf32bmipn32.sh didn't work because RELOCATING is not defined
   at the point that file is sourced.  (Another approach would be to change
   that, but that change would be obtrusive, and could subtly affect other
   emulations.)

This sort of thing is what OTHER_RELOCATING_SECTIONS is for.  Will it
work to just define that in elf32bmipn32.sh?

Ian

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

* Re: PATCH for IRIX6/linkonce sections
  1999-07-19  9:37 ` Ian Lance Taylor
@ 1999-07-19  9:45   ` Mark Mitchell
  1999-07-19 12:14     ` Ian Lance Taylor
  0 siblings, 1 reply; 5+ messages in thread
From: Mark Mitchell @ 1999-07-19  9:45 UTC (permalink / raw)
  To: ian; +Cc: binutils

>>>>> "Ian" == Ian Lance Taylor <ian@zembu.com> writes:

    Ian> This sort of thing is what OTHER_RELOCATING_SECTIONS is for.
    Ian> Will it work to just define that in elf32bmipn32.sh?

I don't think so, but perhaps I'm wrong.

You'll have to help me a little bit.  In the rest of elf.sc, all of
the linkonce things are handled roughly like:

  .data ${RELOCATING-0} : {
    *(.data)
    *(.data*)
    ${RELOCATING+*(.gnu.linkonce.d*)
  }

In other words, some combination happens even when producing a
relocateable object (the first two lines); some other combination
happens only when RELOCATING (i.e., when producing a non-relocateable
object) in the last line.

I think the .MIPS.events/.MIPS.content stuff needs to be handled
analagously.  So, OTHER_RELOCATING_SECTIONS isn't good enough; it
doesn't apply when not relocating.

--
Mark Mitchell                   mark@codesourcery.com
CodeSourcery, LLC               http://www.codesourcery.com

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

* Re: PATCH for IRIX6/linkonce sections
  1999-07-19  9:45   ` Mark Mitchell
@ 1999-07-19 12:14     ` Ian Lance Taylor
  1999-07-19 12:30       ` Mark Mitchell
  0 siblings, 1 reply; 5+ messages in thread
From: Ian Lance Taylor @ 1999-07-19 12:14 UTC (permalink / raw)
  To: mark; +Cc: binutils

   From: Mark Mitchell <mark@codesourcery.com>
   Date: Mon, 19 Jul 1999 09:48:39 -0700

   >>>>> "Ian" == Ian Lance Taylor <ian@zembu.com> writes:

       Ian> This sort of thing is what OTHER_RELOCATING_SECTIONS is for.
       Ian> Will it work to just define that in elf32bmipn32.sh?

   I don't think so, but perhaps I'm wrong.

   You'll have to help me a little bit.  In the rest of elf.sc, all of
   the linkonce things are handled roughly like:

     .data ${RELOCATING-0} : {
       *(.data)
       *(.data*)
       ${RELOCATING+*(.gnu.linkonce.d*)
     }

   In other words, some combination happens even when producing a
   relocateable object (the first two lines); some other combination
   happens only when RELOCATING (i.e., when producing a non-relocateable
   object) in the last line.

   I think the .MIPS.events/.MIPS.content stuff needs to be handled
   analagously.  So, OTHER_RELOCATING_SECTIONS isn't good enough; it
   doesn't apply when not relocating.

The .data* stuff doesn't have anything to do with .gnu.linkonce
sections.  That is there to handle cases in COFF where the relocation
count for a section overflows, and so multiple sections must be built
when generating a relocateable object file.

You probably do not need any equivalent to *(.data*) in your MIPS ELF
specific sections.

So that leaves us with

     .data ${RELOCATING-0} : {
       *(.data)
       ${RELOCATING+*(.gnu.linkonce.d*)
     }

If you don't name a input section in a linker script at all, the
default is to combine all the input sections of that name into an
output section of the same name.

So you shouldn't need any special behaviour when doing a relocateable
link.  You should only need special behaviour (including the
.gnu.linkonce sections) when doing a final link.  Therefore, it should
work to use OTHER_RELOCATING_SECTIONS, and use definitions which are
the equivalent of

     .data ${RELOCATING-0} : {
       *(.data)
       *(.gnu.linkonce.d*)
     }

In any case, if my argument is wrong somewhere, I think it would be
better to create something analogous to OTHER_RELOCATING_SECTIONS.
For example, you could define OTHER_RELOCATEABLE_SECTIONS or
something, and then define both with various duplications.

Ian

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

* Re: PATCH for IRIX6/linkonce sections
  1999-07-19 12:14     ` Ian Lance Taylor
@ 1999-07-19 12:30       ` Mark Mitchell
  0 siblings, 0 replies; 5+ messages in thread
From: Mark Mitchell @ 1999-07-19 12:30 UTC (permalink / raw)
  To: ian; +Cc: binutils

>>>>> "Ian" == Ian Lance Taylor <ian@zembu.com> writes:

    Ian> You probably do not need any equivalent to *(.data*) in your
    Ian> MIPS ELF specific sections.

That was the bit I did not understand.  I really wish that either I
was smarter or that there was a bit more commentary in BFD.  I'll add
a comment about this in elf.sc.

    Ian> So that leaves us with

    Ian>      .data ${RELOCATING-0} : { *(.data)
    Ian> ${RELOCATING+*(.gnu.linkonce.d*) }

    Ian> If you don't name a input section in a linker script at all,
    Ian> the default is to combine all the input sections of that name
    Ian> into an output section of the same name.

Right.  So, I agree, we can do this with OTHER_RELOCATING_SECTIONS.
I'll check in the appropriate change.

--
Mark Mitchell                   mark@codesourcery.com
CodeSourcery, LLC               http://www.codesourcery.com

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

end of thread, other threads:[~1999-07-19 12:30 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-07-18 22:03 PATCH for IRIX6/linkonce sections Mark P. Mitchell
1999-07-19  9:37 ` Ian Lance Taylor
1999-07-19  9:45   ` Mark Mitchell
1999-07-19 12:14     ` Ian Lance Taylor
1999-07-19 12:30       ` Mark Mitchell

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).