summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2024-02-16 08:05:06 +0000
committermidipix <writeonce@midipix.org>2024-02-16 08:05:06 +0000
commit2b538bb2ffd5588f6c5c9d2f0b05ae6de6b4d7fb (patch)
treeefaeb47149c749ddf5732a62475cc4f83ae06522 /src
parentba922898a1106882fa7f1228dd64c2d3587e0dc5 (diff)
downloadslibtool-2b538bb2ffd5588f6c5c9d2f0b05ae6de6b4d7fb.tar.bz2
slibtool-2b538bb2ffd5588f6c5c9d2f0b05ae6de6b4d7fb.tar.xz
link mode: mdso & dlltool: added support for tool-specific argument vector.
Diffstat (limited to 'src')
-rw-r--r--src/logic/linkcmd/slbt_linkcmd_implib.c117
1 files changed, 73 insertions, 44 deletions
diff --git a/src/logic/linkcmd/slbt_linkcmd_implib.c b/src/logic/linkcmd/slbt_linkcmd_implib.c
index 43ca45b..9c8890e 100644
--- a/src/logic/linkcmd/slbt_linkcmd_implib.c
+++ b/src/logic/linkcmd/slbt_linkcmd_implib.c
@@ -29,7 +29,9 @@ int slbt_exec_link_create_import_library(
char * soname)
{
int fmdso;
- char * eargv[14];
+ char ** argv;
+ char ** parg;
+ char ** aarg;
char program[PATH_MAX];
char as[PATH_MAX];
@@ -46,40 +48,71 @@ int slbt_exec_link_create_import_library(
else
fmdso = 0;
- /* eargv */
+ /* alternate argument vector */
+ ectx->argv = ectx->altv;
+ ectx->program = program;
+
+ /* tool-specific argument vector */
+ argv = (fmdso)
+ ? (slbt_get_driver_ictx(dctx))->host.mdso_argv
+ : (slbt_get_driver_ictx(dctx))->host.dlltool_argv;
+
+ /* tool-specific argv */
+ aarg = ectx->altv;
+
+ if ((parg = argv)) {
+ ectx->program = argv[0];
+
+ for (; *parg; )
+ *aarg++ = *parg++;
+ } else {
+ *aarg++ = program;
+ }
+
+ /* altv */
if (fmdso) {
- if (slbt_snprintf(program,sizeof(program),
- "%s",dctx->cctx->host.mdso) < 0)
- return SLBT_BUFFER_ERROR(dctx);
-
- eargv[0] = program;
- eargv[1] = "-i";
- eargv[2] = impfilename;
- eargv[3] = "-n";
- eargv[4] = soname;
- eargv[5] = deffilename;
- eargv[6] = 0;
+ if (!argv)
+ if (slbt_snprintf(program,sizeof(program),
+ "%s",dctx->cctx->host.mdso) < 0)
+ return SLBT_BUFFER_ERROR(dctx);
+
+ *aarg++ = "-i";
+ *aarg++ = impfilename;
+ *aarg++ = "-n";
+ *aarg++ = soname;
+ *aarg++ = deffilename;
+ *aarg = 0;
} else {
- if (slbt_snprintf(program,sizeof(program),
- "%s",dctx->cctx->host.dlltool) < 0)
- return SLBT_BUFFER_ERROR(dctx);
-
- eargv[0] = program;
- eargv[1] = "-l";
- eargv[2] = impfilename;
- eargv[3] = "-d";
- eargv[4] = deffilename;
- eargv[5] = "-D";
- eargv[6] = soname;
- eargv[7] = 0;
+ if (!argv)
+ if (slbt_snprintf(program,sizeof(program),
+ "%s",dctx->cctx->host.dlltool) < 0)
+ return SLBT_BUFFER_ERROR(dctx);
+
+ *aarg++ = "-l";
+ *aarg++ = impfilename;
+ *aarg++ = "-d";
+ *aarg++ = deffilename;
+ *aarg++ = "-D";
+ *aarg++ = soname;
+ *aarg = 0;
if (dctx->cctx->host.as) {
- if (slbt_snprintf(as,sizeof(as),
- "%s",dctx->cctx->host.as) < 0)
- return SLBT_BUFFER_ERROR(dctx);
+ if ((argv = (slbt_get_driver_ictx(dctx))->host.as_argv)) {
+ *aarg++ = "-S";
+ *aarg++ = argv[0];
+
+ for (parg=&argv[1]; *parg; parg++) {
+ *aarg++ = "-f";
+ *aarg++ = *parg;
+ }
+ } else {
+ if (slbt_snprintf(as,sizeof(as),
+ "%s",dctx->cctx->host.as) < 0)
+ return SLBT_BUFFER_ERROR(dctx);
- eargv[7] = "-S";
- eargv[8] = as;
+ *aarg++ = "-S";
+ *aarg++ = as;
+ }
const char * host = dctx->cctx->host.host;
@@ -89,25 +122,21 @@ int slbt_exec_link_create_import_library(
&& (host[2] == '8')
&& (host[3] == '6')
&& (host[4] == '-')) {
- eargv[9] = "-f";
- eargv[10] = "--32";
- eargv[11] = "-m";
- eargv[12] = "i386";
- eargv[13] = 0;
+ *aarg++ = "-f";
+ *aarg++ = "--32";
+ *aarg++ = "-m";
+ *aarg++ = "i386";
+ *aarg++ = 0;
} else {
- eargv[9] = "-f";
- eargv[10] = "--64";
- eargv[11] = "-m";
- eargv[12] = "i386:x86-64";
- eargv[13] = 0;
+ *aarg++ = "-f";
+ *aarg++ = "--64";
+ *aarg++ = "-m";
+ *aarg++ = "i386:x86-64";
+ *aarg = 0;
}
}
}
- /* alternate argument vector */
- ectx->argv = eargv;
- ectx->program = program;
-
/* step output */
if (!(dctx->cctx->drvflags & SLBT_DRIVER_SILENT))
if (slbt_output_link(dctx,ectx))