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.
This commit is contained in:
@@ -31,6 +31,7 @@ unwind_tables: bool,
|
||||
cc_argv: []const []const u8,
|
||||
/// (SPIR-V) whether to generate a structured control flow graph or not
|
||||
structured_cfg: bool,
|
||||
no_builtin: bool,
|
||||
|
||||
/// If the module is an `@import("builtin")` module, this is the `File` that
|
||||
/// is preallocated for it. Otherwise this field is null.
|
||||
@@ -95,6 +96,7 @@ pub const CreateOptions = struct {
|
||||
sanitize_thread: ?bool = null,
|
||||
fuzz: ?bool = null,
|
||||
structured_cfg: ?bool = null,
|
||||
no_builtin: ?bool = null,
|
||||
};
|
||||
};
|
||||
|
||||
@@ -298,6 +300,13 @@ pub fn create(arena: Allocator, options: CreateOptions) !*Package.Module {
|
||||
};
|
||||
};
|
||||
|
||||
const no_builtin = b: {
|
||||
if (options.inherited.no_builtin) |x| break :b x;
|
||||
if (options.parent) |p| break :b p.no_builtin;
|
||||
|
||||
break :b target.cpu.arch.isBpf();
|
||||
};
|
||||
|
||||
const llvm_cpu_features: ?[*:0]const u8 = b: {
|
||||
if (resolved_target.llvm_cpu_features) |x| break :b x;
|
||||
if (!options.global.use_llvm) break :b null;
|
||||
@@ -350,6 +359,7 @@ pub fn create(arena: Allocator, options: CreateOptions) !*Package.Module {
|
||||
.unwind_tables = unwind_tables,
|
||||
.cc_argv = options.cc_argv,
|
||||
.structured_cfg = structured_cfg,
|
||||
.no_builtin = no_builtin,
|
||||
.builtin_file = null,
|
||||
};
|
||||
|
||||
@@ -442,6 +452,7 @@ pub fn create(arena: Allocator, options: CreateOptions) !*Package.Module {
|
||||
.unwind_tables = unwind_tables,
|
||||
.cc_argv = &.{},
|
||||
.structured_cfg = structured_cfg,
|
||||
.no_builtin = no_builtin,
|
||||
.builtin_file = new_file,
|
||||
};
|
||||
new_file.* = .{
|
||||
@@ -502,6 +513,7 @@ pub fn createLimited(gpa: Allocator, options: LimitedOptions) Allocator.Error!*P
|
||||
.unwind_tables = undefined,
|
||||
.cc_argv = undefined,
|
||||
.structured_cfg = undefined,
|
||||
.no_builtin = undefined,
|
||||
.builtin_file = null,
|
||||
};
|
||||
return mod;
|
||||
|
||||
Reference in New Issue
Block a user