Index: clang/lib/CodeGen/CodeGenModule.cpp =================================================================== --- clang/lib/CodeGen/CodeGenModule.cpp +++ clang/lib/CodeGen/CodeGenModule.cpp @@ -5581,7 +5581,9 @@ Entry->eraseFromParent(); } else GIF->setName(MangledName); - + if (auto *F = dyn_cast(Resolver)) { + F->addFnAttr(llvm::Attribute::DisableSanitizerInstrumentation); + } SetCommonAttributes(GD, GIF); } Index: clang/test/CodeGen/ifunc.c =================================================================== --- clang/test/CodeGen/ifunc.c +++ clang/test/CodeGen/ifunc.c @@ -1,5 +1,8 @@ // RUN: %clang_cc1 -triple i386-unknown-linux-gnu -emit-llvm -o - %s | FileCheck %s // RUN: %clang_cc1 -triple i386-unknown-linux-gnu -O2 -emit-llvm -o - %s | FileCheck %s +// RUN: %clang_cc1 -triple i386-unknown-linux-gnu -fsanitize=thread -O2 -emit-llvm -o - %s | FileCheck %s --check-prefix=SAN +// RUN: %clang_cc1 -triple i386-unknown-linux-gnu -fsanitize=address -O2 -emit-llvm -o - %s | FileCheck %s --check-prefix=SAN +// RUN: %clang_cc1 -triple i386-unknown-linux-gnu -fsanitize=memory -O2 -emit-llvm -o - %s | FileCheck %s --check-prefix=SAN int foo(int) __attribute__ ((ifunc("foo_ifunc"))); @@ -39,3 +42,11 @@ // CHECK: call i32 @foo(i32 // CHECK: call void @goo() + +// SAN: define internal nonnull ptr @foo_ifunc() #[[#FOO_IFUNC:]] { + +// SAN: define dso_local noalias ptr @goo_ifunc() #[[#GOO_IFUNC:]] { + +// SAN-DAG: attributes #[[#FOO_IFUNC]] = {{{.*}} disable_sanitizer_instrumentation {{.*}} + +// SAN-DAG: attributes #[[#GOO_IFUNC]] = {{{.*}} disable_sanitizer_instrumentation {{.*}}