public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* mips elf n32 and 64 linker emulparams refactoring
@ 2002-10-13 14:55 Alexandre Oliva
  2002-10-16 17:14 ` Eric Christopher
  2002-10-18 11:42 ` Thiemo Seufer
  0 siblings, 2 replies; 13+ messages in thread
From: Alexandre Oliva @ 2002-10-13 14:55 UTC (permalink / raw)
  To: binutils

[-- Attachment #1: Type: text/plain, Size: 307 bytes --]

This patch simplifies some of the mips emulation parameters such that
there is more sharing.  I've almost created a separate file for the
IRIX-compatible emulations, but I ended up thinking it was not worth
the trouble for a single definition of WRITABLE_RODATA, and stopped at
this point.  Ok to install?


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: mips-ld-emulparams.patch --]
[-- Type: text/x-patch, Size: 6438 bytes --]

Index: ld/ChangeLog
from  Alexandre Oliva  <aoliva@redhat.com>

	* emulparams/elf32bmipn32-defs.sh (LIB_PATH): Set to /usr/lib32.
	(GENERATE_SHLIB_SCRIPT): Set to yes.
	(EXECUTABLE_SYMBOLS, WRITABLE_RODATA): Moved to...
	* emulparams/elf32bmipn32.sh: here.
	(GENERATE_SHLIB_SCRIPT): Deleted as redundant.
	* emulparams/elf32btsmipn32.sh: Delete redundant unsets.
	* emulparams/elf64bmip-defs.sh: New file.  Extend
	elf32bmipn32-defs.sh by overiding ELFSIZE and LIB_PATH.
	* emulparams/elf64bmip.sh: Bring in definitions from
	elf64bmip-defs.sh.
	(ELFSIZE, GENERATE_SHLIB_SCRIPT, LIB_PATH): Delete redundant
	settings.
	(WRITABLE_RODATA): Moved from elf32bmipn32-defs.sh.
	* emulparams/elf64btsmip.sh: Bring in definitions from
	elf64bmip-defs.sh.
	(ELFSIZE, GENERATE_SHLIB_SCRIPT): Delete, redundant.
	(EXECUTABLE_SYMBOLS, WRITABLE_RODATA): Delete redundant unsets.

Index: ld/emulparams/elf32bmipn32-defs.sh
===================================================================
RCS file: /cvs/src/src/ld/emulparams/elf32bmipn32-defs.sh,v
retrieving revision 1.1
diff -u -p -r1.1 elf32bmipn32-defs.sh
--- ld/emulparams/elf32bmipn32-defs.sh 18 Sep 2002 01:54:37 -0000 1.1
+++ ld/emulparams/elf32bmipn32-defs.sh 13 Oct 2002 21:54:32 -0000
@@ -11,6 +11,9 @@ BIG_OUTPUT_FORMAT="elf32-bigmips"
 LITTLE_OUTPUT_FORMAT="elf32-littlemips"
 
 TEMPLATE_NAME=elf32
+LIB_PATH=/usr/lib32
+
+GENERATE_SHLIB_SCRIPT=yes
 
 TEXT_START_ADDR=0x10000000
 MAXPAGESIZE=0x100000
@@ -30,19 +33,6 @@ OTHER_SDATA_SECTIONS="
 TEXT_START_SYMBOLS='_ftext = . ;'
 DATA_START_SYMBOLS='_fdata = . ;'
 OTHER_BSS_SYMBOLS='_fbss = .;'
-# IRIX6 defines these symbols.  0x34 is the size of the ELF header.
-EXECUTABLE_SYMBOLS="
-  __dso_displacement = 0;
-  __elf_header = ${TEXT_START_ADDR};
-  __program_header_table = ${TEXT_START_ADDR} + 0x34;
-"
-
-# There are often dynamic relocations against the .rodata section.
-# Setting DT_TEXTREL in the .dynamic section does not convince the
-# IRIX6 linker to permit relocations against the text segment.
-# Following the IRIX linker, we simply put .rodata in the data
-# segment.
-WRITABLE_RODATA=
 
 OTHER_SECTIONS="
   .MIPS.events.text ${RELOCATING-0} :
Index: ld/emulparams/elf32bmipn32.sh
===================================================================
RCS file: /cvs/src/src/ld/emulparams/elf32bmipn32.sh,v
retrieving revision 1.6
diff -u -p -r1.6 elf32bmipn32.sh
--- ld/emulparams/elf32bmipn32.sh 18 Sep 2002 01:54:37 -0000 1.6
+++ ld/emulparams/elf32bmipn32.sh 13 Oct 2002 21:54:32 -0000
@@ -2,5 +2,18 @@
 OUTPUT_FORMAT="elf32-nbigmips"
 BIG_OUTPUT_FORMAT="elf32-nbigmips"
 LITTLE_OUTPUT_FORMAT="elf32-nlittlemips"
