Merge "Export rust flags to bazel" into main am: 4414c4e7ff
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2758107 Change-Id: I9ffea540fd7c16c879b8fa0e1f75184be86a475e Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
commit
c4f7a89c7a
2 changed files with 15 additions and 9 deletions
|
@ -330,14 +330,7 @@ func (compiler *baseCompiler) compilerFlags(ctx ModuleContext, flags Flags) Flag
|
||||||
if ctx.Os() == android.Linux {
|
if ctx.Os() == android.Linux {
|
||||||
// Add -lc, -lrt, -ldl, -lpthread, -lm and -lgcc_s to glibc builds to match
|
// Add -lc, -lrt, -ldl, -lpthread, -lm and -lgcc_s to glibc builds to match
|
||||||
// the default behavior of device builds.
|
// the default behavior of device builds.
|
||||||
flags.LinkFlags = append(flags.LinkFlags,
|
flags.LinkFlags = append(flags.LinkFlags, config.LinuxHostGlobalLinkFlags...)
|
||||||
"-lc",
|
|
||||||
"-lrt",
|
|
||||||
"-ldl",
|
|
||||||
"-lpthread",
|
|
||||||
"-lm",
|
|
||||||
"-lgcc_s",
|
|
||||||
)
|
|
||||||
} else if ctx.Os() == android.Darwin {
|
} else if ctx.Os() == android.Darwin {
|
||||||
// Add -lc, -ldl, -lpthread and -lm to glibc darwin builds to match the default
|
// Add -lc, -ldl, -lpthread and -lm to glibc darwin builds to match the default
|
||||||
// behavior of device builds.
|
// behavior of device builds.
|
||||||
|
|
|
@ -52,11 +52,22 @@ var (
|
||||||
"-C force-unwind-tables=yes",
|
"-C force-unwind-tables=yes",
|
||||||
// Use v0 mangling to distinguish from C++ symbols
|
// Use v0 mangling to distinguish from C++ symbols
|
||||||
"-C symbol-mangling-version=v0",
|
"-C symbol-mangling-version=v0",
|
||||||
"--color always",
|
// This flag requires to have no space so that when it's exported to bazel
|
||||||
|
// it can be removed. See aosp/2768339
|
||||||
|
"--color=always",
|
||||||
"-Zdylib-lto",
|
"-Zdylib-lto",
|
||||||
"-Z link-native-libraries=no",
|
"-Z link-native-libraries=no",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LinuxHostGlobalLinkFlags = []string{
|
||||||
|
"-lc",
|
||||||
|
"-lrt",
|
||||||
|
"-ldl",
|
||||||
|
"-lpthread",
|
||||||
|
"-lm",
|
||||||
|
"-lgcc_s",
|
||||||
|
}
|
||||||
|
|
||||||
deviceGlobalRustFlags = []string{
|
deviceGlobalRustFlags = []string{
|
||||||
"-C panic=abort",
|
"-C panic=abort",
|
||||||
// Generate additional debug info for AutoFDO
|
// Generate additional debug info for AutoFDO
|
||||||
|
@ -101,6 +112,8 @@ func init() {
|
||||||
pctx.StaticVariable("DeviceGlobalLinkFlags", strings.Join(deviceGlobalLinkFlags, " "))
|
pctx.StaticVariable("DeviceGlobalLinkFlags", strings.Join(deviceGlobalLinkFlags, " "))
|
||||||
|
|
||||||
exportedVars.ExportStringStaticVariable("RUST_DEFAULT_VERSION", RustDefaultVersion)
|
exportedVars.ExportStringStaticVariable("RUST_DEFAULT_VERSION", RustDefaultVersion)
|
||||||
|
exportedVars.ExportStringListStaticVariable("GLOBAL_RUSTC_FLAGS", GlobalRustFlags)
|
||||||
|
exportedVars.ExportStringListStaticVariable("LINUX_HOST_GLOBAL_LINK_FLAGS", LinuxHostGlobalLinkFlags)
|
||||||
}
|
}
|
||||||
|
|
||||||
func HostPrebuiltTag(config android.Config) string {
|
func HostPrebuiltTag(config android.Config) string {
|
||||||
|
|
Loading…
Reference in a new issue