libhfuzz/main: make LIBHFUZZ_module_main as default visibility to avoid lto removal
* If this signature is visible inside a binary, it's probably a persistent-style fuzzing program.
* This mode of discover is employed by honggfuzz
*/
-__attribute__((used)) const char* LIBHFUZZ_module_main = _HF_PERSISTENT_SIG;
+__attribute__((visibility("default")))
+__attribute__((used))
+const char* LIBHFUZZ_module_main = _HF_PERSISTENT_SIG;
/*
* Declare it 'weak', so it can be safely linked with regular binaries which
@@ -19,13 +21,5 @@ __attribute__((used)) const char* LIBHFUZZ_module_main = _HF_PERSISTENT_SIG;
__attribute__((weak))
#endif /* !defined(__CYGWIN__) */
int main(int argc, char** argv) {
- /*
- * getpid() never returns -2, so it's only to reference the persistent
- * signature, to prevent optimizing it out by clever compiler/link
- * optimizers
- */
- if (time(NULL) == -10) {
- return (int)strlen(LIBHFUZZ_module_main);
- }
return HonggfuzzMain(argc, argv);
}
