From 677f08a81d3675e8bc2ae576ed3e0686dfb9f7cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20H=C3=BCbinette=20=28Hubbe=29?= <hubbe@hubbe.net> Date: Sat, 25 Mar 2000 14:46:29 -0800 Subject: [PATCH] should now handle -Wl,foo,bar,gazonk Rev: bin/smartlink:1.25 Rev: src/smartlink.c:1.6 --- bin/smartlink | 2 +- src/smartlink.c | 18 ++++++++++++++---- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/bin/smartlink b/bin/smartlink index b7124d8e7f..6db0785848 100755 --- a/bin/smartlink +++ b/bin/smartlink @@ -72,7 +72,7 @@ while test "$#" != 0; do # Strip '-Wl,' if the linker is ld if test $LINKER_IS_LD = yes; then - LDOPTS="$LDOPTS `echo $1|sed -e 's/^-Wl,//'`" + LDOPTS="$LDOPTS `echo $1|sed -e 's/^-Wl,//'|sed -e 's/,/ /g'`" else LDOPTS="$LDOPTS $1" fi diff --git a/src/smartlink.c b/src/smartlink.c index 5fbd6f05d6..21e5c3011c 100644 --- a/src/smartlink.c +++ b/src/smartlink.c @@ -1,5 +1,5 @@ /* - * $Id: smartlink.c,v 1.5 2000/02/20 00:08:47 hubbe Exp $ + * $Id: smartlink.c,v 1.6 2000/03/25 22:46:29 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.5 2000/02/20 00:08:47 hubbe Exp $\n" + "$Id: smartlink.c,v 1.6 2000/03/25 22:46:29 hubbe Exp $\n" "Usage:\n" "\t%s binary [args]\n", argv[0]); @@ -132,8 +132,8 @@ int main(int argc, char **argv) rpath[0] = 0; lpath[0] = 0; - /* 5 extra args should be enough... */ - if (!(new_argv = malloc(sizeof(char *)*(argc + 5)))) { + /* 150 extra args should be enough... */ + if (!(new_argv = malloc(sizeof(char *)*(argc + 150)))) { fatal("Out of memory (5)!\n"); } @@ -214,7 +214,17 @@ int main(int argc, char **argv) if (new_argv[i][0] == '-' && new_argv[i][1]=='W' && new_argv[i][2]=='l' && new_argv[i][3]==',') { + char *ptr; new_argv[i]=new_argv[i]+4; + + while((ptr=strchr(new_argv[i],','))) + { + int e; + *ptr=0; + for(e=argc;e>=i;e--) new_argv[e+1]=new_argv[e]; + new_argv[i+1]=ptr+1; + i++; + } } } } -- GitLab