This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: multiarch proposal
- From: "Matt Rice" <ratmice at gmail dot com>
- To: "Goswin von Brederlow" <goswin-v-b at web dot de>
- Cc: Binutils <binutils at sourceware dot org>
- Date: Fri, 2 May 2008 03:30:36 -0700
- Subject: Re: multiarch proposal
- References: <87skxbmqdq.fsf@frosties.localdomain>
On Thu, Apr 24, 2008 at 4:41 AM, Goswin von Brederlow <goswin-v-b@web.de> wrote:
>
> There are two solutions to this problem, both using the gnu tripplet
> to create a unique library location for each architecture:
>
> 1) Create complectly new multiarch directories:
>
> /lib/i486-linux-gnu/
> /lib/x86_64-linux-gnu/
>
> The TOOL_DIR would be used in genscripts.sh like this:
>
> --- binutils.orig/ld/genscripts.sh 2006-09-11 11:19:00.000000000 +0000
> +++ bintuils/ld/genscripts.sh 2006-09-11 11:19:04.000000000 +0000
> @@ -173,6 +173,17 @@
> *) LIB_PATH2=${LIB_PATH2}:${lib} ;;
> esac
> fi
> + if ! [ "x${TOOL_LIB}" = "x" ] ; then
> + case ${lib} in
> + *${TOOL_LIB}*) ;; # No multiarch below cross-compile dirs
> + *) # Add multiarch dir for target alias
> + case :${LIB_PATH}: in
> + *:${lib}/${TOOL_LIB}:*) ;;
> + ::) LIB_PATH=${lib}/${TOOL_LIB} ;;
> + *) LIB_PATH=${LIB_PATH}:${lib}/${TOOL_LIB} ;;
> + esac
> + esac
> + fi
> done
>
> case :${LIB_PATH}:${LIB_PATH2}: in
>
this may be a silly idea but don't hold me in contempt of court...
I assume this is some sugar so you don't have to specify -L?
anyhow if you don't mind using a bit of magic and specifying
-L/lib/arch/ etc you might be able to do this without patching
anything
by using a substitution sequence
libfoo.so: foo.o
gcc -fPIC -shared -o libfoo.so -Wl,-soname='$${ARCH}$@' $<
then using la_objsearch to expand ${ARCH}/libfoo.so into the search path
i used something similar to this to get something akin to mac os x 'frameworks'
e.g.
/lib/foo/i486-linux-gnu/libfoo.so
/lib/foo/x86_64-linux-gnu/libfoo.so
though maybe in your case there is few enough arch specific
directories to add it to ld.so.conf instead.
instead of making ld intelligent i just did some stuff with pkg-config
iirc i did something like
libdir=/usr/lib/${arch}/
then call
pkg-config --define-variable=arch=i486-linux-gnu --libs foo
and sometime in the future intended to implement -p/-P
(DT_AUDIT/DT_DEPAUDIT) so i wouldn't have to specify
LD_AUDIT....
anyhow... it doesn't seem like something which absolutely requires ld support,
its just rather tedious when doing it at a distribution level having
to manually specify everythings libdir...