diff options
author | midipix <writeonce@midipix.org> | 2018-07-10 15:14:36 +0000 |
---|---|---|
committer | midipix <writeonce@midipix.org> | 2018-07-11 02:30:33 -0400 |
commit | 46aa6f554c0f2ef1affa5ae292fffec6907ff4b3 (patch) | |
tree | 9d76ad72f2d0ea2b1865b03b59085ddfaae646b5 /src/logic/slbt_exec_link.c | |
parent | 6185379aed8fab5a5d230e4a828258c6a5516743 (diff) | |
download | slibtool-46aa6f554c0f2ef1affa5ae292fffec6907ff4b3.tar.bz2 slibtool-46aa6f554c0f2ef1affa5ae292fffec6907ff4b3.tar.xz |
link mode: properly handle explicit archive input arguments.
Diffstat (limited to 'src/logic/slbt_exec_link.c')
-rw-r--r-- | src/logic/slbt_exec_link.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/src/logic/slbt_exec_link.c b/src/logic/slbt_exec_link.c index 53fcd83..4f422d2 100644 --- a/src/logic/slbt_exec_link.c +++ b/src/logic/slbt_exec_link.c @@ -193,6 +193,7 @@ static bool slbt_adjust_input_argument( static int slbt_adjust_linker_argument( const struct slbt_driver_ctx * dctx, char * arg, + char ** xarg, bool fpic, const char * dsosuffix, const char * arsuffix, @@ -209,8 +210,10 @@ static int slbt_adjust_linker_argument( if (!(dot = strrchr(arg,'.'))) return 0; - if (!(strcmp(dot,arsuffix))) + if (!(strcmp(dot,arsuffix))) { + *xarg = arg; return slbt_get_deps_meta(dctx,arg,1,depsmeta); + } if (!(strcmp(dot,dsosuffix))) return slbt_get_deps_meta(dctx,arg,1,depsmeta); @@ -350,6 +353,9 @@ static int slbt_exec_link_adjust_argument_vector( } else if (!(dot = strrchr(*carg,'.'))) { *aarg++ = *carg++; + } else if (ectx->xargv[carg - ectx->cargv]) { + *aarg++ = *carg++; + } else if (!(strcmp(dot,".a"))) { if (flibrary && !fwholearchive) *aarg++ = "-Wl,--whole-archive"; @@ -1120,6 +1126,7 @@ static int slbt_exec_link_create_library( const char * relfilename) { char ** parg; + char ** xarg; char cwd [PATH_MAX]; char output [PATH_MAX]; char soname [PATH_MAX]; @@ -1145,10 +1152,10 @@ static int slbt_exec_link_create_library( SLBT_NESTED_ERROR(dctx)); /* linker argument adjustment */ - for (parg=ectx->cargv; *parg; parg++) + for (parg=ectx->cargv, xarg=ectx->xargv; *parg; parg++, xarg++) if (slbt_adjust_linker_argument( dctx, - *parg,true, + *parg,xarg,true, dctx->cctx->settings.dsosuffix, dctx->cctx->settings.arsuffix, &depsmeta) < 0) @@ -1287,6 +1294,7 @@ static int slbt_exec_link_create_executable( int fdcwd; int fdwrap; char ** parg; + char ** xarg; char * base; char cwd [PATH_MAX]; char output [PATH_MAX]; @@ -1314,10 +1322,10 @@ static int slbt_exec_link_create_executable( slbt_adjust_input_argument(*parg,".lo",".o",fpic); /* linker argument adjustment */ - for (parg=ectx->cargv; *parg; parg++) + for (parg=ectx->cargv, xarg=ectx->xargv; *parg; parg++, xarg++) if (slbt_adjust_linker_argument( dctx, - *parg,true, + *parg,xarg,true, dctx->cctx->settings.dsosuffix, dctx->cctx->settings.arsuffix, &depsmeta) < 0) |