• Home
  • Raw
  • Download

Lines Matching +full:gcc +full:- +full:8 +full:- +full:asan +full:- +full:ubsan +full:- +full:fuzz

2    american fuzzy lop++ - wrapper for GNU as
3 -----------------------------------------
7 Now maintained by Marc Heuse <mh@mh-sec.de>,
12 Copyright 2019-2024 AFLplusplus Project. All rights reserved.
18 https://www.apache.org/licenses/LICENSE-2.0
21 by GCC / clang and inject the instrumentation bits included from afl-as.h. It
23 afl-gcc / afl-clang.
25 Note that it's an explicit non-goal to instrument hand-written assembly,
31 allow clang users to make things work even with hand-crafted assembly. Just
32 note that there is no equivalent for GCC.
41 #include "alloc-inl.h"
43 #include "afl-as.h"
66 sanitizer; /* Using ASAN / MSAN */
71 /* If we don't find --32 or --64 in the command line, default to
84 #error "Sorry, 32-bit Apple platforms are not supported."
90 is always the last parameter passed by GCC, so we exploit this property
103 with the code generated by newer versions of clang that are hand-built in edit_params()
107 specified, we will actually call 'clang -c' instead of 'as -q' to in edit_params()
110 The tools aren't cmdline-compatible, but at least for now, we can in edit_params()
126 /* Although this is not documented, GCC also uses TEMP and TMP when TMPDIR in edit_params()
127 is not set. We need to check these non-standard variables to properly in edit_params()
135 if (unlikely((INT_MAX - 32) < argc || !as_params)) { in edit_params()
147 file, e.g. as input.s -o output.o */ in edit_params()
148 for (input_index = argc - 1; input_index > 0; input_index--) { in edit_params()
152 if (strncmp(input_file, "-g", 2)) break; in edit_params()
157 FATAL("Could not find input file (not called through afl-gcc?)"); in edit_params()
163 if (!strcmp(argv[i], "--64")) { in edit_params()
167 } else if (!strcmp(argv[i], "--32")) { in edit_params()
177 if (!strcmp(argv[i], "-arch") && i + 1 < (u32)argc) { in edit_params()
182 FATAL("Sorry, 32-bit Apple platforms are not supported."); in edit_params()
189 if (clang_mode && (!strcmp(argv[i], "-q") || !strcmp(argv[i], "-Q"))) in edit_params()
200 /* When calling clang as the upstream assembler, append -c -x assembler in edit_params()
205 as_params[as_par_cnt++] = "-c"; in edit_params()
206 as_params[as_par_cnt++] = "-x"; in edit_params()
213 if (input_file[0] == '-') { in edit_params()
215 if (!strcmp(input_file + 1, "-version")) { in edit_params()
225 FATAL("Incorrect use (not called through afl-gcc?)"); in edit_params()
236 to compile a program, rather than using gcc on an ad-hoc .s file in in edit_params()
255 modified_file = alloc_printf("%s/.afl-%u-%u-%u.s", tmp_dir, (u32)getpid(), in edit_params()
323 /* Output the actual line, call it a day in pass-thru mode. */
331 files - and let's set instr_ok accordingly. */
339 if (!clang_mode && instr_ok && !strncmp(line + 2, "p2align ", 8) &&
356 if (!strncmp(line + 2, "section\t", 8) ||
357 !strncmp(line + 2, "section ", 8) || !strncmp(line + 2, "bss\n", 4) ||
367 /* Detect off-flavor assembly (rare, happens in gdb). When this is
378 /* Detect syntax changes, as could happen with hand-written assembly.
384 /* Detect and skip ad-hoc __asm__ blocks, likewise skipping them. */
397 ^main: - function entry point (always instrumented)
398 ^.L0: - GCC branch label
399 ^.LBB0_0: - clang branch label (but only in clang mode)
400 ^\tjnz foo - conditional branches
404 ^# BB#0: - clang comments
405 ^ # BB#0: - ditto
406 ^.Ltmp0: - clang non-branch labels
407 ^.LC0 - GCC non-branch labels
408 ^.LBB0_0: - ditto (when in GCC mode)
409 ^\tjmp foo - non-conditional jumps
411 Additionally, clang and GCC on MacOS X follow a different convention
425 right after the branch (to instrument the not-taken path) and at the
453 if (line[0] == 'L' && isdigit(*(colon_pos - 1))) {
486 That said, this complicates the code by requiring two-pass
489 about not generating spurious intra-function jumps.
492 .Lfunc_begin0-style exception handling calculations (a problem on
529 pass_thru ? " (pass-thru mode)" : "");
535 getenv("AFL_HARDEN") ? "hardened" : "non-hardened",
536 getenv("AFL_USE_ASAN") ? ", ASAN" : "",
539 getenv("AFL_USE_UBSAN") ? ", UBSAN" : "",
542 OKF("Instrumented %u locations (%s-bit, %s mode, ratio %u%%).", ins_lines,
567 SAYF(cCYA "afl-as" VERSION cRST " by Michal Zalewski\n");
575 if (argc < 2 || (argc == 2 && strcmp(argv[1], "-h") == 0)) {
579 "afl-as" VERSION
581 "\n%s [-h]\n\n"
582 "This is a helper application for afl-fuzz. It is a wrapper around GNU "
584 "executed by the toolchain whenever using afl-gcc or afl-clang. You "
642 /* When compiling with ASAN, we don't have a particularly elegant way to skip
643 ASAN-specific branches. But we can probabilistically compensate for
658 FATAL("Oops, failed to execute '%s' - check your PATH", as_params[0]);