Improved the CMakeLists.txt just slightly. Provided a default, weak-attributed main function into libdeepstate so that tests don't need to define them. The weak attribute means that any main function defined by libfuzzer will be a strong symbol and take over, so there won't be a conflict. Adjusted examples accordingly to omit now redundant conditionally-compiled main functions, as that leaked out too many underlying details.
This commit is contained in:
@@ -618,4 +618,10 @@ void __stack_chk_fail(void) {
|
||||
__builtin_unreachable();
|
||||
}
|
||||
|
||||
__attribute__((weak))
|
||||
int main(int argc, char *argv[]) {
|
||||
DeepState_InitOptions(argc, argv);
|
||||
return DeepState_Run();
|
||||
}
|
||||
|
||||
DEEPSTATE_END_EXTERN_C
|
||||
|
||||
@@ -126,6 +126,14 @@ void DeepState_LogFormat(enum DeepState_LogLevel level,
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
#pragma clang diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wunknown-warning-option"
|
||||
/*#pragma clang diagnostic ignored "-Wbuiltin-declaration-mismatch"
|
||||
*/
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wbuiltin-declaration-mismatch"
|
||||
|
||||
/* Override libc! */
|
||||
DEEPSTATE_NOINLINE
|
||||
int puts(const char *str) {
|
||||
@@ -216,4 +224,7 @@ int __vfprintf_chk(int flag, FILE *file, const char *format, va_list args) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
#pragma clang diagnostic pop
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
DEEPSTATE_END_EXTERN_C
|
||||
|
||||
Reference in New Issue
Block a user