aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2024-02-14 01:24:04 -0500
committerBruce Hill <bruce@bruce-hill.com>2024-02-14 01:24:04 -0500
commit2864523eead672f17497f937f98c10c47f14a714 (patch)
tree8e1592844298d17ab17b56cfef9df904faa54957
parent284ccbc8614b99d6b09d19be7cf91d3eaba5957b (diff)
Fix ldflags for compiling with GCC and add trapping integer arithmetic
-rw-r--r--nextlang.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/nextlang.c b/nextlang.c
index 98e54ebb..9321490f 100644
--- a/nextlang.c
+++ b/nextlang.c
@@ -87,14 +87,16 @@ int main(int argc, char *argv[])
const char *cflags = getenv("CFLAGS");
if (!cflags)
- cflags = "-std=c11";
+ cflags = "-std=c11 -fsanitize=signed-integer-overflow -fno-sanitize-recover";
const char *ldlibs = "-lgc -lcord -lm -L. -lnext";
if (getenv("LDLIBS"))
ldlibs = heap_strf("%s %s", ldlibs, getenv("LDLIBS"));
- const char *run = heap_strf("tcc -run %s %s -", cflags, ldlibs);
- // const char *run = heap_strf("gcc -x c %s %s -", cflags, ldlibs);
+ const char *ldflags = "-Wl,-rpath '-Wl,$ORIGIN'";
+
+ // const char *run = heap_strf("tcc -run %s %s %s -", cflags, ldflags, ldlibs);
+ const char *run = heap_strf("gcc -x c %s %s %s - -o program && ./program", cflags, ldflags, ldlibs);
FILE *cc = popen(run, "w");
CORD_put(program, cc);
fclose(cc);