diff options
author | 2021-09-10 09:29:38 -0700 | |
---|---|---|
committer | 2021-09-10 10:33:30 -0700 | |
commit | 1799f9d7b4c95ebe0e114dde4775dbc637691c10 (patch) | |
tree | b29c6e2f5faa3c0956bd4b5b96d6cb55db1e6228 /rust/coverage.go | |
parent | eee562f950c02a07ffc9380b115a9e5905ec9f32 (diff) |
[rust/coverage] Pass -z,nostart-stop-gc to the linker
Bug: http://b/199203503
Upstream LLVM change 6d2d3bd0a6 made -z,start-stop-gc the default. It
drops metadata sections like __llvm_prf_data unless they are marked
SHF_GNU_RETAIN. https://reviews.llvm.org/D97448 marks generated
sections, including __llvm_prf_data as SHF_GNU_RETAIN. However this
change is not in the Rust toolchain. Since we link Rust libs with new
lld, we should use nostart-stop-gc until the Rust toolchain updates past
D97448.
Test: m unicode-xid_device_test_src_lib and verify that they have the
__llvm_prf_data section.
Change-Id: I55eb3622dae9bd789fbacfe708600316102c365f
Diffstat (limited to 'rust/coverage.go')
-rw-r--r-- | rust/coverage.go | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/rust/coverage.go b/rust/coverage.go index 050b811c7..8fdfa2342 100644 --- a/rust/coverage.go +++ b/rust/coverage.go @@ -57,7 +57,18 @@ func (cov *coverage) flags(ctx ModuleContext, flags Flags, deps PathDeps) (Flags flags.RustFlags = append(flags.RustFlags, "-Z instrument-coverage", "-g") flags.LinkFlags = append(flags.LinkFlags, - profileInstrFlag, "-g", coverage.OutputFile().Path().String(), "-Wl,--wrap,open") + profileInstrFlag, "-g", coverage.OutputFile().Path().String(), "-Wl,--wrap,open", + // Upstream LLVM change 6d2d3bd0a6 made + // -z,start-stop-gc the default. It drops metadata + // sections like __llvm_prf_data unless they are marked + // SHF_GNU_RETAIN. https://reviews.llvm.org/D97448 + // marks generated sections, including __llvm_prf_data + // as SHF_GNU_RETAIN. However this change is not in + // the Rust toolchain. Since we link Rust libs with + // new lld, we should use nostart-stop-gc until the + // Rust toolchain updates past D97448. + "-Wl,-z,nostart-stop-gc", + ) deps.StaticLibs = append(deps.StaticLibs, coverage.OutputFile().Path()) } |