rust: Do not pass -C prefer-dynamic for cdylib

cdylib targets cannot currently dynamically link to Rust crates, so this
flag was not actually doing anything, and in conjunction with -C lto
which we *do* want on for this target, causes a hard error on
rustc-1.40.0.

Bug: 147438124
Test: Build a rust_library module, this implicitly tries to build cdylib
Change-Id: I828b3e6bae7c58f4081db3e73009b443a382a296
This commit is contained in:
Matthew Maurer 2020-01-13 16:34:34 -08:00
parent 22cef966e1
commit 46c46ccafd

View file

@ -338,7 +338,7 @@ func (library *libraryDecorator) compile(ctx ModuleContext, flags Flags, deps Pa
flags.RustFlags = append(flags.RustFlags, deps.depFlags...)
if library.dylib() || library.shared() {
if library.dylib() {
// We need prefer-dynamic for now to avoid linking in the static stdlib. See:
// https://github.com/rust-lang/rust/issues/19680
// https://github.com/rust-lang/rust/issues/34909