summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/logic/linkcmd/slbt_linkcmd_argv.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/logic/linkcmd/slbt_linkcmd_argv.c b/src/logic/linkcmd/slbt_linkcmd_argv.c
index 71cf2a1..e4f0d12 100644
--- a/src/logic/linkcmd/slbt_linkcmd_argv.c
+++ b/src/logic/linkcmd/slbt_linkcmd_argv.c
@@ -999,12 +999,25 @@ slbt_hidden int slbt_exec_link_finalize_argument_vector(
for (; src<cap; )
*dst++ = *src++;
- /* join all other args */
+ /* join all other args, eliminate no-op linker path args */
src = aargv;
cap = aarg;
- for (; src<cap; )
- *dst++ = *src++;
+ for (; src<cap; ) {
+ if ((src[0][0] == '-') && (src[0][1] == 'L')) {
+ for (larg=0,rarg=src; *rarg && !larg; rarg++)
+ if ((rarg[0][0] == '-') && (rarg[0][1] == 'l'))
+ larg = rarg;
+
+ if (larg) {
+ *dst++ = *src++;
+ } else {
+ src++;
+ }
+ } else {
+ *dst++ = *src++;
+ }
+ }
/* properly null-terminate argv, accounting for redundant -l arguments */
*dst = 0;