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:
@@ -3222,8 +3222,6 @@ pub const Object = struct {
|
||||
owner_mod: *Package.Module,
|
||||
omit_frame_pointer: bool,
|
||||
) Allocator.Error!void {
|
||||
const comp = o.pt.zcu.comp;
|
||||
|
||||
if (!owner_mod.red_zone) {
|
||||
try attributes.addFnAttr(.noredzone, &o.builder);
|
||||
}
|
||||
@@ -3242,8 +3240,7 @@ pub const Object = struct {
|
||||
if (owner_mod.unwind_tables) {
|
||||
try attributes.addFnAttr(.{ .uwtable = Builder.Attribute.UwTable.default }, &o.builder);
|
||||
}
|
||||
const target = owner_mod.resolved_target.result;
|
||||
if (comp.skip_linker_dependencies or comp.no_builtin or target.cpu.arch.isBpf()) {
|
||||
if (owner_mod.no_builtin) {
|
||||
// The intent here is for compiler-rt and libc functions to not generate
|
||||
// infinite recursion. For example, if we are compiling the memcpy function,
|
||||
// and llvm detects that the body is equivalent to memcpy, it may replace the
|
||||
@@ -3258,6 +3255,7 @@ pub const Object = struct {
|
||||
try attributes.addFnAttr(.minsize, &o.builder);
|
||||
try attributes.addFnAttr(.optsize, &o.builder);
|
||||
}
|
||||
const target = owner_mod.resolved_target.result;
|
||||
if (target.cpu.model.llvm_name) |s| {
|
||||
try attributes.addFnAttr(.{ .string = .{
|
||||
.kind = try o.builder.string("target-cpu"),
|
||||
|
||||
Reference in New Issue
Block a user