aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Voss <mail@thomasvoss.com> 2024-06-12 01:14:24 +0200
committerThomas Voss <mail@thomasvoss.com> 2024-06-12 01:14:24 +0200
commitca7244805b23e4da2951e15e3fd802f18c19854d (patch)
treef3e927f2d63723e2a19aae903099a5006382b4d6
parent9b8f937cbd26df1d47e5f5aa37b5c076eb51ecae (diff)
Allow disabling the sanitizer
-rw-r--r--make.c24
1 files changed, 19 insertions, 5 deletions
diff --git a/make.c b/make.c
index d9b8bf3..2a7d606 100644
--- a/make.c
+++ b/make.c
@@ -34,15 +34,22 @@ static char *cflags_all[] = {
};
static char *cflags_dbg[] = {
- "-DDEBUG=1", "-fsanitize=address,undefined", "-g3", "-ggdb3", "-O0",
+ "-DDEBUG=1",
+ "-g3",
+ "-ggdb3",
+ "-O0",
};
static char *cflags_rls[] = {
- "-DNDEBUG=1", "-flto", "-march=native", "-mtune=native", "-O3",
+ "-DNDEBUG=1",
+ "-flto",
+ "-march=native",
+ "-mtune=native",
+ "-O3",
};
static char *argv0;
-static bool fflag, rflag;
+static bool fflag, rflag, Sflag;
static int simd_flags;
static void cc(void *);
@@ -55,7 +62,7 @@ static void
usage(void)
{
fprintf(stderr,
- "Usage: %s [-fr]\n"
+ "Usage: %s [-frS]\n"
" %s clean\n",
argv0, argv0);
exit(EXIT_FAILURE);
@@ -70,7 +77,7 @@ main(int argc, char **argv)
argv0 = argv[0];
int opt;
- while ((opt = getopt(argc, argv, "fr")) != -1) {
+ while ((opt = getopt(argc, argv, "frS")) != -1) {
switch (opt) {
case 'f':
fflag = true;
@@ -78,6 +85,9 @@ main(int argc, char **argv)
case 'r':
rflag = true;
break;
+ case 'S':
+ Sflag = true;
+ break;
default:
usage();
}
@@ -143,6 +153,8 @@ cc(void *arg)
strspushenv(&cmd, "CFLAGS", cflags_rls, lengthof(cflags_rls));
else
strspushenv(&cmd, "CFLAGS", cflags_dbg, lengthof(cflags_dbg));
+ if (!rflag && !Sflag)
+ strspushl(&cmd, "-fsanitize=address,undefined");
if (simd_flags != 0)
strspushl(&cmd, "-DORYX_SIMD=1");
if (strcmp(arg, "src/codegen.c") == 0)
@@ -169,6 +181,8 @@ ld(void)
strspushenv(&cmd, "CFLAGS", cflags_rls, lengthof(cflags_rls));
else
strspushenv(&cmd, "CFLAGS", cflags_dbg, lengthof(cflags_dbg));
+ if (!rflag && !Sflag)
+ strspushl(&cmd, "-fsanitize=address,undefined");
llvmquery(&cmd, LLVM_LDFLAGS | LLVM_LIBS);
strspushl(&cmd, "-o", TARGET);