aboutsummaryrefslogtreecommitdiff
path: root/src/main.zig
diff options
context:
space:
mode:
authorAlex Rønne Petersen <alex@alexrp.com>2024-11-05 14:29:44 +0100
committerAlex Rønne Petersen <alex@alexrp.com>2024-11-05 14:43:02 +0100
commitb57819118ddf287a135b4c2fb7182615b402fbc2 (patch)
tree6b55bd9b957750e542bec14373e3ba27aef94b5a /src/main.zig
parent56b416662aa89196d5b974632dcd927d26b5d12c (diff)
downloadzig-b57819118ddf287a135b4c2fb7182615b402fbc2.tar.gz
zig-b57819118ddf287a135b4c2fb7182615b402fbc2.zip
Compilation: Move no_builtin to Package.Module.
This option, by its very nature, needs to be attached to a module. If it isn't, the code in a module could break at random when compiled into an application that doesn't have this option set. After this change, skip_linker_dependencies no longer implies no_builtin in the LLVM backend.
Diffstat (limited to 'src/main.zig')
-rw-r--r--src/main.zig10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/main.zig b/src/main.zig
index 24fc0aa60c..e77effd443 100644
--- a/src/main.zig
+++ b/src/main.zig
@@ -810,7 +810,6 @@ fn buildOutputType(
var compatibility_version: ?std.SemanticVersion = null;
var function_sections = false;
var data_sections = false;
- var no_builtin = false;
var listen: Listen = .none;
var debug_compile_errors = false;
var verbose_link = (native_os != .wasi or builtin.link_libc) and
@@ -1550,9 +1549,9 @@ fn buildOutputType(
} else if (mem.eql(u8, arg, "-fno-data-sections")) {
data_sections = false;
} else if (mem.eql(u8, arg, "-fbuiltin")) {
- no_builtin = false;
+ mod_opts.no_builtin = false;
} else if (mem.eql(u8, arg, "-fno-builtin")) {
- no_builtin = true;
+ mod_opts.no_builtin = true;
} else if (mem.startsWith(u8, arg, "-fopt-bisect-limit=")) {
const next_arg = arg["-fopt-bisect-limit=".len..];
llvm_opt_bisect_limit = std.fmt.parseInt(c_int, next_arg, 0) catch |err|
@@ -1963,8 +1962,8 @@ fn buildOutputType(
.no_function_sections => function_sections = false,
.data_sections => data_sections = true,
.no_data_sections => data_sections = false,
- .builtin => no_builtin = false,
- .no_builtin => no_builtin = true,
+ .builtin => mod_opts.no_builtin = false,
+ .no_builtin => mod_opts.no_builtin = true,
.color_diagnostics => color = .on,
.no_color_diagnostics => color = .off,
.stack_check => mod_opts.stack_check = true,
@@ -3468,7 +3467,6 @@ fn buildOutputType(
.image_base = image_base,
.function_sections = function_sections,
.data_sections = data_sections,
- .no_builtin = no_builtin,
.clang_passthrough_mode = clang_passthrough_mode,
.clang_preprocessor_mode = clang_preprocessor_mode,
.version = optional_version,