-GENERATE_SHLIB_SCRIPT=yes
 SHLIB_TEXT_START_ADDR=0x5ffe0000
+
+# IRIX6 defines these symbols.  0x34 is the size of the ELF header.
+EXECUTABLE_SYMBOLS="
+  __dso_displacement = 0;
+  __elf_header = ${TEXT_START_ADDR};
+  __program_header_table = ${TEXT_START_ADDR} + 0x34;
+"
+
+# There are often dynamic relocations against the .rodata section.
+# Setting DT_TEXTREL in the .dynamic section does not convince the
+# IRIX6 linker to permit relocations against the text segment.
+# Following the IRIX linker, we simply put .rodata in the data
+# segment.
+WRITABLE_RODATA=
Index: ld/emulparams/elf32btsmipn32.sh
===================================================================
RCS file: /cvs/src/src/ld/emulparams/elf32btsmipn32.sh,v
retrieving revision 1.2
diff -u -p -r1.2 elf32btsmipn32.sh
--- ld/emulparams/elf32btsmipn32.sh 18 Sep 2002 01:54:37 -0000 1.2
+++ ld/emulparams/elf32btsmipn32.sh 13 Oct 2002 21:54:32 -0000
@@ -6,10 +6,6 @@ OUTPUT_FORMAT="elf32-ntradbigmips"
 BIG_OUTPUT_FORMAT="elf32-ntradbigmips"
 LITTLE_OUTPUT_FORMAT="elf32-ntradlittlemips"
 
-unset EXECUTABLE_SYMBOLS
-unset WRITABLE_RODATA
-unset SHLIB_TEXT_START_ADDR
-
 # Magic sections.
 OTHER_TEXT_SECTIONS='*(.mips16.fn.*) *(.mips16.call.*)'
 OTHER_SECTIONS='
Index: ld/emulparams/elf64bmip-defs.sh
===================================================================
RCS file: ld/emulparams/elf64bmip-defs.sh
diff -N ld/emulparams/elf64bmip-defs.sh
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ ld/emulparams/elf64bmip-defs.sh 13 Oct 2002 21:54:32 -0000
@@ -0,0 +1,6 @@
+# If you change this file, please also look at files which source this one:
+# elf64bmip.sh and elf64btsmip.sh
+
+. ${srcdir}/emulparams/elf32bmipn32-defs.sh
+ELFSIZE=64
+LIB_PATH=/usr/lib64
Index: ld/emulparams/elf64bmip.sh
===================================================================
RCS file: /cvs/src/src/ld/emulparams/elf64bmip.sh,v
retrieving revision 1.5
diff -u -p -r1.5 elf64bmip.sh
--- ld/emulparams/elf64bmip.sh 18 Sep 2002 01:54:37 -0000 1.5
+++ ld/emulparams/elf64bmip.sh 13 Oct 2002 21:54:32 -0000
@@ -1,10 +1,7 @@
-. ${srcdir}/emulparams/elf32bmipn32-defs.sh
+. ${srcdir}/emulparams/elf64bmip-defs.sh
 OUTPUT_FORMAT="elf64-bigmips"
 BIG_OUTPUT_FORMAT="elf64-bigmips"
 LITTLE_OUTPUT_FORMAT="elf64-littlemips"
-ELFSIZE=64
-GENERATE_SHLIB_SCRIPT=yes
-LIB_PATH=/usr/lib64
 
 # IRIX6 defines these symbols.  0x40 is the size of the ELF header.
 EXECUTABLE_SYMBOLS="
@@ -12,3 +9,10 @@ EXECUTABLE_SYMBOLS="
   __elf_header = ${TEXT_START_ADDR};
   __program_header_table = ${TEXT_START_ADDR} + 0x40;
 "
+
+# There are often dynamic relocations against the .rodata section.
+# Setting DT_TEXTREL in the .dynamic section does not convince the
+# IRIX6 linker to permit relocations against the text segment.
+# Following the IRIX linker, we simply put .rodata in the data
+# segment.
+WRITABLE_RODATA=
Index: ld/emulparams/elf64btsmip.sh
===================================================================
RCS file: /cvs/src/src/ld/emulparams/elf64btsmip.sh,v
retrieving revision 1.6
diff -u -p -r1.6 elf64btsmip.sh
--- ld/emulparams/elf64btsmip.sh 18 Sep 2002 01:54:37 -0000 1.6
+++ ld/emulparams/elf64btsmip.sh 13 Oct 2002 21:54:32 -0000
@@ -1,20 +1,15 @@
 # If you change this file, please also look at files which source this one:
 # elf64ltsmip.sh
 
