This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: X Libraries/linking


On Mon, Jun 24, 2002 at 03:59:46PM -0500, Peter Bergner wrote:
> Is it possible to "act" like a native toolchain?

Sure.  This enables the /etc/ld.so.conf, LD_RUN_PATH and
LD_LIBRARY_PATH search for powerpc-linux to powerpc64-linux
(and vice-versa) cross linkers.

	* emulparams/elf64ppc.sh (NATIVE_CROSS): Define.
	* emulparams/elf32ppc.sh (NATIVE_CROSS): Define.
	* emultempl/elf32.em (gld${EMULATION_NAME}_search_needed): Behave
	as for a native linker if NATIVE_CROSS.
	(gld${EMULATION_NAME}_after_open): Likewise.

Peter, If this stands up to testing "in the field", I'll apply to
mainline binutils CVS.  The sort of thing I'm worried about is picking
up wrong shared libs (ie. 32 bit versions in a 64 bit link), but I
think we've got that problem covered by a test in
bfd/elfcode.h:elf_object_p.

Index: ld/emulparams/elf64ppc.sh
===================================================================
RCS file: /cvs/src/src/ld/emulparams/elf64ppc.sh,v
retrieving revision 1.4
diff -u -p -r1.4 elf64ppc.sh
--- ld/emulparams/elf64ppc.sh	22 May 2002 08:44:53 -0000	1.4
+++ ld/emulparams/elf64ppc.sh	25 Jun 2002 01:52:27 -0000
@@ -32,6 +32,7 @@ OTHER_READWRITE_SECTIONS="
 # Treat a host that matches the target with the possible exception of "64"
 # in the name as if it were native.
 if test `echo "$host" | sed -e s/64//` = `echo "$target" | sed -e s/64//`; then
+    NATIVE_CROSS=yes
     case " $EMULATION_LIBPATH " in
       *" ${EMULATION_NAME} "*)
 	LIB_PATH=${libdir}
Index: ld/emulparams/elf32ppc.sh
===================================================================
RCS file: /cvs/src/src/ld/emulparams/elf32ppc.sh,v
retrieving revision 1.6
diff -u -p -r1.6 elf32ppc.sh
--- ld/emulparams/elf32ppc.sh	22 May 2002 08:44:52 -0000	1.6
+++ ld/emulparams/elf32ppc.sh	25 Jun 2002 02:00:31 -0000
@@ -21,6 +21,7 @@ OTHER_READWRITE_SECTIONS="
 # Treat a host that matches the target with the possible exception of "64"
 # in the name as if it were native.
 if test `echo "$host" | sed -e s/64//` = `echo "$target" | sed -e s/64//`; then
+    NATIVE_CROSS=yes
     case " $EMULATION_LIBPATH " in
       *" ${EMULATION_NAME} "*)
 	LIB_PATH=${libdir}
Index: ld/emultempl/elf32.em
===================================================================
RCS file: /cvs/src/src/ld/emultempl/elf32.em,v
retrieving revision 1.79
diff -u -p -r1.79 elf32.em
--- ld/emultempl/elf32.em	17 Jun 2002 14:08:38 -0000	1.79
+++ ld/emultempl/elf32.em	25 Jun 2002 01:52:27 -0000
@@ -439,7 +439,7 @@ gld${EMULATION_NAME}_search_needed (path
 }
 
 EOF
-if [ "x${host}" = "x${target}" ] ; then
+if [ "x${host}" = "x${target}" -o -n "$NATIVE_CROSS" ] ; then
   case " ${EMULATION_LIBPATH} " in
   *" ${EMULATION_NAME} "*)
     case ${target} in
@@ -644,7 +644,7 @@ gld${EMULATION_NAME}_after_open ()
 	  size_t len;
 	  search_dirs_type *search;
 EOF
-if [ "x${host}" = "x${target}" ] ; then
+if [ "x${host}" = "x${target}" -o -n "$NATIVE_CROSS" ] ; then
   case " ${EMULATION_LIBPATH} " in
   *" ${EMULATION_NAME} "*)
 cat >>e${EMULATION_NAME}.c <<EOF
@@ -661,7 +661,7 @@ cat >>e${EMULATION_NAME}.c <<EOF
 						  l->name, force))
 	    break;
 EOF
-if [ "x${host}" = "x${target}" ] ; then
+if [ "x${host}" = "x${target}" -o -n "$NATIVE_CROSS" ] ; then
   case " ${EMULATION_LIBPATH} " in
   *" ${EMULATION_NAME} "*)
 cat >>e${EMULATION_NAME}.c <<EOF
@@ -713,7 +713,7 @@ cat >>e${EMULATION_NAME}.c <<EOF
 	  if (search != NULL)
 	    break;
 EOF
-if [ "x${host}" = "x${target}" ] ; then
+if [ "x${host}" = "x${target}" -o -n "$NATIVE_CROSS" ] ; then
   case " ${EMULATION_LIBPATH} " in
   *" ${EMULATION_NAME} "*)
     case ${target} in

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]