Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fuzzers: Fix CFLAGS#7044

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
ethomson merged 2 commits intolibgit2:mainfromnelhage:fix-fuzzer-build
Jun 5, 2025
Merged

Conversation

nelhage
Copy link
Contributor

I'm seeing the current fuzzer build fail (duringcmake) like so:

-- Performing Test IS_FSANITIZE_FUZZER_NO_LINK_SUPPORTED-- Performing Test IS_FSANITIZE_FUZZER_NO_LINK_SUPPORTED - FailedCMake Error at cmake/AddCFlagIfSupported.cmake:17 (message):  Required flag -fsanitize=fuzzer-no-link is not supportedCall Stack (most recent call first):  fuzzers/CMakeLists.txt:6 (add_c_flag)

The cmake log output contains something like so:

        /src/aflplusplus/libAFLDriver.a(aflpp_driver.o): in function `main':        aflpp_driver.c:(.text+0x11b): undefined reference to `LLVMFuzzerTestOneInput'        clang: error: linker command failed with exit code 1 (use -v to see invocation)

I haven't figured out exactly what's happening, but I believe that once line 5 has added-fsanitize=fuzzer toCFLAGS, future compile- testsalso use it during linking. This in turn pulls in the fuzzermain, which expects anLLVMFuzzerTestOneInput symbol, and thus fails.

Instead, just add-fsanitize=fuzzer-no-link to CFLAGS (as suggestedby the documentation), and then use-fsanitize=fuzzer only for linking the fuzzer targets. At least in my environment, this results in a working fuzzer build.

I'm seeing the current fuzzer build fail (during `cmake`) like so:```-- Performing Test IS_FSANITIZE_FUZZER_NO_LINK_SUPPORTED-- Performing Test IS_FSANITIZE_FUZZER_NO_LINK_SUPPORTED - FailedCMake Error at cmake/AddCFlagIfSupported.cmake:17 (message):  Required flag -fsanitize=fuzzer-no-link is not supportedCall Stack (most recent call first):  fuzzers/CMakeLists.txt:6 (add_c_flag)```The cmake log output contains something like so:```        /src/aflplusplus/libAFLDriver.a(aflpp_driver.o): in function `main':        aflpp_driver.c:(.text+0x11b): undefined reference to `LLVMFuzzerTestOneInput'        clang: error: linker command failed with exit code 1 (use -v to see invocation)```I haven't figured out exactly what's happening, but I believe thatonce line 5 has added `-fsanitize=fuzzer` to `CFLAGS`, future compile-tests **also** use it during linking. This in turn pulls in the fuzzer`main`, which expects an `LLVMFuzzerTestOneInput` symbol, and thusfails.Instead, just add `-fsanitize=fuzzer-no-link` to CFLAGS (as suggested[by the documentation][libfuzzer]), and then use `-fsanitize=fuzzer`only for linking the fuzzer targets. At least in my environment, thisresults in a working fuzzer build.[libfuzzer]:https://llvm.org/docs/LibFuzzer.html#fuzzer-usage
@ethomson
Copy link
Member

Seems reasonable; thanks for the fix and the explanation.

@ethomsonethomson merged commitde652db intolibgit2:mainJun 5, 2025
19 checks passed
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

2 participants
@nelhage@ethomson

[8]ページ先頭

©2009-2025 Movatter.jp