-. ${srcdir}/emulparams/elf32bmipn32-defs.sh
+. ${srcdir}/emulparams/elf64bmip-defs.sh
 OUTPUT_FORMAT="elf64-tradbigmips"
 BIG_OUTPUT_FORMAT="elf64-tradbigmips"
 LITTLE_OUTPUT_FORMAT="elf64-tradlittlemips"
-ELFSIZE=64
 
-GENERATE_SHLIB_SCRIPT=yes
 DATA_ADDR=0x0400000000
 NONPAGED_TEXT_START_ADDR=0x10000000
 SHLIB_TEXT_START_ADDR=0
 TEXT_DYNAMIC=
-
-unset EXECUTABLE_SYMBOLS
-unset WRITABLE_RODATA
 
 # Magic sections.
 INITIAL_READONLY_SECTIONS='.MIPS.options : { *(.MIPS.options) }'

[-- Attachment #3: Type: text/plain, Size: 289 bytes --]


-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                 aoliva@{redhat.com, gcc.gnu.org}
CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist                Professional serial bug killer

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

* Re: mips elf n32 and 64 linker emulparams refactoring
  2002-10-13 14:55 mips elf n32 and 64 linker emulparams refactoring Alexandre Oliva
@ 2002-10-16 17:14 ` Eric Christopher
  2002-10-18 11:42 ` Thiemo Seufer
  1 sibling, 0 replies; 13+ messages in thread
From: Eric Christopher @ 2002-10-16 17:14 UTC (permalink / raw)
  To: Alexandre Oliva; +Cc: binutils

On Sun, 2002-10-13 at 14:55, Alexandre Oliva wrote:
> This patch simplifies some of the mips emulation parameters such that
> there is more sharing.  I've almost created a separate file for the
> IRIX-compatible emulations, but I ended up thinking it was not worth
> the trouble for a single definition of WRITABLE_RODATA, and stopped at
> this point.  Ok to install?
> 

OK.

-eric

-- 
Yeah, I used to play basketball...

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

* Re: mips elf n32 and 64 linker emulparams refactoring
  2002-10-13 14:55 mips elf n32 and 64 linker emulparams refactoring Alexandre Oliva
  2002-10-16 17:14 ` Eric Christopher
@ 2002-10-18 11:42 ` Thiemo Seufer
  2002-10-18 11:44   ` Eric Christopher
  2002-10-18 12:10   ` Alexandre Oliva
  1 sibling, 2 replies; 13+ messages in thread
From: Thiemo Seufer @ 2002-10-18 11:42 UTC (permalink / raw)
  To: Alexandre Oliva; +Cc: binutils

Alexandre Oliva wrote:
[snip]
> from  Alexandre Oliva  <aoliva@redhat.com>
> 
> 	* emulparams/elf32bmipn32-defs.sh (LIB_PATH): Set to /usr/lib32.
> 	(GENERATE_SHLIB_SCRIPT): Set to yes.
> 	(EXECUTABLE_SYMBOLS, WRITABLE_RODATA): Moved to...
> 	* emulparams/elf32bmipn32.sh: here.
> 	(GENERATE_SHLIB_SCRIPT): Deleted as redundant.
> 	* emulparams/elf32btsmipn32.sh: Delete redundant unsets.
> 	* emulparams/elf64bmip-defs.sh: New file.  Extend
> 	elf32bmipn32-defs.sh by overiding ELFSIZE and LIB_PATH.
> 	* emulparams/elf64bmip.sh: Bring in definitions from
> 	elf64bmip-defs.sh.
> 	(ELFSIZE, GENERATE_SHLIB_SCRIPT, LIB_PATH): Delete redundant
> 	settings.
> 	(WRITABLE_RODATA): Moved from elf32bmipn32-defs.sh.
> 	* emulparams/elf64btsmip.sh: Bring in definitions from
> 	elf64bmip-defs.sh.
> 	(ELFSIZE, GENERATE_SHLIB_SCRIPT): Delete, redundant.
> 	(EXECUTABLE_SYMBOLS, WRITABLE_RODATA): Delete redundant unsets.

It already got OK'ed, sorry for being late.

> Index: ld/emulparams/elf32bmipn32-defs.sh
> ===================================================================
> RCS file: /cvs/src/src/ld/emulparams/elf32bmipn32-defs.sh,v
> retrieving revision 1.1
> diff -u -p -r1.1 elf32bmipn32-defs.sh
> --- ld/emulparams/elf32bmipn32-defs.sh 18 Sep 2002 01:54:37 -0000 1.1
> +++ ld/emulparams/elf32bmipn32-defs.sh 13 Oct 2002 21:54:32 -0000
> @@ -11,6 +11,9 @@ BIG_OUTPUT_FORMAT="elf32-bigmips"
>  LITTLE_OUTPUT_FORMAT="elf32-littlemips"
>  
>  TEMPLATE_NAME=elf32
> +LIB_PATH=/usr/lib32

How will this work in a cross-compile environment?

[snip]
> Index: ld/emulparams/elf64bmip-defs.sh
> ===================================================================
> RCS file: ld/emulparams/elf64bmip-defs.sh
> diff -N ld/emulparams/elf64bmip-defs.sh
> --- /dev/null	1 Jan 1970 00:00:00 -0000
> +++ ld/emulparams/elf64bmip-defs.sh 13 Oct 2002 21:54:32 -0000
> @@ -0,0 +1,6 @@
> +# If you change this file, please also look at files which source this one:
> +# elf64bmip.sh and elf64btsmip.sh
> +
> +. ${srcdir}/emulparams/elf32bmipn32-defs.sh

Sidemark: Especially in this context elf32bmipn32-defs.sh is a
really weird name.

> +ELFSIZE=64
> +LIB_PATH=/usr/lib64

Same cross-compile problem here. Formerly it was only set for IRIX,
now a cross-ld on e.g. i386-linux will look in the wrong place.


Thiemo

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

* Re: mips elf n32 and 64 linker emulparams refactoring
  2002-10-18 11:42 ` Thiemo Seufer
@ 2002-10-18 11:44   ` Eric Christopher
  2002-10-18 12:07     ` Alexandre Oliva
  2002-10-18 12:10   ` Alexandre Oliva
  1 sibling, 1 reply; 13+ messages in thread
From: Eric Christopher @ 2002-10-18 11:44 UTC (permalink / raw)
  To: Thiemo Seufer; +Cc: Alexandre Oliva, binutils


> It already got OK'ed, sorry for being late.
> 

It hadn't, I've been a bit busy.

-eric

-- 
Yeah, I used to play basketball...

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

* Re: mips elf n32 and 64 linker emulparams refactoring
  2002-10-18 11:44   ` Eric Christopher
@ 2002-10-18 12:07     ` Alexandre Oliva
  2002-10-18 12:13       ` Eric Christopher
  0 siblings, 1 reply; 13+ messages in thread
From: Alexandre Oliva @ 2002-10-18 12:07 UTC (permalink / raw)
  To: Eric Christopher; +Cc: Thiemo Seufer, binutils

On Oct 18, 2002, Eric Christopher <echristo@redhat.com> wrote:

>> It already got OK'ed, sorry for being late.
>> 

> It hadn't, I've been a bit busy.

So busy that you forgot that you had `OK'ed it, apparently :-)

-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                 aoliva@{redhat.com, gcc.gnu.org}
CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist                Professional serial bug killer

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

* Re: mips elf n32 and 64 linker emulparams refactoring
  2002-10-18 11:42 ` Thiemo Seufer
  2002-10-18 11:44   ` Eric Christopher
@ 2002-10-18 12:10   ` Alexandre Oliva
  2002-10-18 13:38     ` Thiemo Seufer
  1 sibling, 1 reply; 13+ messages in thread
From: Alexandre Oliva @ 2002-10-18 12:10 UTC (permalink / raw)
  To: Thiemo Seufer; +Cc: binutils

On Oct 18, 2002, Thiemo Seufer <ica2_ts@csv.ica.uni-stuttgart.de> wrote:

>> +LIB_PATH=/usr/lib32

> How will this work in a cross-compile environment?

It won't.  Typically, the compiler overrides these anyway.  This is
just meant to overrides the /usr/lib used by default, when the linker
is invoked directly.

>> +. ${srcdir}/emulparams/elf32bmipn32-defs.sh

> Sidemark: Especially in this context elf32bmipn32-defs.sh is a
> really weird name.

Agreed, but note that this was just moved from both of the elf64*.sh
files.

>> +ELFSIZE=64
>> +LIB_PATH=/usr/lib64

> Same cross-compile problem here. Formerly it was only set for IRIX,
> now a cross-ld on e.g. i386-linux will look in the wrong place.

Formerly a cross from i386-linux-gnu to mips-sgi-irix6 would have the
same problem.  If it wasn't a problem for irix, why would it be a
problem for mips-linux-gnu?

Yeah, I agree it's not ideal, but I think it's an improvement over
what was there.  The only negative effect of this change is that a
cross compiler may now look for libraries in a location where it won't
find libraries for the target system.  It will do so after searching
any directories listed in the command line, so it would have failed
one way or the other.

-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                 aoliva@{redhat.com, gcc.gnu.org}
CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist                Professional serial bug killer

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

* Re: mips elf n32 and 64 linker emulparams refactoring
  2002-10-18 12:07     ` Alexandre Oliva
@ 2002-10-18 12:13       ` Eric Christopher
  0 siblings, 0 replies; 13+ messages in thread
From: Eric Christopher @ 2002-10-18 12:13 UTC (permalink / raw)
  To: Alexandre Oliva; +Cc: Thiemo Seufer, binutils

On Fri, 2002-10-18 at 12:07, Alexandre Oliva wrote:
> On Oct 18, 2002, Eric Christopher <echristo@redhat.com> wrote:
> 
> >> It already got OK'ed, sorry for being late.
> >> 
> 
> > It hadn't, I've been a bit busy.
> 
> So busy that you forgot that you had `OK'ed it, apparently :-)
> 

*snork* I had? Hunh. It's still in my TODO list.

-eric

-- 
Yeah, I used to play basketball...

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

* Re: mips elf n32 and 64 linker emulparams refactoring
  2002-10-18 12:10   ` Alexandre Oliva
@ 2002-10-18 13:38     ` Thiemo Seufer
  2002-10-19 13:04       ` Alexandre Oliva
  0 siblings, 1 reply; 13+ messages in thread
From: Thiemo Seufer @ 2002-10-18 13:38 UTC (permalink / raw)
  To: Alexandre Oliva; +Cc: binutils

Alexandre Oliva wrote:
> On Oct 18, 2002, Thiemo Seufer <ica2_ts@csv.ica.uni-stuttgart.de> wrote:
> 
> >> +LIB_PATH=/usr/lib32
> 
> > How will this work in a cross-compile environment?
> 
> It won't.  Typically, the compiler overrides these anyway.

Oh, ok, so this is a missing feature in GLD in general.

> This is
> just meant to overrides the /usr/lib used by default, when the linker
> is invoked directly.

Please note that /lib32:/usr/lib32 is better to find e.g. libc.
(IRIX has symlinks, but other systems probably not).

> >> +. ${srcdir}/emulparams/elf32bmipn32-defs.sh
> 
> > Sidemark: Especially in this context elf32bmipn32-defs.sh is a
> > really weird name.
> 
> Agreed, but note that this was just moved from both of the elf64*.sh
> files.
> 
> >> +ELFSIZE=64
> >> +LIB_PATH=/usr/lib64
> 
> > Same cross-compile problem here. Formerly it was only set for IRIX,
> > now a cross-ld on e.g. i386-linux will look in the wrong place.
> 
> Formerly a cross from i386-linux-gnu to mips-sgi-irix6 would have the
> same problem.  If it wasn't a problem for irix, why would it be a
> problem for mips-linux-gnu?

GLD was/is not regularily in use on IRIX, so I guess cross compilation
therre was only little used if at all.

> Yeah, I agree it's not ideal, but I think it's an improvement over
> what was there.  The only negative effect of this change is that a
> cross compiler may now look for libraries in a location where it won't
> find libraries for the target system.  It will do so after searching
> any directories listed in the command line, so it would have failed
> one way or the other.

Then at least the path should be disabled for cross builds (as in
e.g. elf64ppc.sh) to reduce confusion.


Thiemo

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

* Re: mips elf n32 and 64 linker emulparams refactoring
  2002-10-18 13:38     ` Thiemo Seufer
@ 2002-10-19 13:04       ` Alexandre Oliva
  2002-10-19 13:22         ` Hans-Peter Nilsson
                           ` (2 more replies)
  0 siblings, 3 replies; 13+ messages in thread
From: Alexandre Oliva @ 2002-10-19 13:04 UTC (permalink / raw)
  To: Thiemo Seufer; +Cc: binutils

[-- Attachment #1: Type: text/plain, Size: 1141 bytes --]

On Oct 18, 2002, Thiemo Seufer <ica2_ts@csv.ica.uni-stuttgart.de> wrote:

> Alexandre Oliva wrote:
>> On Oct 18, 2002, Thiemo Seufer <ica2_ts@csv.ica.uni-stuttgart.de> wrote:
>> 
>> >> +LIB_PATH=/usr/lib32
>> 
>> > How will this work in a cross-compile environment?
>> 
>> It won't.  Typically, the compiler overrides these anyway.

> Oh, ok, so this is a missing feature in GLD in general.

It could be argued so.  From some earlier discussions about the
--with-sysroot patch for GCC, I got the impression that Daniel
Jacobowitz might have something for ld that would get ld smarter in
this sense.  Dan, is this true?

> Please note that /lib32:/usr/lib32 is better to find e.g. libc.
> (IRIX has symlinks, but other systems probably not).

Fixed below.

> GLD was/is not regularily in use on IRIX, so I guess cross compilation
> therre was only little used if at all.

Indeed.

> Then at least the path should be disabled for cross builds (as in
> e.g. elf64ppc.sh) to reduce confusion.

Thanks for the pointer.  I fixed a typo in it, and adopted some of the
code for mips n32 and elf64 too.  This is what I came up with.  Ok to
install?


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: mips-ld-emulparams-2.patch --]
[-- Type: text/x-patch, Size: 4176 bytes --]

Index: ld/ChangeLog
from  Alexandre Oliva  <aoliva@redhat.com>

	* emulparams/elf32bmipn32-defs.sh: Set ELFSIZE according to
	emulation name.  Set LIB_PATH only for native tools, and
	search the ABI-specific versions of NATIVE_LIB_DIRS before the
	.../lib variants, not instead of them.  Mostly copied from...
	* emulparams/elf32ppc.sh: ... here.  Fixed typo.
	* emulparams/elf64bmip-defs.sh: Backed out.
	* emulparams/elf64bmip.sh: Import elf32bmipn32-defs.sh again.
	* emulparams/elf64btsmip.sh: Likewise.
	(DATA_ADDR, NONPAGED_TEXT_START_ADDR, SHLIB_TEXT_START_ADDR,
	TEXT_DYNAMIC): Removed.

Index: ld/emulparams/elf32bmipn32-defs.sh
===================================================================
RCS file: /cvs/src/src/ld/emulparams/elf32bmipn32-defs.sh,v
retrieving revision 1.2
diff -u -p -r1.2 elf32bmipn32-defs.sh
--- ld/emulparams/elf32bmipn32-defs.sh 17 Oct 2002 21:54:43 -0000 1.2
+++ ld/emulparams/elf32bmipn32-defs.sh 19 Oct 2002 20:00:25 -0000
@@ -11,7 +11,28 @@ BIG_OUTPUT_FORMAT="elf32-bigmips"
 LITTLE_OUTPUT_FORMAT="elf32-littlemips"
 
 TEMPLATE_NAME=elf32
-LIB_PATH=/usr/lib32
+
+case "$EMULATION_NAME" in
+elf32*n32*) ELFSIZE=32 ;;
+elf64*) ELFSIZE=64 ;;
+*) echo $0: unhandled emulation $EMULATION_NAME >&2; exit 1 ;;
+esac
+
+if test `echo "$host" | sed -e s/64//` = `echo "$target" | sed -e s/64//`; then
+  case " $EMULATION_LIBPATH " in
+    *" ${EMULATION_NAME} "*)
+      LIB_PATH=${libdir}
+      for lib in ${NATIVE_LIB_DIRS}; do
+	case :${LIB_PATH}: in
+	  *:${lib}:*) ;;
+	  *) LIB_PATH=${LIB_PATH}:${lib} ;;
+	esac
+      done
+      # Look for 64 bit target libraries in /lib64, /usr/lib64 etc., first.
+      LIB_PATH=`echo ${LIB_PATH}: | sed -e s,:,$ELFSIZE:,g`$LIB_PATH
+    ;;
+  esac
+fi
 
 GENERATE_SHLIB_SCRIPT=yes
 
