C++: Updates linking for cc_shared_library

Order of libraries should be topological sort when constructing depset for
LinkingContext.

Also remove condition that failed when it shouldn't with a valid combination of
libraries.

RELNOTES:none
PiperOrigin-RevId: 282943411
Change-Id: I0b727c4cdeaf484e1c4177a714542eae7f167613
This commit is contained in:
Googler 2019-11-28 07:52:56 -08:00 committed by Copybara-Service
parent 1f87a00b38
commit 03ae87bea3
1 changed files with 1 additions and 3 deletions

View File

@ -49,7 +49,7 @@ def _create_linker_context(ctx, static_linker_inputs, dynamic_linker_inputs):
linker_inputs.extend(static_linker_inputs) linker_inputs.extend(static_linker_inputs)
return cc_common.create_linking_context( return cc_common.create_linking_context(
linker_inputs = depset(linker_inputs), linker_inputs = depset(linker_inputs, order = "topological"),
) )
def _merge_cc_shared_library_infos(ctx): def _merge_cc_shared_library_infos(ctx):
@ -155,8 +155,6 @@ def _filter_inputs(ctx, feature_configuration, cc_toolchain, transitive_exports)
if not can_be_linked_statically: if not can_be_linked_statically:
fail("We can't link " + fail("We can't link " +
str(owner) + " either statically or dynamically") str(owner) + " either statically or dynamically")
else:
fail("Implementation error, this should not happen")
# Every direct dynamic_dep of this rule will be linked dynamically even if we # Every direct dynamic_dep of this rule will be linked dynamically even if we
# didn't reach a cc_library exported by one of these dynamic_deps. In other # didn't reach a cc_library exported by one of these dynamic_deps. In other