build: Fix fuzz binary compilation under windows #21226
pull danben wants to merge 1 commits into bitcoin:master from danben:compile-fuzz-binary-windows changing 2 files +2 −2-
danben commented at 6:38 pm on February 18, 2021: contributorSmall change to allow the fuzz binary to compile under windows. Also removed –disable-fuzz-binary from the windows CI test. This fixes #21212.
-
in src/test/fuzz/fuzz.cpp:79 in e3da77aa03 outdated
71@@ -72,7 +72,11 @@ extern "C" int LLVMFuzzerInitialize(int* argc, char*** argv) 72 } 73 74 #if defined(PROVIDE_MAIN_FUNCTION) 75+#ifdef WIN32 76+int main(int argc, char** argv) 77+#else 78 __attribute__((weak)) int main(int argc, char** argv) 79+#endif
MarcoFalke commented at 6:48 pm on February 18, 2021:0#ifndef WIN32 1__attribute__((weak)) 2#endif 3int main(int argc, char** argv)
MarcoFalke commented at 6:49 pm on February 18, 2021:Haven’t tried this, but with one less line of code you could achieve the same?MarcoFalke commented at 6:49 pm on February 18, 2021: memberNice find. Is this a feature or a bug of windows?MarcoFalke approveddanben commented at 7:08 pm on February 18, 2021: contributorNice find. Is this a feature or a bug of windows?
Good question. I’m no Windows programmer but this and designated initializers came up when I initially tackled the fuzz binary thing. According to Wikipedia, weak symbols are specific to ELF. According to this thread, MinGW has supported weak symbols for some time but I guess people have problems with it. My understanding is that no one is trying to build for fuzzing on Windows so it seemed fine to just omit the annotation.
MarcoFalke commented at 8:14 pm on February 18, 2021: memberNo need to attribute me. And please squash your commits according to https://github.com/bitcoin/bitcoin/blob/master/CONTRIBUTING.md#squashing-commitsin src/test/fuzz/fuzz.cpp:76 in 5d9999aac9 outdated
71@@ -72,7 +72,10 @@ extern "C" int LLVMFuzzerInitialize(int* argc, char*** argv) 72 } 73 74 #if defined(PROVIDE_MAIN_FUNCTION) 75-__attribute__((weak)) int main(int argc, char** argv) 76+#ifndef WIN32 77+__attribute__((weak))
MarcoFalke commented at 8:21 pm on February 18, 2021:Hmm, I think we don’t even need the attribute at all, now that we have a proper configure check.
- Afl does need the main function (preferably without the attribute)
- honggfuzz and libFuzzer shouldn’t get it
- raw builds need the main function (preferably without the attribute)
danben commented at 8:22 pm on February 18, 2021:That sounds right. Perhaps that will save me from having to figure out where this mac failure is coming from.DrahtBot added the label Build system on Feb 18, 2021Fix fuzz binary compilation under windows 56ace907b9danben force-pushed on Feb 18, 2021DrahtBot commented at 4:28 am on February 19, 2021: memberThe following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
Conflicts
Reviewers, this pull request conflicts with the following ones:
- #21003 (test: Move MakeNoLogFileContext to libtest_util, and use it in bench by MarcoFalke)
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.
MarcoFalke commented at 8:25 am on February 19, 2021: memberreview ACK 56ace907b9b7b4544c95e2945dc07e217718a8e5 the best bugfixes are the ones removing codeMarcoFalke merged this on Feb 19, 2021MarcoFalke closed this on Feb 19, 2021
danben deleted the branch on Feb 19, 2021sidhujag referenced this in commit b9208c562c on Feb 19, 2021DrahtBot locked this on Aug 16, 2022Labels
Build system
This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-12-18 18:12 UTC
More mirrored repositories can be found on mirror.b10c.me