public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* Trivial patch for elf.sc in ld.
@ 1999-09-27  4:23 Geoff Keating
  1999-09-27 18:24 ` Ian Lance Taylor
  0 siblings, 1 reply; 10+ messages in thread
From: Geoff Keating @ 1999-09-27  4:23 UTC (permalink / raw)
  To: rth, binutils

I think this is really self-explanatory.  OK to commit?

-- 
Geoffrey Keating <geoffk@cygnus.com>

===File ~/patches/cygnus/tx49-bin-slinkonce.patch===========
md5sum: 01c7f288ab65b2dc 1f8b47196257f7c3 348219
Index: binutils/ld/ChangeLog
0a
Wed Sep 22 12:42:36 1999  Geoffrey Keating  <geoffk@cygnus.com>

	* scripttempl/elf.sc (.sdata): Include .gnu.linkonce.s.* sections
	in .sdata too.

.
Changed files:
binutils/ld/ChangeLog
binutils/ld/scripttempl/elf.sc
md5sum: 86ddf7df91f7b761 c5d23ef89c14ef71 10785
--- /sloth/disk0/co/binutils-mainline/binutils/ld/scripttempl/elf.sc	Mon Sep 27 18:29:33 1999
+++ binutils/ld/scripttempl/elf.sc	Mon Sep 27 19:45:02 1999
@@ -232,7 +232,7 @@ cat <<EOF
   /* We want the small data sections together, so single-instruction offsets
      can access them all, and initialized data all before uninitialized, so
      we can shorten the on-disk segment size.  */
-  .sdata   ${RELOCATING-0} : { *(.sdata) *(.sdata.*) }
+  .sdata   ${RELOCATING-0} : { *(.sdata) *(.sdata.*) *(.gnu.linkonce.s.*) }
   ${RELOCATING+${OTHER_GOT_SECTIONS}}
   ${RELOCATING+_edata = .;}
   ${RELOCATING+PROVIDE (edata = .);}
============================================================

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

* Re: Trivial patch for elf.sc in ld.
  1999-09-27  4:23 Trivial patch for elf.sc in ld Geoff Keating
@ 1999-09-27 18:24 ` Ian Lance Taylor
  1999-09-27 21:30   ` Geoff Keating
  0 siblings, 1 reply; 10+ messages in thread
From: Ian Lance Taylor @ 1999-09-27 18:24 UTC (permalink / raw)
  To: geoffk; +Cc: rth, binutils

   Date: Mon, 27 Sep 1999 21:11:24 +1000
   From: Geoff Keating <geoffk@ozemail.com.au>

   I think this is really self-explanatory.  OK to commit?

   Wed Sep 22 12:42:36 1999  Geoffrey Keating  <geoffk@cygnus.com>

	   * scripttempl/elf.sc (.sdata): Include .gnu.linkonce.s.* sections
	   in .sdata too.

This only makes sense if the compiler has been modified to generate
such sections.

Note that for the other linkonce sections the default ELF linker
script uses names like .gnu.linkonce.d*.  That is, it does not assume
a dot after the 'd'.

If the compiler generates .gnu.linkonce sections for .sdata sections,
and the trailing dot is correct, then I have no objection to this
patch.

Ian

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

* Re: Trivial patch for elf.sc in ld.
  1999-09-27 18:24 ` Ian Lance Taylor
@ 1999-09-27 21:30   ` Geoff Keating
  1999-09-27 21:42     ` Richard Henderson
  1999-09-28  6:26     ` Ian Lance Taylor
  0 siblings, 2 replies; 10+ messages in thread
From: Geoff Keating @ 1999-09-27 21:30 UTC (permalink / raw)
  To: ian; +Cc: rth, binutils

> Date: 27 Sep 1999 21:23:26 -0400
> From: Ian Lance Taylor <ian@zembu.com>
> CC: rth@cygnus.com, binutils@sourceware.cygnus.com
> 
>    Date: Mon, 27 Sep 1999 21:11:24 +1000
>    From: Geoff Keating <geoffk@ozemail.com.au>
> 
>    I think this is really self-explanatory.  OK to commit?
> 
>    Wed Sep 22 12:42:36 1999  Geoffrey Keating  <geoffk@cygnus.com>
> 
> 	   * scripttempl/elf.sc (.sdata): Include .gnu.linkonce.s.* sections
> 	   in .sdata too.
> 
> This only makes sense if the compiler has been modified to generate
> such sections.
> 
> Note that for the other linkonce sections the default ELF linker
> script uses names like .gnu.linkonce.d*.  That is, it does not assume
> a dot after the 'd'.
> 
> If the compiler generates .gnu.linkonce sections for .sdata sections,
> and the trailing dot is correct, then I have no objection to this
> patch.

It does seem to be correct.  From gcc/config/mips/elf.h:

    { ".text.", ".gnu.linkonce.t." },                                      \
    { ".rodata.", ".gnu.linkonce.r." },                                    \
    { ".data.", ".gnu.linkonce.d." },                                      \
    { ".sdata.", ".gnu.linkonce.s." }                                      \

and similarly in gcc/config/elfos.h.  So the dot is always there.
Probably the other places should have the dot too, in case we ever run
out of letters, but it's not exactly an urgent problem...

OK, I'll commit it.

-- 
Geoffrey Keating <geoffk@cygnus.com>

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

* Re: Trivial patch for elf.sc in ld.
  1999-09-27 21:30   ` Geoff Keating
