From 31bc05ce0ab450ac81770ee64e37ed6b39a6617a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20H=C3=BCbinette=20=28Hubbe=29?= <hubbe@hubbe.net> Date: Sat, 19 Feb 2000 16:10:30 -0800 Subject: [PATCH] more magic.. Rev: bin/smartlink:1.24 Rev: src/smartlink.c:1.5 --- bin/smartlink | 20 ++++++++++++++++++++ src/smartlink.c | 25 +++++++++++++++++++++++-- 2 files changed, 43 insertions(+), 2 deletions(-) diff --git a/bin/smartlink b/bin/smartlink index 52e756cd44..b7124d8e7f 100755 --- a/bin/smartlink +++ b/bin/smartlink @@ -21,6 +21,15 @@ export SGI_API SET_N32="" +case "/$LINKER " in + */ld\ *) + LINKER_IS_LD=yes + ;; + *) + LINKER_IS_LD=no + ;; +esac + while test "$#" != 0; do case $1 in -R*) @@ -57,6 +66,17 @@ while test "$#" != 0; do -n32) SET_N32="-n32" ;; + + + -Wl,*) + # Strip '-Wl,' if the linker is ld + + if test $LINKER_IS_LD = yes; then + LDOPTS="$LDOPTS `echo $1|sed -e 's/^-Wl,//'`" + else + LDOPTS="$LDOPTS $1" + fi + ;; *) LDOPTS="$LDOPTS $1" esac diff --git a/src/smartlink.c b/src/smartlink.c index 551a5484ba..5fbd6f05d6 100644 --- a/src/smartlink.c +++ b/src/smartlink.c @@ -1,5 +1,5 @@ /* - * $Id: smartlink.c,v 1.4 2000/01/30 17:13:28 grubba Exp $ + * $Id: smartlink.c,v 1.5 2000/02/20 00:08:47 hubbe Exp $ * * smartlink - A smarter linker. * Based on the /bin/sh script smartlink 1.23. @@ -87,7 +87,7 @@ int main(int argc, char **argv) if (!strcmp(argv[1], "-v")) { fprintf(stdout, - "$Id: smartlink.c,v 1.4 2000/01/30 17:13:28 grubba Exp $\n" + "$Id: smartlink.c,v 1.5 2000/02/20 00:08:47 hubbe Exp $\n" "Usage:\n" "\t%s binary [args]\n", argv[0]); @@ -200,6 +200,27 @@ int main(int argc, char **argv) new_argv[new_argc++] = argv[i]; } +#ifndef USE_Wl + /* This code strips '-Wl,' from arguments if the + * linker is '*ld' + */ + if(linking) + { + int len=strlen(argv[1]); + if(strchr(argv[1],' ')) len=strchr(argv[1],' ') - argv[1]; + if(len > 1 && argv[1][len-2]=='l' && argv[1][len-1]=='d') + { + for(i=2; i<argc; i++) { + if (new_argv[i][0] == '-' && new_argv[i][1]=='W' && + new_argv[i][2]=='l' && new_argv[i][3]==',') + { + new_argv[i]=new_argv[i]+4; + } + } + } + } +#endif + if (n32) { i = new_argc++; /* Note don't copy index 0 */ -- GitLab