diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2022-07-05 15:21:20 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2022-07-05 15:21:20 -0700 |
| commit | 2ee864ca5eb46468e8e0f4237a5532b76b60d715 (patch) | |
| tree | a70213c0c4c9f5c861e4c784e5980d6b60fea08d /src/main.zig | |
| parent | 927e59d0532c77e2fb3ead0c9c4f7ead0454785a (diff) | |
| download | zig-2ee864ca5eb46468e8e0f4237a5532b76b60d715.tar.gz zig-2ee864ca5eb46468e8e0f4237a5532b76b60d715.zip | |
CLI: add support for -fno-builtin
Diffstat (limited to 'src/main.zig')
| -rw-r--r-- | src/main.zig | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/main.zig b/src/main.zig index 00696693f2..4fe048bb93 100644 --- a/src/main.zig +++ b/src/main.zig @@ -381,6 +381,10 @@ const usage_build_generic = \\ -fno-stage1 Prevent using bootstrap compiler as the codegen backend \\ -fsingle-threaded Code assumes there is only one thread \\ -fno-single-threaded Code may not assume there is only one thread + \\ -fbuiltin Enable implicit builtin knowledge of functions + \\ -fno-builtin Disable implicit builtin knowledge of functions + \\ -ffunction-sections Places each function in a separate section + \\ -fno-function-sections All functions go into same section \\ --strip Omit debug symbols \\ -ofmt=[mode] Override target object format \\ elf Executable and Linking Format @@ -398,7 +402,6 @@ const usage_build_generic = \\ -D[macro]=[value] Define C [macro] to [value] (1 if [value] omitted) \\ --libc [file] Provide a file which specifies libc paths \\ -cflags [flags] -- Set extra flags for the next positional C source files - \\ -ffunction-sections Places each function in a separate section \\ \\Link Options: \\ -l[lib], --library [lib] Link against system library (only if actually used) @@ -604,6 +607,7 @@ fn buildOutputType( var compatibility_version: ?std.builtin.Version = null; var strip = false; var function_sections = false; + var no_builtin = false; var watch = false; var debug_compile_errors = false; var verbose_link = std.process.hasEnvVarConstant("ZIG_VERBOSE_LINK"); @@ -1241,6 +1245,12 @@ fn buildOutputType( single_threaded = false; } else if (mem.eql(u8, arg, "-ffunction-sections")) { function_sections = true; + } else if (mem.eql(u8, arg, "-fno-function-sections")) { + function_sections = false; + } else if (mem.eql(u8, arg, "-fbuiltin")) { + no_builtin = false; + } else if (mem.eql(u8, arg, "-fno-builtin")) { + no_builtin = true; } else if (mem.eql(u8, arg, "--eh-frame-hdr")) { link_eh_frame_hdr = true; } else if (mem.eql(u8, arg, "--emit-relocs")) { @@ -1464,6 +1474,8 @@ fn buildOutputType( .no_omit_frame_pointer => omit_frame_pointer = false, .function_sections => function_sections = true, .no_function_sections => function_sections = false, + .builtin => no_builtin = false, + .no_builtin => no_builtin = true, .color_diagnostics => color = .on, .no_color_diagnostics => color = .off, .stack_check => want_stack_check = true, @@ -2847,6 +2859,7 @@ fn buildOutputType( .strip = strip, .single_threaded = single_threaded, .function_sections = function_sections, + .no_builtin = no_builtin, .self_exe_path = self_exe_path, .thread_pool = &thread_pool, .clang_passthrough_mode = clang_passthrough_mode, @@ -4572,6 +4585,8 @@ pub const ClangArgIterator = struct { no_omit_frame_pointer, function_sections, no_function_sections, + builtin, + no_builtin, color_diagnostics, no_color_diagnostics, stack_check, |
