This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: mips elf n32 and 64 linker emulparams refactoring
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?
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) }'
--
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