aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/cc
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2020-01-23 22:45:52 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2020-01-24 17:46:17 +0300
commit4fe006c07048338b01d5555f55162d9968bb46b6 (patch)
treed22c8d41b5631c2ed76ca73e8177ddd8e2122fb3 /libbuild2/cc
parent4c21d7de4e102c883d286dd11a36a96b21d5c589 (diff)
Don't pass dependency library non-export loptions to linker
Diffstat (limited to 'libbuild2/cc')
-rw-r--r--libbuild2/cc/link-rule.cxx12
1 files changed, 10 insertions, 2 deletions
diff --git a/libbuild2/cc/link-rule.cxx b/libbuild2/cc/link-rule.cxx
index 8da9619..ccb8dc6 100644
--- a/libbuild2/cc/link-rule.cxx
+++ b/libbuild2/cc/link-rule.cxx
@@ -1601,7 +1601,15 @@ namespace build2
{
// Don't try to pass any loptions when linking a static library.
//
- if (d.li.type == otype::a)
+ // Note also that we used to pass non-export loptions but that didn't
+ // turn out to be very natural. Specifically, we would end up linking
+ // things like version scripts (used to build the shared library
+ // variant) when linking the static variant. So now any loptions must
+ // be explicitly exported. Note that things are a bit fuzzy when it
+ // comes to utility libraries so let's keep the original logic with
+ // the exp checks below.
+ //
+ if (d.li.type == otype::a || !exp)
return;
// If we need an interface value, then use the group (lib{}).
@@ -1705,7 +1713,7 @@ namespace build2
bool com,
bool exp)
{
- if (d.li.type == otype::a)
+ if (d.li.type == otype::a || !exp)
return;
if (const target* g = exp && l.is_a<libs> () ? l.group : &l)