[PATCH] D44784: DataFlowSanitizer: do not allow wrapper functions with non-local linkage to have dso_local set.

Sam Kerner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 22 08:56:01 PDT 2018


skerner updated this revision to Diff 139451.
skerner added a comment.

Revert a file which was mistakenly included.


Repository:
  rL LLVM

https://reviews.llvm.org/D44784

Files:
  lib/Transforms/Instrumentation/DataFlowSanitizer.cpp
  test/Instrumentation/DataFlowSanitizer/Inputs/abilist.txt
  test/Instrumentation/DataFlowSanitizer/uninstrumented_internal_function.ll


Index: test/Instrumentation/DataFlowSanitizer/uninstrumented_internal_function.ll
===================================================================
--- /dev/null
+++ test/Instrumentation/DataFlowSanitizer/uninstrumented_internal_function.ll
@@ -0,0 +1,16 @@
+; RUN: opt < %s -dfsan -dfsan-args-abi -dfsan-abilist=%S/Inputs/abilist.txt -S | FileCheck %s
+; RUN: opt < %s -dfsan                 -dfsan-abilist=%S/Inputs/abilist.txt -S | FileCheck %s
+
+target triple = "x86_64-unknown-linux-gnu"
+
+define internal i8 @uninstrumented_internal_fun(i8 %in) {
+  ret i8 %in
+}
+
+define i8 @call_uninstrumented_fun(i8 %in) {
+  %call = call i8 @uninstrumented_internal_fun(i8 %in)
+  ret i8 %call
+}
+
+; CHECK: define linkonce_odr {{(i8|{ i8, i16 })}} @"dfsw$uninstrumented_internal_fun"
+; CHECK-NOT: dso_local
Index: test/Instrumentation/DataFlowSanitizer/Inputs/abilist.txt
===================================================================
--- test/Instrumentation/DataFlowSanitizer/Inputs/abilist.txt
+++ test/Instrumentation/DataFlowSanitizer/Inputs/abilist.txt
@@ -6,3 +6,5 @@
 
 fun:custom*=uninstrumented
 fun:custom*=custom
+
+fun:uninstrumented*=uninstrumented
Index: lib/Transforms/Instrumentation/DataFlowSanitizer.cpp
===================================================================
--- lib/Transforms/Instrumentation/DataFlowSanitizer.cpp
+++ lib/Transforms/Instrumentation/DataFlowSanitizer.cpp
@@ -653,6 +653,13 @@
       AttributeList::ReturnIndex,
       AttributeFuncs::typeIncompatible(NewFT->getReturnType()));
 
+  // If the function being created has non-local linkage, it should not have the
+  // dso_local attribute.  Explicitly remove dso_local, in case it was set when
+  // attributes were copied from F.
+  if (!NewF->hasLocalLinkage()) {
+    NewF->setDSOLocal(false);
+  }
+
   BasicBlock *BB = BasicBlock::Create(*Ctx, "entry", NewF);
   if (F->isVarArg()) {
     NewF->removeAttributes(AttributeList::FunctionIndex,


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D44784.139451.patch
Type: text/x-patch
Size: 1953 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180322/36e20714/attachment.bin>


More information about the llvm-commits mailing list