diff options
| author | Alex Rønne Petersen <alex@alexrp.com> | 2024-11-05 14:29:44 +0100 |
|---|---|---|
| committer | Alex Rønne Petersen <alex@alexrp.com> | 2024-11-05 14:43:02 +0100 |
| commit | b57819118ddf287a135b4c2fb7182615b402fbc2 (patch) | |
| tree | 6b55bd9b957750e542bec14373e3ba27aef94b5a /src/codegen | |
| parent | 56b416662aa89196d5b974632dcd927d26b5d12c (diff) | |
| download | zig-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/codegen')
| -rw-r--r-- | src/codegen/llvm.zig | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/codegen/llvm.zig b/src/codegen/llvm.zig index 3a8fde75da..1b90453d49 100644 --- a/src/codegen/llvm.zig +++ b/src/codegen/llvm.zig @@ -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"), |
