From 4fe006c07048338b01d5555f55162d9968bb46b6 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Thu, 23 Jan 2020 22:45:52 +0300 Subject: Don't pass dependency library non-export loptions to linker --- libbuild2/cc/link-rule.cxx | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'libbuild2/cc') 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 () ? l.group : &l) -- cgit v1.1