2004-03-29 08:02:53 +02:00
|
|
|
# $NetBSD: marshall,v 1.11 2004/03/29 06:02:53 jlam Exp $
|
2003-10-04 12:20:09 +02:00
|
|
|
#
|
|
|
|
# Handle cases where multiple consecutive arguments must be processed
|
|
|
|
# together, either by merging the arguments or "skipping" the extra
|
|
|
|
# arguments.
|
2003-10-03 21:40:55 +02:00
|
|
|
#
|
|
|
|
case $arg in
|
2003-09-02 08:59:37 +02:00
|
|
|
#
|
2004-02-13 17:49:53 +01:00
|
|
|
# If we see "-I dir" (or -L/-R), we convert it to "-Idir" so that it may be
|
|
|
|
# transformed correctly.
|
|
|
|
#
|
|
|
|
-[ILR])
|
|
|
|
arg="$arg$1"
|
|
|
|
shift
|
|
|
|
;;
|
|
|
|
#
|
2004-01-15 10:59:29 +01:00
|
|
|
# Merge "-Wl,R -Wl,/path/to/dir" into a single argument
|
|
|
|
# "-Wl,R/path/to/dir" and merge "-Wl,--rpath -Wl,/path/to/dir" into
|
|
|
|
# "-Wl,--rpath,/path/to/dir" so that we can look them up in the cache.
|
2004-03-29 08:02:53 +02:00
|
|
|
# Also deal with "-Xlinker" being equivalent to "-Wl,".
|
2003-09-02 08:59:37 +02:00
|
|
|
#
|
2004-03-29 08:02:53 +02:00
|
|
|
-Xlinker|-Wl,-R|-Wl,-rpath|-Wl,-rpath-link|-Wl,--rpath|-Wl,--rpath-link)
|
|
|
|
R=
|
|
|
|
case $arg in
|
|
|
|
-Xlinker)
|
|
|
|
case $1 in
|
|
|
|
-Wl,-R) R="$1"; shift ;;
|
|
|
|
-Wl,-rpath|-Wl,-rpath-link) R="$1,"; shift ;;
|
|
|
|
-Wl,--rpath|-Wl,--rpath-link) R="$1,"; shift ;;
|
|
|
|
-Wl,*) arg="$1"; shift ;;
|
|
|
|
-R) R="-Wl,$1"; shift ;;
|
|
|
|
-rpath|-rpath-link) R="-Wl,$1,"; shift ;;
|
|
|
|
--rpath|--rpath-link) R="-Wl,$1,"; shift ;;
|
|
|
|
esac
|
|
|
|
;;
|
|
|
|
-Wl,-R) R="$arg" ;;
|
|
|
|
-Wl,-rpath|-Wl,-rpath-link) R="$arg," ;;
|
|
|
|
-Wl,--rpath|-Wl,--rpath-link) R="$arg," ;;
|
|
|
|
esac
|
|
|
|
if $test -n "$R"; then
|
|
|
|
nextarg=$1; shift
|
|
|
|
case $nextarg in
|
|
|
|
-Xlinker) nextarg=$1; shift ;;
|
|
|
|
esac
|
|
|
|
case $nextarg in
|
|
|
|
-Wl,*) nextarg=`$echo "X$nextarg" | $Xsed -e "s|^-Wl,||g"` ;;
|
|
|
|
esac
|
|
|
|
arg="$R$nextarg"
|
|
|
|
fi
|
2003-09-02 08:59:37 +02:00
|
|
|
;;
|
2003-10-03 21:40:55 +02:00
|
|
|
#
|
2003-11-25 15:44:39 +01:00
|
|
|
# If we're linking a shared library by "cc -shared -o /srcdir/shlib",
|
|
|
|
# we need to protect the full path after "-o" from being transformed
|
|
|
|
# from "/srcdir/shlib" to "-L/srcdir -lshlib"
|
|
|
|
#
|
|
|
|
-o)
|
|
|
|
skipargs=1
|
|
|
|
;;
|
|
|
|
#
|
2004-03-19 01:04:42 +01:00
|
|
|
# Darwin's linker uses:
|
2004-02-09 05:35:12 +01:00
|
|
|
#
|
|
|
|
# -dylib_file /path/shlib:/path2/shlib
|
|
|
|
# -dylib_install_name /path/shlib
|
|
|
|
# -install_name /path/shlib
|
|
|
|
#
|
|
|
|
# to pass the installed locations for the shared libraries to the linker,
|
|
|
|
# and we need to protect the full path from "/path/shlib" -> "-L/path -lshlib"
|
2004-03-19 01:04:42 +01:00
|
|
|
# transformation. (-seg_addr_table_filename's purpose is more obscure,
|
|
|
|
# but darwin's imake rules use it.)
|
2003-10-03 21:40:55 +02:00
|
|
|
#
|
2004-03-19 01:04:42 +01:00
|
|
|
-dylib_file|-dylib_install_name|-install_name|-seg_addr_table_filename)
|
2003-10-09 10:19:47 +02:00
|
|
|
skipargs=1
|
2003-10-03 21:40:55 +02:00
|
|
|
;;
|
2003-09-02 08:59:37 +02:00
|
|
|
esac
|