public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Alexandre Oliva <aoliva@redhat.com>
To: Thiemo Seufer <ica2_ts@csv.ica.uni-stuttgart.de>
Cc: binutils@sources.redhat.com
Subject: Re: mips elf n32 and 64 linker emulparams refactoring
Date: Sat, 19 Oct 2002 13:04:00 -0000	[thread overview]
Message-ID: <or3cr2nqkk.fsf@free.redhat.lsd.ic.unicamp.br> (raw)
In-Reply-To: <20021018203845.GC24061@rembrandt.csv.ica.uni-stuttgart.de>

[-- 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

  reply	other threads:[~2002-10-19 20:04 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-10-13 14:55 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 [this message]
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

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=or3cr2nqkk.fsf@free.redhat.lsd.ic.unicamp.br \
    --to=aoliva@redhat.com \
    --cc=binutils@sources.redhat.com \
    --cc=ica2_ts@csv.ica.uni-stuttgart.de \
    /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).