Index: ld/emulparams/elf32ppc.sh
===================================================================
RCS file: /cvs/src/src/ld/emulparams/elf32ppc.sh,v
retrieving revision 1.8
diff -u -p -r1.8 elf32ppc.sh
--- ld/emulparams/elf32ppc.sh 29 Sep 2002 23:59:49 -0000 1.8
+++ ld/emulparams/elf32ppc.sh 19 Oct 2002 20:00:25 -0000
@@ -38,5 +38,6 @@ if test `echo "$host" | sed -e s/64//` =
     	case "$EMULATION_NAME" in
     	  *64*) LIB_PATH=`echo ${LIB_PATH}: | sed -e s,:,64:,g`$LIB_PATH
     	esac
+        ;;
     esac
 fi
Index: ld/emulparams/elf64bmip-defs.sh
===================================================================
RCS file: ld/emulparams/elf64bmip-defs.sh
diff -N ld/emulparams/elf64bmip-defs.sh
--- ld/emulparams/elf64bmip-defs.sh 17 Oct 2002 21:54:44 -0000 1.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,6 +0,0 @@
-# If you change this file, please also look at files which source this one:
-# elf64bmip.sh and elf64btsmip.sh
-
-. ${srcdir}/emulparams/elf32bmipn32-defs.sh
-ELFSIZE=64
-LIB_PATH=/usr/lib64
Index: ld/emulparams/elf64bmip.sh
===================================================================
RCS file: /cvs/src/src/ld/emulparams/elf64bmip.sh,v
retrieving revision 1.6
diff -u -p -r1.6 elf64bmip.sh
--- ld/emulparams/elf64bmip.sh 17 Oct 2002 21:54:44 -0000 1.6
+++ ld/emulparams/elf64bmip.sh 19 Oct 2002 20:00:25 -0000
@@ -1,4 +1,4 @@
-. ${srcdir}/emulparams/elf64bmip-defs.sh
+. ${srcdir}/emulparams/elf32bmipn32-defs.sh
 OUTPUT_FORMAT="elf64-bigmips"
 BIG_OUTPUT_FORMAT="elf64-bigmips"
 LITTLE_OUTPUT_FORMAT="elf64-littlemips"
