Don't classify Rust static libraries as final c5a0ec650 made an incorrect assumption that Rust static libraries, unlike their C/C++ counterparts are always considered final which is not actually true and has manifested as link errors in practice. This change is effectively a revert of c5a0ec650. Change-Id: I92c4568ec3e1ea994f11e2332b066e8300bb5716 Reviewed-on: https://gn-review.googlesource.com/c/gn/+/10160 Reviewed-by: Brett Wilson <brettw@chromium.org> Commit-Queue: Petr Hosek <phosek@google.com>
diff --git a/src/gn/ninja_c_binary_target_writer_unittest.cc b/src/gn/ninja_c_binary_target_writer_unittest.cc index c4941fa..540e755 100644 --- a/src/gn/ninja_c_binary_target_writer_unittest.cc +++ b/src/gn/ninja_c_binary_target_writer_unittest.cc
@@ -1422,14 +1422,14 @@ "build obj/bar/bar.bar.o: cxx ../../bar/bar.cc\n" "\n" "build ./bar: link obj/bar/bar.bar.o obj/foo/libfoo.a | " - "obj/quux/lib4.rlib obj/qux/lib2.rlib\n" + "obj/baz/lib.rlib obj/quux/lib4.rlib obj/qux/lib2.rlib\n" " ldflags =\n" " libs =\n" " frameworks =\n" " swiftmodules =\n" " output_extension = \n" " output_dir = \n" - " rlibs = obj/quux/lib4.rlib obj/qux/lib2.rlib\n"; + " rlibs = obj/baz/lib.rlib obj/quux/lib4.rlib obj/qux/lib2.rlib\n"; std::string out_str = out.str(); EXPECT_EQ(expected, out_str) << expected << "\n" << out_str;
diff --git a/src/gn/target.cc b/src/gn/target.cc index c4662e0..6b28107 100644 --- a/src/gn/target.cc +++ b/src/gn/target.cc
@@ -436,12 +436,7 @@ output_type_ == LOADABLE_MODULE || output_type_ == ACTION || output_type_ == ACTION_FOREACH || output_type_ == COPY_FILES || output_type_ == CREATE_BUNDLE || output_type_ == RUST_PROC_MACRO || - (output_type_ == STATIC_LIBRARY && - (complete_static_lib_ || - // Rust static libraries may be used from C/C++ code and therefore - // require all dependencies to be linked in as we cannot link their - // (Rust) dependencies directly as we would for C/C++. - source_types_used_.RustSourceUsed())); + (output_type_ == STATIC_LIBRARY && complete_static_lib_); } DepsIteratorRange Target::GetDeps(DepsIterationType type) const {