Merge "Rust: abort on panic" am: 0e737626fc am: 16f751c248

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

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Id27627398018fbe72633e78ae305559606259360
This commit is contained in:
Ivan Lozano 2021-01-26 20:37:41 +00:00 committed by Automerger Merge Worker
commit f1014b6d0f
3 changed files with 9 additions and 1 deletions

View File

@ -130,6 +130,9 @@ func TestStaticBinaryFlags(t *testing.T) {
if !strings.Contains(flags, "-C relocation-model=static") {
t.Errorf("static binary missing '-C relocation-model=static' in rustcFlags, found: %#v", flags)
}
if !strings.Contains(flags, "-C panic=abort") {
t.Errorf("static binary missing '-C panic=abort' in rustcFlags, found: %#v", flags)
}
if !strings.Contains(linkFlags, "-static") {
t.Errorf("static binary missing '-static' in linkFlags, found: %#v", flags)
}

View File

@ -49,7 +49,9 @@ var (
"-C relocation-model=pic",
}
deviceGlobalRustFlags = []string{}
deviceGlobalRustFlags = []string{
"-C panic=abort",
}
deviceGlobalLinkFlags = []string{
// Prepend the lld flags from cc_config so we stay in sync with cc

View File

@ -120,6 +120,9 @@ func (test *testDecorator) compilerFlags(ctx ModuleContext, flags Flags) Flags {
if test.testHarness() {
flags.RustFlags = append(flags.RustFlags, "--test")
}
if ctx.Device() {
flags.RustFlags = append(flags.RustFlags, "-Z panic_abort_tests")
}
return flags
}