summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2016-04-21 19:26:48 -0400
committermidipix <writeonce@midipix.org>2016-04-21 19:27:59 -0400
commit94ae747d1e600883992c26349e39fea05bdc16c4 (patch)
treebed7cbfd8e94215549bba31b81a5fc2b904ec8cb
parent9bf2c5132c9c28db0639c29278d56e60dab48509 (diff)
downloadslibtool-94ae747d1e600883992c26349e39fea05bdc16c4.tar.bz2
slibtool-94ae747d1e600883992c26349e39fea05bdc16c4.tar.xz
link mode: account for archives that were created via direct ar(1) invocation.
-rw-r--r--src/logic/slbt_exec_link.c33
1 files changed, 18 insertions, 15 deletions
diff --git a/src/logic/slbt_exec_link.c b/src/logic/slbt_exec_link.c
index 141229d..267e292 100644
--- a/src/logic/slbt_exec_link.c
+++ b/src/logic/slbt_exec_link.c
@@ -223,6 +223,7 @@ static int slbt_exec_link_adjust_argument_vector(
char * dot;
FILE * fdeps;
char * dpath;
+ bool freqd;
int argc;
char arg[PATH_MAX];
char lib[PATH_MAX];
@@ -246,6 +247,7 @@ static int slbt_exec_link_adjust_argument_vector(
for (; *carg; ) {
dpath = 0;
+ freqd = false;
if (!strcmp(*carg,"-Wl,--whole-archive"))
fwholearchive = true;
@@ -279,6 +281,7 @@ static int slbt_exec_link_adjust_argument_vector(
*aarg++ = *carg++;
} else {
dpath = lib;
+ freqd = true;
sprintf(lib,"%s.slibtool.deps",*carg);
/* account for {'-','L','-','l'} */
@@ -319,25 +322,25 @@ static int slbt_exec_link_adjust_argument_vector(
if (dpath) {
*aarg = darg;
- if (!(fdeps = fopen(dpath,"r"))) {
- free(depsmeta->altv);
- free(depsmeta->args);
- return -1;
- }
-
- while (fscanf(fdeps,"%s\n",darg) == 1) {
- *aarg++ = darg;
- darg += strlen(darg);
- darg++;
- }
+ if ((fdeps = fopen(dpath,"r"))) {
+ while (fscanf(fdeps,"%s\n",darg) == 1) {
+ *aarg++ = darg;
+ darg += strlen(darg);
+ darg++;
+ }
- if (ferror(fdeps)) {
+ if (ferror(fdeps)) {
+ free(depsmeta->altv);
+ free(depsmeta->args);
+ fclose(fdeps);
+ return -1;
+ } else {
+ fclose(fdeps);
+ }
+ } else if (freqd) {
free(depsmeta->altv);
free(depsmeta->args);
- fclose(fdeps);
return -1;
- } else {
- fclose(fdeps);
}
}
}