[llvm-bugs] [Bug 38148] New: libFuzzer main is masked by gtest_main

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Jul 12 07:18:42 PDT 2018


            Bug ID: 38148
           Summary: libFuzzer main is masked by gtest_main
           Product: compiler-rt
           Version: unspecified
          Hardware: Macintosh
                OS: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: fuzzer
          Assignee: unassignedbugs at nondot.org
          Reporter: rgovostes at gmail.com
                CC: llvm-bugs at lists.llvm.org

Maybe somehow related to 23967, which is quite old.

I built clang ToT in a fairly straightforward way (Release build), then tried
to use it to build another LLVM tool with -fsanitize=fuzzer. Running the fuzz
target, I saw:

[==========] Running 0 tests from 0 test cases.
[==========] 0 tests from 0 test cases ran. (0 ms total)
[  PASSED  ] 0 tests.

The program refused to accept a corpus directory, and -help talked about how it
was a Google Test program.

The culprit seems to be that when I built my LLVM tool, I used:

clang++ \
  $("$TARGETDIR"/llvm-config --cxxflags --ldflags --system-libs --libs all) \

llvm-config adds -lgtest_main -lgtest to the linker flags, and gtest's main()
is apparently winning out over libFuzzer's.

I used sed to cut out -lgtest_main and that solved the issue.

You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20180712/b1a31e75/attachment-0001.html>

More information about the llvm-bugs mailing list