diff options
author | Ivan Lozano <ivanlozano@google.com> | 2019-09-20 11:00:37 -0700 |
---|---|---|
committer | Ivan Lozano <ivanlozano@google.com> | 2019-09-24 10:35:28 -0700 |
commit | f1c8433b40d2b62ec4bc87db8189fd655b817b5a (patch) | |
tree | 4e106bc747be28fbb5d0897c3ad6431d7d35f951 /rust/binary.go | |
parent | 5ca5ef6788a557f28edb8feea89e4493af2f4a67 (diff) |
Add AArch64 device Rust toolchain.
Bug: 141207434
Test: build example rust device module.
Change-Id: I0932a614942bf4a4d4b6c153fcc4fc79c7f202bd
Diffstat (limited to 'rust/binary.go')
-rw-r--r-- | rust/binary.go | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/rust/binary.go b/rust/binary.go index 279c6f50f..52f840e7a 100644 --- a/rust/binary.go +++ b/rust/binary.go @@ -71,6 +71,15 @@ func (binary *binaryDecorator) preferDynamic() bool { func (binary *binaryDecorator) compilerFlags(ctx ModuleContext, flags Flags) Flags { flags = binary.baseCompiler.compilerFlags(ctx, flags) + + if ctx.toolchain().Bionic() { + // no-undefined-version breaks dylib compilation since __rust_*alloc* functions aren't defined, but we can apply this to binaries. + flags.LinkFlags = append(flags.LinkFlags, + "-Wl,--gc-sections", + "-Wl,-z,nocopyreloc", + "-Wl,--no-undefined-version") + } + if binary.preferDynamic() { flags.RustFlags = append(flags.RustFlags, "-C prefer-dynamic") } @@ -86,6 +95,12 @@ func (binary *binaryDecorator) compilerDeps(ctx DepsContext, deps Deps) Deps { } } + if ctx.toolchain().Bionic() { + deps = binary.baseCompiler.bionicDeps(ctx, deps) + deps.CrtBegin = "crtbegin_dynamic" + deps.CrtEnd = "crtend_android" + } + return deps } |