summaryrefslogtreecommitdiffhomepage
path: root/src/logic
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2016-04-09 21:19:57 -0400
committermidipix <writeonce@midipix.org>2016-04-09 21:19:57 -0400
commit79c501c4deee52047bd00d7c72800d5784293ee4 (patch)
treeb313636056771a294d96df32799eefba6c85d0eb /src/logic
parentcd3d414b8ebb378b0972d89e9ae1bd83ea3794f6 (diff)
downloadslibtool-79c501c4deee52047bd00d7c72800d5784293ee4.tar.bz2
slibtool-79c501c4deee52047bd00d7c72800d5784293ee4.tar.xz
link mode: fix executable wrapper generation to account for relative paths.
Diffstat (limited to 'src/logic')
-rw-r--r--src/logic/slbt_exec_link.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/src/logic/slbt_exec_link.c b/src/logic/slbt_exec_link.c
index 3648b94..4b5fdc8 100644
--- a/src/logic/slbt_exec_link.c
+++ b/src/logic/slbt_exec_link.c
@@ -144,6 +144,7 @@ static bool slbt_adjust_linker_argument(
static int slbt_exec_link_adjust_argument_vector(
const struct slbt_driver_ctx * dctx,
struct slbt_exec_ctx * ectx,
+ const char * cwd,
bool flibrary)
{
char ** carg;
@@ -199,9 +200,9 @@ static int slbt_exec_link_adjust_argument_vector(
*slash = '\0';
if (fprintf(ectx->fwrapper,
- "DL_PATH=\"$DL_PATH$COLON%s\"\n"
+ "DL_PATH=\"$DL_PATH$COLON%s/%s\"\n"
"COLON=':'\n\n",
- arg) < 0)
+ cwd,arg) < 0)
return -1;
}
@@ -323,6 +324,7 @@ static int slbt_exec_link_create_library(
const char * dsofilename)
{
char ** parg;
+ char cwd [PATH_MAX];
char output [PATH_MAX];
char soname [PATH_MAX];
@@ -375,9 +377,13 @@ static int slbt_exec_link_create_library(
*ectx->lout[0] = "-o";
*ectx->lout[1] = output;
+ /* cwd */
+ if (!getcwd(cwd,sizeof(cwd)))
+ return -1;
+
/* .libs/libfoo.so --> -L.libs -lfoo */
if (slbt_exec_link_adjust_argument_vector(
- dctx,ectx,true))
+ dctx,ectx,cwd,true))
return -1;
/* using alternate argument vector */
@@ -460,20 +466,20 @@ static int slbt_exec_link_create_executable(
*ectx->lout[0] = "-o";
*ectx->lout[1] = output;
+ /* cwd */
+ if (!getcwd(cwd,sizeof(cwd)))
+ return -1;
+
/* .libs/libfoo.so --> -L.libs -lfoo */
if (slbt_exec_link_adjust_argument_vector(
- dctx,ectx,false))
+ dctx,ectx,cwd,false))
return -1;
/* using alternate argument vector */
ectx->argv = ectx->altv;
ectx->program = ectx->altv[0];
-
/* executable wrapper: footer */
- if (!getcwd(cwd,sizeof(cwd)))
- return -1;
-
if (fprintf(ectx->fwrapper,
"DL_PATH=\"$DL_PATH$LCOLON$%s\"\n\n"
"export %s=$DL_PATH\n\n"