Set -fno-emulated-tls for riscv64
Building for riscv64 fails with link errors on __thread variables.
Set -fno-emulated-tls to fix it.
Bug: 254713216
Test: lunch aosp_riscv64-userdebug && m ALLOW_MISSING_DEPENDENCIES=true ndk_sysroot
Change-Id: I3dca81dfd277d681b6c868a5e8385e3a37335a5f
diff --git a/cc/config/riscv64_device.go b/cc/config/riscv64_device.go
index d8918f1..825be7f 100644
--- a/cc/config/riscv64_device.go
+++ b/cc/config/riscv64_device.go
@@ -25,6 +25,7 @@
riscv64Cflags = []string{
// Help catch common 32/64-bit errors.
"-Werror=implicit-function-declaration",
+ "-fno-emulated-tls",
}
riscv64ArchVariantCflags = map[string][]string{}
diff --git a/cc/lto.go b/cc/lto.go
index e068b05..1afa1dd 100644
--- a/cc/lto.go
+++ b/cc/lto.go
@@ -91,7 +91,7 @@
return flags
}
- // LTO doesn't work on riscv64 yet.
+ // TODO(b/254713216): LTO doesn't work on riscv64 yet.
if ctx.Arch().ArchType == android.Riscv64 {
return flags
}
diff --git a/cc/sanitize.go b/cc/sanitize.go
index d39b0eb..b8cc432 100644
--- a/cc/sanitize.go
+++ b/cc/sanitize.go
@@ -511,7 +511,7 @@
s.Integer_overflow = nil
}
- // CFI doesn't work for riscv64 yet because LTO doesn't work.
+ // TODO(b/254713216): CFI doesn't work for riscv64 yet because LTO doesn't work.
if ctx.Arch().ArchType == android.Riscv64 {
s.Cfi = nil
s.Diag.Cfi = nil