summaryrefslogtreecommitdiff
path: root/src/logic
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2017-08-10 15:49:25 -0400
committermidipix <writeonce@midipix.org>2017-08-10 15:51:26 -0400
commitcd541a44cbf6a1b71eda2c2da4c3b0aaf69d0128 (patch)
tree021e892df1ce4852f108bce64df9145da35508ac /src/logic
parent79932950b9140fc1604904a13311b87c1929f751 (diff)
downloadslibtool-cd541a44cbf6a1b71eda2c2da4c3b0aaf69d0128.tar.bz2
slibtool-cd541a44cbf6a1b71eda2c2da4c3b0aaf69d0128.tar.xz
link mode: argument reordering now supports libfoo.a --whole-archive wrapping.
Diffstat (limited to 'src/logic')
-rw-r--r--src/logic/slbt_exec_link.c32
1 files changed, 21 insertions, 11 deletions
diff --git a/src/logic/slbt_exec_link.c b/src/logic/slbt_exec_link.c
index 7cbad2e..2f57a79 100644
--- a/src/logic/slbt_exec_link.c
+++ b/src/logic/slbt_exec_link.c
@@ -511,17 +511,13 @@ static int slbt_exec_link_finalize_argument_vector(
for (parg=ectx->argv; *parg; parg++) {
arg = *parg;
- if (arg[0] == '-') {
- if ((arg[1] == 'l') || arg[1] == 'L') {
- last = parg - base;
- first = first ? first : last;
- } else if (!objidx
- && (arg[1] == 'W')
- && (arg[2] == 'l')
- && (arg[3] == ',')) {
- last = parg - base;
- first = first ? first : last;
- }
+ if ((arg[0] == '-') && (arg[1] == 'l')) {
+ last = parg - base;
+ first = first ? first : last;
+
+ } else if ((arg[0] == '-') && (arg[1] == 'L')) {
+ last = parg - base;
+ first = first ? first : last;
} else if (objidx) {
(void)0;
@@ -533,6 +529,20 @@ static int slbt_exec_link_finalize_argument_vector(
|| !strcmp(dot,dctx->cctx->settings.dsosuffix)
|| !strcmp(dot,dctx->cctx->settings.impsuffix))
objidx = parg - base;
+ } else if ((arg[0] == '-')
+ && (arg[1] == 'W')
+ && (arg[2] == 'l')
+ && (arg[3] == ',')) {
+ if ((!strcmp(&arg[4],"--whole-archive"))
+ && parg[1] && parg[2]
+ && !strcmp(parg[2],"-Wl,--no-whole-archive")
+ && (dot = strrchr(parg[1],'.'))
+ && !strcmp(dot,dctx->cctx->settings.arsuffix)) {
+ objidx = parg - base;
+ } else {
+ last = parg - base;
+ first = first ? first : last;
+ }
}
}