aboutsummaryrefslogtreecommitdiff
path: root/src/afl-cc.c
diff options
context:
space:
mode:
authorDustin Spicuzza <dustin@virtualroadside.com>2021-05-10 18:20:28 -0400
committerGitHub <noreply@github.com>2021-05-11 00:20:28 +0200
commitfd077e86bdfb73f1aa8432be547b1e8477883abb (patch)
tree331a5059364231838ca1fa4d229deeb91d27cd8c /src/afl-cc.c
parent09458343c05564f32654d748a0ae95460748479c (diff)
downloadAFLplusplus-fd077e86bdfb73f1aa8432be547b1e8477883abb.tar.gz
OSX-specific improvements (#912)
* Fix afl-cc to work correctly by default on OSX using xcode - CLANG_ENV_VAR must be set for afl-as to work - Use clang mode by default if no specific compiler selected * Add OSX-specific documentation for configuring shared memory
Diffstat (limited to 'src/afl-cc.c')
-rw-r--r--src/afl-cc.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/afl-cc.c b/src/afl-cc.c
index 09009334..c1050355 100644
--- a/src/afl-cc.c
+++ b/src/afl-cc.c
@@ -1574,7 +1574,12 @@ int main(int argc, char **argv, char **envp) {
else if (have_gcc_plugin)
compiler_mode = GCC_PLUGIN;
else if (have_gcc)
- compiler_mode = GCC;
+ #ifdef __APPLE__
+ // on OSX clang masquerades as GCC
+ compiler_mode = CLANG;
+ #else
+ compiler_mode = GCC;
+ #endif
else if (have_lto)
compiler_mode = LTO;
else
@@ -1596,7 +1601,10 @@ int main(int argc, char **argv, char **envp) {
}
- if (compiler_mode == CLANG) { instrument_mode = INSTRUMENT_CLANG; }
+ if (compiler_mode == CLANG) {
+ instrument_mode = INSTRUMENT_CLANG;
+ setenv(CLANG_ENV_VAR, "1", 1); // used by afl-as
+ }
if (argc < 2 || strncmp(argv[1], "-h", 2) == 0) {