@ 1999-09-27 21:42     ` Richard Henderson
  1999-09-28  6:26     ` Ian Lance Taylor
  1 sibling, 0 replies; 10+ messages in thread
From: Richard Henderson @ 1999-09-27 21:42 UTC (permalink / raw)
  To: Geoff Keating; +Cc: ian, binutils

On Tue, Sep 28, 1999 at 01:53:40PM +1000, Geoff Keating wrote:
> So the dot is always there.

The dot is there to correspond to the leading dot in ".text".
A link-once section for "foo" would not have the dot.

Anyway, long-term the .gnu.linkonce thing will go away -- in
the drafts from the ABI group they approved section flags to
perform this job cleanly.


r~

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

* Re: Trivial patch for elf.sc in ld.
  1999-09-27 21:30   ` Geoff Keating
  1999-09-27 21:42     ` Richard Henderson
@ 1999-09-28  6:26     ` Ian Lance Taylor
  1999-09-28 20:49       ` Geoff Keating
  1 sibling, 1 reply; 10+ messages in thread
From: Ian Lance Taylor @ 1999-09-28  6:26 UTC (permalink / raw)
  To: geoffk; +Cc: rth, binutils

   Date: Tue, 28 Sep 1999 13:53:40 +1000
   From: Geoff Keating <geoffk@ozemail.com.au>

   >    Wed Sep 22 12:42:36 1999  Geoffrey Keating  <geoffk@cygnus.com>
   > 
   > 	   * scripttempl/elf.sc (.sdata): Include .gnu.linkonce.s.* sections
   > 	   in .sdata too.

   OK, I'll commit it.

Actually, I noticed a problem with your patch.  You include the
.gnu.linkonce section unconditionally, not only when RELOCATING is
set.  You need to fix that to correspond to other inclusions of
.gnu.linkonce sections, as otherwise ld -r will fail.

Ian

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

