diff options
-rw-r--r-- | src/logic/linkcmd/slbt_linkcmd_dsolib.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/logic/linkcmd/slbt_linkcmd_dsolib.c b/src/logic/linkcmd/slbt_linkcmd_dsolib.c index 38ecbd3..00705a1 100644 --- a/src/logic/linkcmd/slbt_linkcmd_dsolib.c +++ b/src/logic/linkcmd/slbt_linkcmd_dsolib.c @@ -72,6 +72,7 @@ slbt_hidden int slbt_exec_link_create_library( char output [PATH_MAX]; char soname [PATH_MAX]; char symfile[PATH_MAX]; + char mapfile[PATH_MAX]; struct slbt_deps_meta depsmeta = {0,0,0,0}; /* initial state */ @@ -198,6 +199,31 @@ slbt_hidden int slbt_exec_link_create_library( *ectx->symfile = symfile; } + /* -export-symbols */ + if (dctx->cctx->expsyms) { + struct slbt_symlist_ctx * sctx; + sctx = (slbt_get_exec_ictx(ectx))->sctx; + + if (slbt_util_create_mapfile(sctx,ectx->mapfilename,0644) < 0) + return SLBT_NESTED_ERROR(dctx); + + if (slbt_snprintf(mapfile,sizeof(mapfile), + "-Wl,%s", + ectx->mapfilename) < 0) + return SLBT_BUFFER_ERROR(dctx); + + if (slbt_host_group_is_darwin(dctx)) { + *ectx->explarg = "-Wl,-exported_symbols_list"; + *ectx->expsyms = mapfile; + + } else if (slbt_host_group_is_winnt(dctx)) { + *ectx->expsyms = mapfile; + } else { + *ectx->explarg = "-Wl,--version-script"; + *ectx->expsyms = mapfile; + } + } + /* shared/static */ if (dctx->cctx->drvflags & SLBT_DRIVER_ALL_STATIC) { *ectx->dpic = "-static"; |