summaryrefslogtreecommitdiffhomepage
path: root/src/logic
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2019-02-19 08:30:41 -0500
committermidipix <writeonce@midipix.org>2019-02-19 08:30:41 -0500
commit34988f835484e8a4fdc3e9a93930786755a63d05 (patch)
tree2a3e0b8a853927d15e13d0a297089c0c21d088a0 /src/logic
parent513f55dd376fbfc0625b00e56340fa17052a75ea (diff)
downloadslibtool-34988f835484e8a4fdc3e9a93930786755a63d05.tar.bz2
slibtool-34988f835484e8a4fdc3e9a93930786755a63d05.tar.xz
driver, compile & link mode: support arbitrary & known compiler wrappers.
Diffstat (limited to 'src/logic')
-rw-r--r--src/logic/slbt_exec_compile.c14
-rw-r--r--src/logic/slbt_exec_link.c18
2 files changed, 25 insertions, 7 deletions
diff --git a/src/logic/slbt_exec_compile.c b/src/logic/slbt_exec_compile.c
index cad5bd8..8efa777 100644
--- a/src/logic/slbt_exec_compile.c
+++ b/src/logic/slbt_exec_compile.c
@@ -43,6 +43,7 @@ static int slbt_exec_compile_finalize_argument_vector(
char ** cap;
char ** src;
char ** dst;
+ char * ccwrap;
/* vector size */
base = ectx->argv;
@@ -89,12 +90,17 @@ static int slbt_exec_compile_finalize_argument_vector(
}
}
- /* (program name) */
- dst = &base[1];
+ /* program name, ccwrap */
+ if ((ccwrap = (char *)dctx->cctx->ccwrap)) {
+ base[1] = base[0];
+ base[0] = ccwrap;
+ base++;
+ }
/* join all other args */
src = aargv;
cap = aarg;
+ dst = &base[1];
for (; src<cap; )
*dst++ = *src++;
@@ -126,6 +132,7 @@ int slbt_exec_compile(
{
int ret;
char * fpic;
+ char * ccwrap;
struct slbt_exec_ctx * actx = 0;
const struct slbt_common_ctx * cctx = dctx->cctx;
@@ -153,7 +160,8 @@ int slbt_exec_compile(
}
/* compile mode */
- ectx->program = ectx->compiler;
+ ccwrap = (char *)cctx->ccwrap;
+ ectx->program = ccwrap ? ccwrap : ectx->compiler;
ectx->argv = ectx->cargv;
/* -fpic */
diff --git a/src/logic/slbt_exec_link.c b/src/logic/slbt_exec_link.c
index 0bfe7e0..5f94038 100644
--- a/src/logic/slbt_exec_link.c
+++ b/src/logic/slbt_exec_link.c
@@ -588,6 +588,7 @@ static int slbt_exec_link_finalize_argument_vector(
char ** dst;
char * arg;
char * dot;
+ char * ccwrap;
const char * arsuffix;
/* vector size */
@@ -717,12 +718,17 @@ static int slbt_exec_link_finalize_argument_vector(
}
}
- /* (program name) */
- dst = &base[1];
+ /* program name, ccwrap */
+ if ((ccwrap = (char *)dctx->cctx->ccwrap)) {
+ base[1] = base[0];
+ base[0] = ccwrap;
+ base++;
+ }
/* join object args */
src = oargv;
cap = oarg;
+ dst = &base[1];
for (; src<cap; )
*dst++ = *src++;
@@ -1254,6 +1260,7 @@ static int slbt_exec_link_create_library(
int fdcwd;
char ** parg;
char ** xarg;
+ char * ccwrap;
char cwd [PATH_MAX];
char output [PATH_MAX];
char soname [PATH_MAX];
@@ -1399,8 +1406,9 @@ static int slbt_exec_link_create_library(
return SLBT_NESTED_ERROR(dctx);
/* using alternate argument vector */
+ ccwrap = (char *)dctx->cctx->ccwrap;
ectx->argv = depsmeta.altv;
- ectx->program = depsmeta.altv[0];
+ ectx->program = ccwrap ? ccwrap : depsmeta.altv[0];
/* sigh */
if (slbt_exec_link_finalize_argument_vector(dctx,ectx))
@@ -1432,6 +1440,7 @@ static int slbt_exec_link_create_executable(
char ** parg;
char ** xarg;
char * base;
+ char * ccwrap;
char cwd [PATH_MAX];
char output [PATH_MAX];
char wrapper[PATH_MAX];
@@ -1531,8 +1540,9 @@ static int slbt_exec_link_create_executable(
return SLBT_NESTED_ERROR(dctx);
/* using alternate argument vector */
+ ccwrap = (char *)dctx->cctx->ccwrap;
ectx->argv = depsmeta.altv;
- ectx->program = depsmeta.altv[0];
+ ectx->program = ccwrap ? ccwrap : depsmeta.altv[0];
/* executable wrapper symlink */
if ((size_t)snprintf(wraplnk,sizeof(wraplnk),"%s.exe.wrapper",