Index: ld/emulparams/elf64btsmip.sh
===================================================================
RCS file: /cvs/src/src/ld/emulparams/elf64btsmip.sh,v
retrieving revision 1.7
diff -u -p -r1.7 elf64btsmip.sh
--- ld/emulparams/elf64btsmip.sh 17 Oct 2002 21:54:44 -0000 1.7
+++ ld/emulparams/elf64btsmip.sh 19 Oct 2002 20:00:25 -0000
@@ -1,15 +1,10 @@
 # If you change this file, please also look at files which source this one:
 # elf64ltsmip.sh
 
-. ${srcdir}/emulparams/elf64bmip-defs.sh
+. ${srcdir}/emulparams/elf32bmipn32-defs.sh
 OUTPUT_FORMAT="elf64-tradbigmips"
 BIG_OUTPUT_FORMAT="elf64-tradbigmips"
 LITTLE_OUTPUT_FORMAT="elf64-tradlittlemips"
-
-DATA_ADDR=0x0400000000
-NONPAGED_TEXT_START_ADDR=0x10000000
-SHLIB_TEXT_START_ADDR=0
-TEXT_DYNAMIC=
 
 # Magic sections.
 INITIAL_READONLY_SECTIONS='.MIPS.options : { *(.MIPS.options) }'

