diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/internal/slibtool_driver_impl.h | 3 | ||||
-rw-r--r-- | src/logic/slbt_exec_ctx.c | 36 |
2 files changed, 34 insertions, 5 deletions
diff --git a/src/internal/slibtool_driver_impl.h b/src/internal/slibtool_driver_impl.h index 6bbd5d0..c325134 100644 --- a/src/internal/slibtool_driver_impl.h +++ b/src/internal/slibtool_driver_impl.h @@ -167,12 +167,13 @@ struct slbt_driver_ctx_alloc { struct slbt_exec_ctx_impl { const struct slbt_driver_ctx * dctx; + struct slbt_symlist_ctx * sctx; + struct slbt_exec_ctx ctx; int argc; char * args; char * shadow; char * dsoprefix; size_t size; - struct slbt_exec_ctx ctx; int fdwrapper; char ** lout[2]; char ** mout[2]; diff --git a/src/logic/slbt_exec_ctx.c b/src/logic/slbt_exec_ctx.c index 0e02c23..4667691 100644 --- a/src/logic/slbt_exec_ctx.c +++ b/src/logic/slbt_exec_ctx.c @@ -104,12 +104,12 @@ static struct slbt_exec_ctx_impl * slbt_exec_ctx_alloc( /* buffer size (ldirname, lbasename, lobjname, aobjname, etc.) */ if (dctx->cctx->output) - size += 9*strlen(dctx->cctx->output); + size += 10*strlen(dctx->cctx->output); else if ((csrc = slbt_source_file(dctx->cctx->cargv))) - size += 9*strlen(csrc); + size += 10*strlen(csrc); /* pessimistic: long dso suffix, long x.y.z version */ - size += 9 * (16 + 16 + 16 + 16); + size += 10 * (16 + 16 + 16 + 16); /* pessimistic argc: .libs/libfoo.so --> -L.libs -lfoo */ argc *= 2; @@ -122,6 +122,7 @@ static struct slbt_exec_ctx_impl * slbt_exec_ctx_alloc( if (dctx->cctx->mode == SLBT_MODE_LINK) size += strlen(dctx->cctx->settings.arprefix) + 1 + strlen(dctx->cctx->settings.arsuffix) + 1 + + strlen(dctx->cctx->settings.mapsuffix) + 1 + strlen(dctx->cctx->settings.dsoprefix) + 1 + strlen(dctx->cctx->settings.dsoprefix) + 1 + strlen(dctx->cctx->settings.dsoprefix) + 1 @@ -293,6 +294,8 @@ int slbt_ectx_get_exec_ctx( ictx->ctx.lsoname = &ictx->ctx.argv[i++]; ictx->ctx.symdefs = &ictx->ctx.argv[i++]; ictx->ctx.symfile = &ictx->ctx.argv[i++]; + ictx->ctx.explarg = &ictx->ctx.argv[i++]; + ictx->ctx.expsyms = &ictx->ctx.argv[i++]; ictx->ctx.lout[0] = &ictx->ctx.argv[i++]; ictx->ctx.lout[1] = &ictx->ctx.argv[i++]; @@ -338,7 +341,7 @@ int slbt_ectx_get_exec_ctx( + 1; } - /* linking: arfilename, lafilename, laifilename, dsobasename, dsofilename */ + /* linking: arfilename, lafilename, laifilename, dsobasename, dsofilename, mapfilename */ if (dctx->cctx->mode == SLBT_MODE_LINK && dctx->cctx->libname) { /* arprefix, dsoprefix */ if (dctx->cctx->drvflags & SLBT_DRIVER_MODULE) { @@ -399,6 +402,17 @@ int slbt_ectx_get_exec_ctx( dctx->cctx->settings.dsosuffix); ch++; + /* mapfilename */ + ictx->ctx.mapfilename = ch; + ch += sprintf(ch,"%s%s%s%s%s%s", + ictx->ctx.ldirname, + dsoprefix, + dctx->cctx->libname, + dctx->cctx->release ? "-" : "", + dctx->cctx->release ? dctx->cctx->release : "", + dctx->cctx->settings.mapsuffix); + ch++; + /* deffilename */ ictx->ctx.deffilename = ch; ch += sprintf(ch,"%s%s%s%s%s%s.def", @@ -504,6 +518,13 @@ int slbt_ectx_get_exec_ctx( ch += sprintf(ch,".libs/%s",dctx->cctx->output) + 1; } + /* vector of exported symbols (raw input via -export-symbols) */ + if (dctx->cctx->expsyms) + if (slbt_lib_get_symlist_ctx( + dctx,dctx->cctx->expsyms, + &ictx->sctx) < 0) + return SLBT_NESTED_ERROR(dctx); + /* argument strings shadow copy */ memcpy(ictx->shadow,ictx->args,ictx->size); @@ -529,6 +550,9 @@ static int slbt_ectx_free_exec_ctx_impl( struct slbt_exec_ctx_impl * ictx, int status) { + if (ictx->sctx) + slbt_lib_free_symlist_ctx(ictx->sctx); + if (ictx->fdwrapper >= 0) close(ictx->fdwrapper); @@ -598,6 +622,8 @@ slbt_hidden void slbt_reset_placeholders(struct slbt_exec_ctx * ectx) *ectx->lsoname = "-USLIBTOOL_PLACEHOLDER_LSONAME"; *ectx->symdefs = "-USLIBTOOL_PLACEHOLDER_SYMDEF_SWITCH"; *ectx->symfile = "-USLIBTOOL_PLACEHOLDER_SYMDEF_FILE"; + *ectx->explarg = "-USLIBTOOL_PLACEHOLDER_EXPSYMS_SWITCH"; + *ectx->expsyms = "-USLIBTOOL_PLACEHOLDER_EXPSYMS_FILE"; *ectx->lout[0] = "-USLIBTOOL_PLACEHOLDER_OUTPUT_SWITCH"; *ectx->lout[1] = "-USLIBTOOL_PLACEHOLDER_OUTPUT_FILE"; @@ -622,6 +648,8 @@ slbt_hidden void slbt_disable_placeholders(struct slbt_exec_ctx * ectx) *ectx->lsoname = 0; *ectx->symdefs = 0; *ectx->symfile = 0; + *ectx->explarg = 0; + *ectx->expsyms = 0; *ectx->lout[0] = 0; *ectx->lout[1] = 0; |