hwasan: Enable -hwasan-allow-ifunc by default.
authorPeter Collingbourne <peter@pcc.me.uk>
Tue, 9 Apr 2019 00:25:59 +0000 (00:25 +0000)
committerPeter Collingbourne <peter@pcc.me.uk>
Tue, 9 Apr 2019 00:25:59 +0000 (00:25 +0000)
It's been on in Android for a while without causing problems, so it's time
to make it the default and remove the flag.

Differential Revision: https://reviews.llvm.org/D60355

llvm-svn: 357960

compiler-rt/test/hwasan/lit.cfg
llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
llvm/test/Instrumentation/HWAddressSanitizer/lazy-thread-init.ll
llvm/test/Instrumentation/HWAddressSanitizer/prologue.ll

index 0f1fdbd..66008a6 100644 (file)
@@ -11,8 +11,7 @@ config.test_source_root = os.path.dirname(__file__)
 # Setup default compiler flags used with -fsanitize=memory option.
 clang_cflags = [config.target_cflags] + config.debug_info_flags
 clang_cxxflags = config.cxx_mode_flags + clang_cflags
 # Setup default compiler flags used with -fsanitize=memory option.
 clang_cflags = [config.target_cflags] + config.debug_info_flags
 clang_cxxflags = config.cxx_mode_flags + clang_cflags
-clang_hwasan_cflags = ["-fsanitize=hwaddress", "-mllvm", "-hwasan-generate-tags-with-calls",
-                       "-mllvm", "-hwasan-allow-ifunc"] + clang_cflags
+clang_hwasan_cflags = ["-fsanitize=hwaddress", "-mllvm", "-hwasan-generate-tags-with-calls"] + clang_cflags
 clang_hwasan_cxxflags = config.cxx_mode_flags + clang_hwasan_cflags
 
 def build_invocation(compile_flags):
 clang_hwasan_cxxflags = config.cxx_mode_flags + clang_hwasan_cflags
 
 def build_invocation(compile_flags):
index 6ecbd23..71eaf46 100644 (file)
@@ -160,10 +160,6 @@ static cl::opt<bool> ClInlineAllChecks("hwasan-inline-all-checks",
                                        cl::desc("inline all checks"),
                                        cl::Hidden, cl::init(false));
 
                                        cl::desc("inline all checks"),
                                        cl::Hidden, cl::init(false));
 
-static cl::opt<bool> ClAllowIfunc("hwasan-allow-ifunc",
-                                  cl::desc("allow the use of ifunc"),
-                                  cl::Hidden, cl::init(false));
-
 namespace {
 
 /// An instrumentation pass implementing detection of addressability bugs
 namespace {
 
 /// An instrumentation pass implementing detection of addressability bugs
@@ -836,7 +832,7 @@ Value *HWAddressSanitizer::emitPrologue(IRBuilder<> &IRB,
   if (!Mapping.InTls)
     return getDynamicShadowNonTls(IRB);
 
   if (!Mapping.InTls)
     return getDynamicShadowNonTls(IRB);
 
-  if (ClAllowIfunc && !WithFrameRecord && TargetTriple.isAndroid())
+  if (!WithFrameRecord && TargetTriple.isAndroid())
     return getDynamicShadowIfunc(IRB);
 
   Value *SlotPtr = getHwasanThreadSlotPtr(IRB, IntptrTy);
     return getDynamicShadowIfunc(IRB);
 
   Value *SlotPtr = getHwasanThreadSlotPtr(IRB, IntptrTy);
index d5a2541..6c445ed 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: opt -S -hwasan -hwasan-allow-ifunc < %s | FileCheck %s
+; RUN: opt -S -hwasan < %s | FileCheck %s
 
 target triple = "aarch64--linux-android"
 
 
 target triple = "aarch64--linux-android"
 
index 1163dbe..d9913f8 100644 (file)
@@ -1,14 +1,14 @@
 ; Test -hwasan-with-ifunc flag.
 ;
 ; Test -hwasan-with-ifunc flag.
 ;
-; RUN: opt -hwasan -hwasan-allow-ifunc -S < %s | \
+; RUN: opt -hwasan -S < %s | \
 ; RUN:     FileCheck %s --check-prefixes=CHECK,CHECK-NOGLOBAL,CHECK-TLS,CHECK-HISTORY
 ; RUN:     FileCheck %s --check-prefixes=CHECK,CHECK-NOGLOBAL,CHECK-TLS,CHECK-HISTORY
-; RUN: opt -hwasan -hwasan-allow-ifunc -S -hwasan-with-ifunc=0 -hwasan-with-tls=1 -hwasan-record-stack-history=1 < %s | \
+; RUN: opt -hwasan -S -hwasan-with-ifunc=0 -hwasan-with-tls=1 -hwasan-record-stack-history=1 < %s | \
 ; RUN:     FileCheck %s --check-prefixes=CHECK,CHECK-NOGLOBAL,CHECK-TLS,CHECK-HISTORY
 ; RUN:     FileCheck %s --check-prefixes=CHECK,CHECK-NOGLOBAL,CHECK-TLS,CHECK-HISTORY
-; RUN: opt -hwasan -hwasan-allow-ifunc -S -hwasan-with-ifunc=0 -hwasan-with-tls=1 -hwasan-record-stack-history=0 < %s | \
+; RUN: opt -hwasan -S -hwasan-with-ifunc=0 -hwasan-with-tls=1 -hwasan-record-stack-history=0 < %s | \
 ; RUN:     FileCheck %s --check-prefixes=CHECK,CHECK-NOGLOBAL,CHECK-IFUNC,CHECK-NOHISTORY
 ; RUN:     FileCheck %s --check-prefixes=CHECK,CHECK-NOGLOBAL,CHECK-IFUNC,CHECK-NOHISTORY
-; RUN: opt -hwasan -hwasan-allow-ifunc -S -hwasan-with-ifunc=0 -hwasan-with-tls=0 < %s | \
+; RUN: opt -hwasan -S -hwasan-with-ifunc=0 -hwasan-with-tls=0 < %s | \
 ; RUN:     FileCheck %s --check-prefixes=CHECK,CHECK-GLOBAL,CHECK-NOHISTORY
 ; RUN:     FileCheck %s --check-prefixes=CHECK,CHECK-GLOBAL,CHECK-NOHISTORY
-; RUN: opt -hwasan -hwasan-allow-ifunc -S -hwasan-with-ifunc=1  -hwasan-with-tls=0 < %s | \
+; RUN: opt -hwasan -S -hwasan-with-ifunc=1  -hwasan-with-tls=0 < %s | \
 ; RUN:     FileCheck %s --check-prefixes=CHECK,CHECk-NOGLOBAL,CHECK-IFUNC,CHECK-NOHISTORY
 
 target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128"
 ; RUN:     FileCheck %s --check-prefixes=CHECK,CHECk-NOGLOBAL,CHECK-IFUNC,CHECK-NOHISTORY
 
 target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128"