Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0c0e2455 authored by Pirama Arumuga Nainar's avatar Pirama Arumuga Nainar Committed by Automerger Merge Worker
Browse files

[rust/coverage] Pass -z,nostart-stop-gc to the linker am: 1799f9d7 am: 4c30b7f2

Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1824020

Change-Id: I70182aad912e37ad1e3e7beef009f445e10d0d72
parents b54ad882 4c30b7f2
Loading
Loading
Loading
Loading
+12 −1
Original line number Diff line number Diff line
@@ -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())
	}