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

Jack Howarth howarth.mailing.lists at gmail.com
Mon Jun 1 08:52:02 PDT 2015


Marshall,
      From cmake/config-ix.cmake in compiler-rt. it appears that the
Fuzzer support may be Linux only at the moment...

if (COMPILER_RT_HAS_SANITIZER_COMMON AND DFSAN_SUPPORTED_ARCH AND
    OS_NAME MATCHES "Linux")
  set(COMPILER_RT_HAS_DFSAN TRUE)
else()
  set(COMPILER_RT_HAS_DFSAN FALSE)
endif()

          Jack

On Mon, Jun 1, 2015 at 11:36 AM, Marshall Clow <mclow.lists at gmail.com> wrote:
> I'm trying to use LibFuzzer on my Mac - following the directions here:
> http://llvm.org/docs/LibFuzzer.html.
>
> 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
> ships?
>
>
> Notes:
> "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
> regex_fuzz.cpp
> $ 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
> FuzzerTraceState.o
>   "_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
> invocation)
>
> -- Marshall
>
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>



More information about the cfe-dev mailing list