* Re: Trivial patch for elf.sc in ld.
  1999-09-28  6:26     ` Ian Lance Taylor
@ 1999-09-28 20:49       ` Geoff Keating
  1999-09-28 20:59         ` Ian Lance Taylor
  0 siblings, 1 reply; 10+ messages in thread
From: Geoff Keating @ 1999-09-28 20:49 UTC (permalink / raw)
  To: ian; +Cc: rth, binutils

> Date: 28 Sep 1999 09:25:06 -0400
> From: Ian Lance Taylor <ian@zembu.com>
> CC: rth@cygnus.com, binutils@sourceware.cygnus.com
> 
>    Date: Tue, 28 Sep 1999 13:53:40 +1000
>    From: Geoff Keating <geoffk@ozemail.com.au>
> 
>    >    Wed Sep 22 12:42:36 1999  Geoffrey Keating  <geoffk@cygnus.com>
>    > 
>    > 	   * scripttempl/elf.sc (.sdata): Include .gnu.linkonce.s.* sections
>    > 	   in .sdata too.
> 
>    OK, I'll commit it.
> 
> Actually, I noticed a problem with your patch.  You include the
> .gnu.linkonce section unconditionally, not only when RELOCATING is
> set.  You need to fix that to correspond to other inclusions of
> .gnu.linkonce sections, as otherwise ld -r will fail.

There's a lot of that around.  How about this?  I haven't tested it.

-- 
Geoffrey Keating <geoffk@cygnus.com>

===File ~/patches/cygnus/tx49-bin-sdata.patch===============
md5sum: 9e265fdcbf6c8a74 9503e2f1f2a00ab4 348354
Index: binutils/ld/ChangeLog
0a
1999-09-29  Geoffrey Keating  <geoffk@cygnus.com>

	* scripttempl/elf.sc (.rel.sdata): Combine all the sdata relocs.
	(.rela.sdata): Likewise.
	(.rel.sbss): Likewise.
	(.rela.sbss): Likewise.
	(.sdata): Don't include .gnu.linkonce.s.* or .sdata.* when
	ld -r.
	(.sbss): Do the same things as for .bss.

.
Changed files:
binutils/ld/ChangeLog
binutils/ld/scripttempl/elf.sc
md5sum: c5d23ef89c14ef71 ef7de1eda2241cdc 10806
--- /sloth/disk0/co/binutils-mainline/binutils/ld/scripttempl/elf.sc	Tue Sep 28 14:06:12 1999
+++ binutils/ld/scripttempl/elf.sc	Wed Sep 29 13:39:59 1999
@@ -169,6 +169,20 @@ cat <<EOF
   .rel.got     ${RELOCATING-0} : { *(.rel.got)		}
   .rela.got    ${RELOCATING-0} : { *(.rela.got)		}
   ${OTHER_GOT_RELOC_SECTIONS}
+  .rel.sdata   ${RELOCATING-0} :
+    {
+      *(.rel.sdata)
+      ${RELOCATING+*(.rel.sdata.*)}
+      ${RELOCATING+*(.rel.gnu.linkonce.s*)}
+    }
+  .rela.sdata   ${RELOCATING-0} :
+    {
+      *(.rela.sdata)
+      ${RELOCATING+*(.rela.sdata.*)}
+      ${RELOCATING+*(.rela.gnu.linkonce.s*)}
+    }
+  .rel.sbss    ${RELOCATING-0} : { *(.rel.sbss)		}
+  .rela.sbss   ${RELOCATING-0} : { *(.rela.sbss)	}
   .rel.bss     ${RELOCATING-0} : { *(.rel.bss)		}
   .rela.bss    ${RELOCATING-0} : { *(.rela.bss)		}
   .rel.plt     ${RELOCATING-0} : { *(.rel.plt)		}
@@ -232,7 +246,13 @@ cat <<EOF
   /* We want the small data sections together, so single-instruction offsets
      can access them all, and initialized data all before uninitialized, so
      we can shorten the on-disk segment size.  */
-  .sdata   ${RELOCATING-0} : { *(.sdata) *(.sdata.*) *(.gnu.linkonce.s.*) }
+  .sdata   ${RELOCATING-0} : 
+  {
+    ${RELOCATING+${SDATA_START_SYMBOLS}}
+    *(.sdata) 
+    ${RELOCATING+*(.sdata.*)}
+    ${RELOCATING+*(.gnu.linkonce.s.*)}
+  }
   ${RELOCATING+${OTHER_GOT_SECTIONS}}
   ${RELOCATING+_edata = .;}
   ${RELOCATING+PROVIDE (edata = .);}
@@ -240,8 +260,10 @@ cat <<EOF
   ${RELOCATING+${OTHER_BSS_SYMBOLS}}
   .sbss    ${RELOCATING-0} :
   {
-   *(.sbss) *(.scommon)
-   ${RELOCATING+*(.sbss.*)}
+    *(.dynsbss)
+    *(.sbss)
+    ${RELOCATING+*(.sbss.*)}
+    *(.scommon)
   }
   .bss     ${RELOCATING-0} :
   {
============================================================

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

* Re: Trivial patch for elf.sc in ld.
  1999-09-28 20:49       ` Geoff Keating
@ 1999-09-28 20:59         ` Ian Lance Taylor
  1999-09-28 21:50           ` Geoff Keating
  0 siblings, 1 reply; 10+ messages in thread
From: Ian Lance Taylor @ 1999-09-28 20:59 UTC (permalink / raw)
  To: geoffk; +Cc: rth, binutils

   Date: Wed, 29 Sep 1999 13:48:05 +1000
   From: Geoff Keating <geoffk@ozemail.com.au>

   1999-09-29  Geoffrey Keating  <geoffk@cygnus.com>

	   * scripttempl/elf.sc (.rel.sdata): Combine all the sdata relocs.
	   (.rela.sdata): Likewise.
	   (.rel.sbss): Likewise.
	   (.rela.sbss): Likewise.
	   (.sdata): Don't include .gnu.linkonce.s.* or .sdata.* when
	   ld -r.
	   (.sbss): Do the same things as for .bss.

Your patch introduces some things you didn't mention in the ChangeLog
entry: SDATA_START_SYMBOLS and .dynsbss.  I don't know why you need
either of them.  .dynsbss in particular sounds odd; does anything
create that section?

Otherwise this is OK.

Ian

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

