[PATCH] D44798: [libFuzzer] Use OptForFuzzing attribute with -fsanitize=fuzzer.

Matt Morehouse via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 23 16:40:45 PDT 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rC328384: [libFuzzer] Use OptForFuzzing attribute with -fsanitize=fuzzer. (authored by morehouse, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D44798?vs=139673&id=139675#toc

Repository:
  rC Clang

https://reviews.llvm.org/D44798

Files:
  lib/CodeGen/CodeGenFunction.cpp


Index: lib/CodeGen/CodeGenFunction.cpp
===================================================================
--- lib/CodeGen/CodeGenFunction.cpp
+++ lib/CodeGen/CodeGenFunction.cpp
@@ -862,6 +862,10 @@
   if (SanOpts.has(SanitizerKind::SafeStack))
     Fn->addFnAttr(llvm::Attribute::SafeStack);
 
+  // Apply fuzzing attribute to the function.
+  if (SanOpts.hasOneOf(SanitizerKind::Fuzzer | SanitizerKind::FuzzerNoLink))
+    Fn->addFnAttr(llvm::Attribute::OptForFuzzing);
+
   // Ignore TSan memory acesses from within ObjC/ObjC++ dealloc, initialize,
   // .cxx_destruct, __destroy_helper_block_ and all of their calees at run time.
   if (SanOpts.has(SanitizerKind::Thread)) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D44798.139675.patch
Type: text/x-patch
Size: 680 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180323/b749826f/attachment.bin>


More information about the llvm-commits mailing list