[cfe-dev] Build issues when trying to use LibFuzzer on Mac OS X

Marshall Clow mclow.lists at gmail.com
Mon Jun 1 08:36:13 PDT 2015

I'm trying to use LibFuzzer on my Mac - following the directions here:

But when I try to link my program and the Fuzzer object code, I get errors.

They appear to be symbols from compiler-rt that are missing.
Do I need a better (i.e, more recent) compiler-rt than the one that Apple

"totclang" --> freshly built clang.

$ export FUZZER=$LLVM/llvm/lib/Fuzzer

$ cd ~/fuzz
$ cat regex_fuzz.cpp
#include <regex>

extern "C" void LLVMFuzzerTestOneInput(const unsigned char *data, size_t
size) {
  if (size > 0) {
  std::regex re(std::string((const char *)data, size));

$ totclang -c -g -O2 -std=c++11 -I $FUZZER $FUZZER/*.cpp
$ totclang -g -fsanitize=address
 -fsanitize-coverage=edge,indirect-calls,8bit-counters -c -std=c++11
$ totclang -g -fsanitize=address Fuzzer*.o regex_fuzz.o -Wl

Undefined symbols for architecture x86_64:
  "_dfsan_create_label", referenced from:
      fuzzer::TraceState::DFSanCmpCallback(unsigned long, unsigned long,
unsigned long, unsigned long long, unsigned long long, unsigned short,
unsigned short) in FuzzerTraceState.o
      fuzzer::Fuzzer::InitializeTraceState() in FuzzerTraceState.o
  "_dfsan_get_label_info", referenced from:
      fuzzer::TraceState::GetLabelRange(unsigned short) in
  "_dfsan_read_label", referenced from:
      _dfsan_weak_hook_memcmp in FuzzerTraceState.o
  "_dfsan_set_label", referenced from:
      fuzzer::Fuzzer::InitializeTraceState() in FuzzerTraceState.o
ld: symbol(s) not found for architecture x86_64
clang-3.7: error: linker command failed with exit code 1 (use -v to see

-- Marshall
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20150601/e5278b99/attachment.html>

More information about the cfe-dev mailing list