summaryrefslogtreecommitdiff
path: root/src/logic
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2024-03-06 23:32:32 +0000
committermidipix <writeonce@midipix.org>2024-03-06 23:32:32 +0000
commitc5c351d30d66c9076c11fa0166a23b9b2ec7baea (patch)
tree5f9f6972dc75aafd9d609cae69717a58d8a9212f /src/logic
parent43ee040279e659d6f2f109427fe21432e09cf671 (diff)
downloadslibtool-c5c351d30d66c9076c11fa0166a23b9b2ec7baea.tar.bz2
slibtool-c5c351d30d66c9076c11fa0166a23b9b2ec7baea.tar.xz
link mode: argument vector: remove no-op (past all -l args) linker path args.
Diffstat (limited to 'src/logic')
-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;