* Re: Trivial patch for elf.sc in ld.
  1999-09-28 20:59         ` Ian Lance Taylor
@ 1999-09-28 21:50           ` Geoff Keating
  1999-09-28 21:52             ` Ian Lance Taylor
  0 siblings, 1 reply; 10+ messages in thread
From: Geoff Keating @ 1999-09-28 21:50 UTC (permalink / raw)
  To: ian; +Cc: rth, binutils

> Date: 28 Sep 1999 23:58:48 -0400
> From: Ian Lance Taylor <ian@zembu.com>
> CC: rth@cygnus.com, binutils@sourceware.cygnus.com
> 
>    Date: Wed, 29 Sep 1999 13:48:05 +1000
>    From: Geoff Keating <geoffk@ozemail.com.au>
> 
>    1999-09-29  Geoffrey Keating  <geoffk@cygnus.com>
> 
> 	   * scripttempl/elf.sc (.rel.sdata): Combine all the sdata relocs.
> 	   (.rela.sdata): Likewise.
> 	   (.rel.sbss): Likewise.
> 	   (.rela.sbss): Likewise.
> 	   (.sdata): Don't include .gnu.linkonce.s.* or .sdata.* when
> 	   ld -r.
> 	   (.sbss): Do the same things as for .bss.
> 
> Your patch introduces some things you didn't mention in the ChangeLog
> entry: SDATA_START_SYMBOLS and .dynsbss.  I don't know why you need
> either of them.  .dynsbss in particular sounds odd; does anything
> create that section?

It's created by at least the powerpc linker (which doesn't use this
ldscript), and I expect it needs to be created by every ELF target
with shared libraries and .sdata.

It's needed when you have

extern int foo;

/* do something with foo */

in an application and 'foo' is in a shared library and an 'extern int'
would usually be in the sdata section; you'd normally put such a
symbol in .dynbss.

SDATA_START_SYMBOLS is just there for consistency.

-- 
Geoffrey Keating <geoffk@cygnus.com>

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

* Re: Trivial patch for elf.sc in ld.
  1999-09-28 21:50           ` Geoff Keating
@ 1999-09-28 21:52             ` Ian Lance Taylor
  1999-10-06 19:17               ` Geoff Keating
  0 siblings, 1 reply; 10+ messages in thread
From: Ian Lance Taylor @ 1999-09-28 21:52 UTC (permalink / raw)
  To: geoffk; +Cc: rth, binutils

   Date: Wed, 29 Sep 1999 14:37:22 +1000
   From: Geoff Keating <geoffk@ozemail.com.au>

   It's created by at least the powerpc linker (which doesn't use this
   ldscript), and I expect it needs to be created by every ELF target
   with shared libraries and .sdata.

   It's needed when you have

   extern int foo;

   /* do something with foo */

   in an application and 'foo' is in a shared library and an 'extern int'
   would usually be in the sdata section; you'd normally put such a
   symbol in .dynbss.

   SDATA_START_SYMBOLS is just there for consistency.

OK.

You need to mention them in ChangeLog.

Ian

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

* Re: Trivial patch for elf.sc in ld.
  1999-09-28 21:52             ` Ian Lance Taylor
@ 1999-10-06 19:17               ` Geoff Keating
  0 siblings, 0 replies; 10+ messages in thread
From: Geoff Keating @ 1999-10-06 19:17 UTC (permalink / raw)
  To: ian; +Cc: rth, binutils

> Mailing-List: contact binutils-help@sourceware.cygnus.com; run by ezmlm
> List-Unsubscribe: < mailto:binutils-unsubscribe-geoffk=cygnus.com@sourceware.cygnus.com >
> List-Subscribe: < mailto:binutils-subscribe@sourceware.cygnus.com >
> List-Archive: < http://sourceware.cygnus.com/ml/binutils/ >
> List-Post: < mailto:binutils@sourceware.cygnus.com >
> List-Help: < mailto:binutils-help@sourceware.cygnus.com >, < http://sourceware.cygnus.com/ml/#faqs >
> Date: 29 Sep 1999 00:51:22 -0400
> From: Ian Lance Taylor <ian@zembu.com>
...
>    SDATA_START_SYMBOLS is just there for consistency.
> 
> OK.
> 
> You need to mention them in ChangeLog.

OK.  I committed with a modified ChangeLog.

-- 
Geoffrey Keating <geoffk@cygnus.com>

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

end of thread, other threads:[~1999-10-06 19:17 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-09-27  4:23 Trivial patch for elf.sc in ld Geoff Keating
1999-09-27 18:24 ` Ian Lance Taylor
1999-09-27 21:30   ` Geoff Keating
1999-09-27 21:42     ` Richard Henderson
1999-09-28  6:26     ` Ian Lance Taylor
1999-09-28 20:49       ` Geoff Keating
1999-09-28 20:59         ` Ian Lance Taylor
1999-09-28 21:50           ` Geoff Keating
1999-09-28 21:52             ` Ian Lance Taylor
1999-10-06 19:17               ` Geoff Keating

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