Disable CFI on Mips and add -march to linkflags on ARM.
Mips toolchain does not have ld.gold. ARM change is a workaround for LLVM r290384. Bug: 33678192 Test: make ENABLE_CFI=1 Change-Id: I189ffd42760f0ea8d151717337b9355b37cb207b
This commit is contained in:
@@ -167,7 +167,8 @@ func (sanitize *sanitize) begin(ctx BaseModuleContext) {
|
||||
}
|
||||
}
|
||||
|
||||
if !ctx.AConfig().EnableCFI() {
|
||||
// CFI needs gold linker, and mips toolchain does not have one.
|
||||
if !ctx.AConfig().EnableCFI() || ctx.Arch().ArchType == android.Mips || ctx.Arch().ArchType == android.Mips64 {
|
||||
s.Cfi = nil
|
||||
s.Diag.Cfi = nil
|
||||
}
|
||||
@@ -312,6 +313,9 @@ func (sanitize *sanitize) flags(ctx ModuleContext, flags Flags) Flags {
|
||||
// __cfi_check needs to be built as Thumb (see the code in linker_cfi.cpp). LLVM is not set up
|
||||
// to do this on a function basis, so force Thumb on the entire module.
|
||||
flags.RequiredInstructionSet = "thumb"
|
||||
// Workaround for b/33678192. CFI jumptables need Thumb2 codegen. Revert when
|
||||
// Clang is updated past r290384.
|
||||
flags.LdFlags = append(flags.LdFlags, "-march=armv7-a")
|
||||
}
|
||||
sanitizers = append(sanitizers, "cfi")
|
||||
cfiFlags := []string{"-flto", "-fsanitize=cfi", "-fsanitize-cfi-cross-dso"}
|
||||
|
Reference in New Issue
Block a user