[-- Attachment #3: Type: text/plain, Size: 289 bytes --]


-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                 aoliva@{redhat.com, gcc.gnu.org}
CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist                Professional serial bug killer

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

* Re: mips elf n32 and 64 linker emulparams refactoring
  2002-10-19 13:04       ` Alexandre Oliva
@ 2002-10-19 13:22         ` Hans-Peter Nilsson
  2002-10-19 13:48           ` Alexandre Oliva
  2002-10-19 15:59         ` Daniel Jacobowitz
  2002-10-22 15:11         ` Alexandre Oliva
  2 siblings, 1 reply; 13+ messages in thread
From: Hans-Peter Nilsson @ 2002-10-19 13:22 UTC (permalink / raw)
  To: Alexandre Oliva; +Cc: Thiemo Seufer, binutils

On 19 Oct 2002, Alexandre Oliva wrote:

> I fixed a typo in it, and adopted some of the
> code for mips n32 and elf64 too.

A cursory reading makes it look like some dependencies in
ld/Makefile.am need corresponding tweaking for the changes
regarding included files in those shell-scriptlets.

brgds, H-P

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

* Re: mips elf n32 and 64 linker emulparams refactoring
  2002-10-19 13:22         ` Hans-Peter Nilsson
@ 2002-10-19 13:48           ` Alexandre Oliva
  0 siblings, 0 replies; 13+ messages in thread
From: Alexandre Oliva @ 2002-10-19 13:48 UTC (permalink / raw)
  To: Hans-Peter Nilsson; +Cc: Thiemo Seufer, binutils

On Oct 19, 2002, Hans-Peter Nilsson <hp@bitrange.com> wrote:

> On 19 Oct 2002, Alexandre Oliva wrote:
>> I fixed a typo in it, and adopted some of the
>> code for mips n32 and elf64 too.

> A cursory reading makes it look like some dependencies in
> ld/Makefile.am need corresponding tweaking for the changes
> regarding included files in those shell-scriptlets.

Hmm...  This means I have failed to make these changes when I
introduced elf64bmip-defs.sh two days ago, which I'm taking out now,
so ld/Makefile.am should look ok again after the patch.  Thanks for
the tip, though, I'll try to keep it in mind when if tweak such files
again in the future.

-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                 aoliva@{redhat.com, gcc.gnu.org}
CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist                Professional serial bug killer

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

* Re: mips elf n32 and 64 linker emulparams refactoring
  2002-10-19 13:04       ` Alexandre Oliva
  2002-10-19 13:22         ` Hans-Peter Nilsson
@ 2002-10-19 15:59         ` Daniel Jacobowitz
  2002-10-22 15:11         ` Alexandre Oliva
  2 siblings, 0 replies; 13+ messages in thread
From: Daniel Jacobowitz @ 2002-10-19 15:59 UTC (permalink / raw)
  To: Alexandre Oliva; +Cc: Thiemo Seufer, binutils

On Sat, Oct 19, 2002 at 05:04:11PM -0300, Alexandre Oliva wrote:
> On Oct 18, 2002, Thiemo Seufer <ica2_ts@csv.ica.uni-stuttgart.de> wrote:
> 
> > Alexandre Oliva wrote:
> >> On Oct 18, 2002, Thiemo Seufer <ica2_ts@csv.ica.uni-stuttgart.de> wrote:
> >> 
> >> >> +LIB_PATH=/usr/lib32
> >> 
> >> > How will this work in a cross-compile environment?
> >> 
> >> It won't.  Typically, the compiler overrides these anyway.
> 
> > Oh, ok, so this is a missing feature in GLD in general.
> 
> It could be argued so.  From some earlier discussions about the
> --with-sysroot patch for GCC, I got the impression that Daniel
> Jacobowitz might have something for ld that would get ld smarter in
> this sense.  Dan, is this true?

Yes, but not _much_ smarter.  I mean to clean this up and do something
as nice as --with-sysroot (and preferably call it the same thing) in
the next week or two.  What I have now knows quite well that it's a
hack: paths which start with // instead of / get a prefix appended, set
at configure time and relocating with the ld binary.  Similarly to find
the linker scripts.


-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer

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

* Re: mips elf n32 and 64 linker emulparams refactoring
  2002-10-19 13:04       ` Alexandre Oliva
  2002-10-19 13:22         ` Hans-Peter Nilsson
  2002-10-19 15:59         ` Daniel Jacobowitz
@ 2002-10-22 15:11         ` Alexandre Oliva
  2 siblings, 0 replies; 13+ messages in thread
From: Alexandre Oliva @ 2002-10-22 15:11 UTC (permalink / raw)
  To: Thiemo Seufer, echristo; +Cc: binutils

On Oct 19, 2002, Alexandre Oliva <aoliva@redhat.com> wrote:

> Index: ld/ChangeLog
> from  Alexandre Oliva  <aoliva@redhat.com>

> 	* emulparams/elf32bmipn32-defs.sh: Set ELFSIZE according to
> 	emulation name.  Set LIB_PATH only for native tools, and
> 	search the ABI-specific versions of NATIVE_LIB_DIRS before the
> 	.../lib variants, not instead of them.  Mostly copied from...
> 	* emulparams/elf32ppc.sh: ... here.  Fixed typo.
> 	* emulparams/elf64bmip-defs.sh: Backed out.
> 	* emulparams/elf64bmip.sh: Import elf32bmipn32-defs.sh again.
> 	* emulparams/elf64btsmip.sh: Likewise.
> 	(DATA_ADDR, NONPAGED_TEXT_START_ADDR, SHLIB_TEXT_START_ADDR,
> 	TEXT_DYNAMIC): Removed.

Eric Christopher has just approved this in private.  I'm checking it
in.

-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                 aoliva@{redhat.com, gcc.gnu.org}
CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist                Professional serial bug killer

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

end of thread, other threads:[~2002-10-22 22:11 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-10-13 14:55 mips elf n32 and 64 linker emulparams refactoring Alexandre Oliva
2002-10-16 17:14 ` Eric Christopher
2002-10-18 11:42 ` Thiemo Seufer
2002-10-18 11:44   ` Eric Christopher
2002-10-18 12:07     ` Alexandre Oliva
2002-10-18 12:13       ` Eric Christopher
2002-10-18 12:10   ` Alexandre Oliva
2002-10-18 13:38     ` Thiemo Seufer
2002-10-19 13:04       ` Alexandre Oliva
2002-10-19 13:22         ` Hans-Peter Nilsson
2002-10-19 13:48           ` Alexandre Oliva
2002-10-19 15:59         ` Daniel Jacobowitz
2002-10-22 15:11         ` Alexandre Oliva

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