diff options
author | midipix <writeonce@midipix.org> | 2017-10-26 01:06:44 -0400 |
---|---|---|
committer | midipix <writeonce@midipix.org> | 2017-10-26 01:06:44 -0400 |
commit | bfe950afe0a3ec940a84a34602119b9a52b12f26 (patch) | |
tree | 710c77b9914469c07ecea914cf1ca20d266c4411 /src/logic | |
parent | fbda3a30a94210a48e797fa9c9dc635f3afaceb9 (diff) | |
download | slibtool-bfe950afe0a3ec940a84a34602119b9a52b12f26.tar.bz2 slibtool-bfe950afe0a3ec940a84a34602119b9a52b12f26.tar.xz |
link mode: import library generation: added mdso support.
Diffstat (limited to 'src/logic')
-rw-r--r-- | src/logic/slbt_exec_link.c | 58 |
1 files changed, 43 insertions, 15 deletions
diff --git a/src/logic/slbt_exec_link.c b/src/logic/slbt_exec_link.c index b47bbc1..0721aef 100644 --- a/src/logic/slbt_exec_link.c +++ b/src/logic/slbt_exec_link.c @@ -826,8 +826,9 @@ static int slbt_exec_link_create_import_library( char * soname, bool ftag) { + int fmdso; char * slash; - char * dlltool[8]; + char * eargv[8]; char program[PATH_MAX]; char hosttag[PATH_MAX]; char hostlnk[PATH_MAX]; @@ -866,22 +867,49 @@ static int slbt_exec_link_create_import_library( return SLBT_NESTED_ERROR(dctx); } - /* dlltool argv */ - if ((size_t)snprintf(program,sizeof(program),"%s", - dctx->cctx->host.dlltool) >= sizeof(program)) - return SLBT_BUFFER_ERROR(dctx); + /* dlltool or mdso? */ + if (dctx->cctx->drvflags & SLBT_DRIVER_IMPLIB_DSOMETA) + fmdso = 1; + + else if (dctx->cctx->drvflags & SLBT_DRIVER_IMPLIB_DSOMETA) + fmdso = 0; + + else if (!(strcmp(dctx->cctx->host.flavor,"midipix"))) + fmdso = 1; + + else + fmdso = 0; - dlltool[0] = program; - dlltool[1] = "-l"; - dlltool[2] = impfilename; - dlltool[3] = "-d"; - dlltool[4] = deffilename; - dlltool[5] = "-D"; - dlltool[6] = soname; - dlltool[7] = 0; + /* eargv */ + if (fmdso) { + if ((size_t)snprintf(program,sizeof(program),"%s", + dctx->cctx->host.mdso) >= sizeof(program)) + 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; + } else { + if ((size_t)snprintf(program,sizeof(program),"%s", + dctx->cctx->host.dlltool) >= sizeof(program)) + 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; + } /* alternate argument vector */ - ectx->argv = dlltool; + ectx->argv = eargv; ectx->program = program; /* step output */ @@ -889,7 +917,7 @@ static int slbt_exec_link_create_import_library( if (slbt_output_link(dctx,ectx)) return SLBT_NESTED_ERROR(dctx); - /* dlltool spawn */ + /* dlltool/mdso spawn */ if ((slbt_spawn(ectx,true) < 0) || ectx->exitcode) return SLBT_SPAWN_ERROR(dctx); |