From c883fa7909583c20d31c0673a2752298886fd754 Mon Sep 17 00:00:00 2001 From: Christoffer Lerno Date: Sun, 17 Sep 2023 12:54:54 +0200 Subject: [PATCH] Update build options --nostdlib --nolibc --emit-stdlib --forcelinker --strip-unused. --- src/build/build_internal.h | 3 +- src/build/build_options.c | 133 +++++++++++---------------- src/build/build_options.h | 111 ++++++++++++++++++---- src/build/builder.c | 73 +++++---------- src/build/project.c | 49 ++++------ src/compiler/compiler.c | 9 +- src/compiler/compiler_internal.h | 20 ++++ src/compiler/linker.c | 18 ++-- src/compiler/llvm_codegen.c | 6 +- src/compiler/llvm_codegen_expr.c | 26 +++--- src/compiler/llvm_codegen_function.c | 2 +- src/compiler/llvm_codegen_module.c | 2 +- src/compiler/llvm_codegen_stmt.c | 2 +- src/compiler/sema_liveness.c | 2 +- src/compiler/semantic_analyser.c | 6 +- 15 files changed, 241 insertions(+), 221 deletions(-) diff --git a/src/build/build_internal.h b/src/build/build_internal.h index 68a42fe3a..d3b9c7a85 100644 --- a/src/build/build_internal.h +++ b/src/build/build_internal.h @@ -7,8 +7,7 @@ #include "utils/lib.h" #include "utils/json.h" #include "build_options.h" -#define DEFAULT_SYMTAB_SIZE (256 * 1024) -#define DEFAULT_SWITCHRANGE_MAX_SIZE (256) + typedef struct { diff --git a/src/build/build_options.c b/src/build/build_options.c index 8d3d07312..dc734ac36 100644 --- a/src/build/build_options.c +++ b/src/build/build_options.c @@ -83,8 +83,6 @@ static void usage(void) OUTPUT("Options:"); OUTPUT(" --tb - Use Tilde Backend for compilation."); OUTPUT(" --stdlib - Use this directory as the C3 standard library path."); - OUTPUT(" --nostdlib - Do not include the standard library."); - OUTPUT(" --nolibc - Do not implicitly link libc nor any associated files."); OUTPUT(" --no-entry - Do not generate (or require) a main function."); OUTPUT(" --libdir - Add this directory to the C3 library search paths."); OUTPUT(" --lib - Add this library to the compilation."); @@ -101,17 +99,11 @@ static void usage(void) OUTPUT(" -O0 - Safe, no optimizations, emit debug info."); OUTPUT(" -O1 - Safe, high optimization, emit debug info."); OUTPUT(" -O2 - Unsafe, high optimization, emit debug info."); - OUTPUT(" -O3 - Unsafe, highest optimization, relaxed maths, emit debug info."); - OUTPUT(" -O4 - Unsafe, highest optimization, fast maths, emit debug info."); - OUTPUT(" -Os - Unsafe, high optimization, small code, no debug info."); - OUTPUT(" -Oz - Unsafe, high optimization, tiny code, no debug info."); - OUTPUT(" -O0+ - O0, single module."); - OUTPUT(" -O1+ - O1, single module."); - OUTPUT(" -O2+ - O2, single module."); - OUTPUT(" -O3+ - O3, single module."); - OUTPUT(" -O4+ - O4, single module."); - OUTPUT(" -Os+ - Os, single module."); - OUTPUT(" -Oz+ - Oz, single module."); + OUTPUT(" -O3 - Unsafe, high optimization, single module, emit debug info."); + OUTPUT(" -O4 - Unsafe, highest optimization, relaxed maths, single module, emit debug info."); + OUTPUT(" -O5 - Unsafe, highest optimization, fast maths, single module, emit debug info."); + OUTPUT(" -Os - Unsafe, high optimization, small code, single module, no debug info."); + OUTPUT(" -Oz - Unsafe, high optimization, tiny code, single module, no debug info."); OUTPUT(" -t1 - Trust level 1 - don't allow $include nor $exec (default)."); OUTPUT(" -t2 - Trust level 2 - allow $include but not $exec / exec directives."); OUTPUT(" -t3 - Trust level 3 - full trust, allow both include and exec."); @@ -125,13 +117,12 @@ static void usage(void) OUTPUT(" --emit-asm - Emit asm as a .s file per module."); OUTPUT(" --obj - Emit object files. (Enabled by default)"); OUTPUT(" --no-obj - Do not output object files, this is only valid for `compile-only`."); - OUTPUT(" --emit-stdlib - Output files for the standard library. (Enabled by default)"); - OUTPUT(" --no-emit-stdlib - Do not output object files (nor asm or ir) for the standard library."); OUTPUT(" --target - Compile for a particular architecture + OS target."); OUTPUT(" --threads - Set the number of threads to use for compilation."); OUTPUT(" --safe= - Turn safety (contracts, runtime bounds checking, null pointer checks etc) on or off."); OUTPUT(" --optlevel=