diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2024-02-14 01:24:04 -0500 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2024-02-14 01:24:04 -0500 |
| commit | 2864523eead672f17497f937f98c10c47f14a714 (patch) | |
| tree | 8e1592844298d17ab17b56cfef9df904faa54957 | |
| parent | 284ccbc8614b99d6b09d19be7cf91d3eaba5957b (diff) | |
Fix ldflags for compiling with GCC and add trapping integer arithmetic
| -rw-r--r-- | nextlang.c | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -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); |
