| author | |
| committer | |
| log | 5722261e6474e8bac5b8cb341b6344100b8514f2 |
| tree | 8fc8006e8f3cedeac4a45c88305bc0eb0b0e3fb0 |
| parent | 42998e637b29df66992d10be270fb97e47758fba |
| parent | da7e4fb31a05f2063eb829c4c383a44b38ed21e1 |
| signature |
Compilation: default to self-hosted backends when not using libllvm5 files changed, 28 insertions(+), 26 deletions(-)
src/Compilation.zig+6| ... | ... | @@ -845,6 +845,12 @@ pub fn create(gpa: Allocator, options: InitOptions) !*Compilation { |
| 845 | 845 | if (options.main_mod == null) |
| 846 | 846 | break :blk false; |
| 847 | 847 | |
| 848 | // If we cannot use LLVM libraries, then our own backends will be a | |
| 849 | // better default since the LLVM backend can only produce bitcode | |
| 850 | // and not an object file or executable. | |
| 851 | if (!use_lib_llvm) | |
| 852 | break :blk false; | |
| 853 | ||
| 848 | 854 | // If LLVM does not support the target, then we can't use it. |
| 849 | 855 | if (!target_util.hasLlvmSupport(options.target, options.target.ofmt)) |
| 850 | 856 | break :blk false; |
src/link/Coff/lld.zig+2-3| ... | ... | @@ -491,9 +491,8 @@ pub fn linkWithLLD(self: *Coff, comp: *Compilation, prog_node: *std.Progress.Nod |
| 491 | 491 | } |
| 492 | 492 | // MSVC compiler_rt is missing some stuff, so we build it unconditionally but |
| 493 | 493 | // and rely on weak linkage to allow MSVC compiler_rt functions to override ours. |
| 494 | if (comp.compiler_rt_lib) |lib| { | |
| 495 | try argv.append(lib.full_object_path); | |
| 496 | } | |
| 494 | if (comp.compiler_rt_obj) |obj| try argv.append(obj.full_object_path); | |
| 495 | if (comp.compiler_rt_lib) |lib| try argv.append(lib.full_object_path); | |
| 497 | 496 | } |
| 498 | 497 | |
| 499 | 498 | try argv.ensureUnusedCapacity(self.base.options.system_libs.count()); |
src/link/MachO/zld.zig+4-6| ... | ... | @@ -186,9 +186,8 @@ pub fn linkWithZld( |
| 186 | 186 | try positionals.append(.{ .path = p }); |
| 187 | 187 | } |
| 188 | 188 | |
| 189 | if (comp.compiler_rt_lib) |lib| { | |
| 190 | try positionals.append(.{ .path = lib.full_object_path }); | |
| 191 | } | |
| 189 | if (comp.compiler_rt_lib) |lib| try positionals.append(.{ .path = lib.full_object_path }); | |
| 190 | if (comp.compiler_rt_obj) |obj| try positionals.append(.{ .path = obj.full_object_path }); | |
| 192 | 191 | |
| 193 | 192 | // libc++ dep |
| 194 | 193 | if (options.link_libcpp) { |
| ... | ... | @@ -301,9 +300,8 @@ pub fn linkWithZld( |
| 301 | 300 | try argv.append(p); |
| 302 | 301 | } |
| 303 | 302 | |
| 304 | if (comp.compiler_rt_lib) |lib| { | |
| 305 | try argv.append(lib.full_object_path); | |
| 306 | } | |
| 303 | if (comp.compiler_rt_lib) |lib| try argv.append(lib.full_object_path); | |
| 304 | if (comp.compiler_rt_obj) |obj| try argv.append(obj.full_object_path); | |
| 307 | 305 | |
| 308 | 306 | if (options.link_libcpp) { |
| 309 | 307 | try argv.append(comp.libcxxabi_static_lib.?.full_object_path); |
src/link/Wasm.zig+15-16| ... | ... | @@ -3257,11 +3257,12 @@ fn linkWithZld(wasm: *Wasm, comp: *Compilation, prog_node: *std.Progress.Node) l |
| 3257 | 3257 | sub_prog_node.activate(); |
| 3258 | 3258 | defer sub_prog_node.end(); |
| 3259 | 3259 | |
| 3260 | const is_obj = options.output_mode == .Obj; | |
| 3261 | const compiler_rt_path: ?[]const u8 = if (options.include_compiler_rt and !is_obj) | |
| 3262 | comp.compiler_rt_lib.?.full_object_path | |
| 3263 | else | |
| 3264 | null; | |
| 3260 | const compiler_rt_path: ?[]const u8 = blk: { | |
| 3261 | if (comp.compiler_rt_obj) |obj| break :blk obj.full_object_path; | |
| 3262 | if (comp.compiler_rt_lib) |lib| break :blk lib.full_object_path; | |
| 3263 | break :blk null; | |
| 3264 | }; | |
| 3265 | ||
| 3265 | 3266 | const id_symlink_basename = "zld.id"; |
| 3266 | 3267 | |
| 3267 | 3268 | var man: Cache.Manifest = undefined; |
| ... | ... | @@ -3376,9 +3377,8 @@ fn linkWithZld(wasm: *Wasm, comp: *Compilation, prog_node: *std.Progress.Node) l |
| 3376 | 3377 | try positionals.append(c_object.status.success.object_path); |
| 3377 | 3378 | } |
| 3378 | 3379 | |
| 3379 | if (comp.compiler_rt_lib) |lib| { | |
| 3380 | try positionals.append(lib.full_object_path); | |
| 3381 | } | |
| 3380 | if (comp.compiler_rt_lib) |lib| try positionals.append(lib.full_object_path); | |
| 3381 | if (comp.compiler_rt_obj) |obj| try positionals.append(obj.full_object_path); | |
| 3382 | 3382 | |
| 3383 | 3383 | try wasm.parseInputFiles(positionals.items); |
| 3384 | 3384 | |
| ... | ... | @@ -3463,9 +3463,8 @@ pub fn flushModule(wasm: *Wasm, comp: *Compilation, prog_node: *std.Progress.Nod |
| 3463 | 3463 | try positionals.append(c_object.status.success.object_path); |
| 3464 | 3464 | } |
| 3465 | 3465 | |
| 3466 | if (comp.compiler_rt_lib) |lib| { | |
| 3467 | try positionals.append(lib.full_object_path); | |
| 3468 | } | |
| 3466 | if (comp.compiler_rt_lib) |lib| try positionals.append(lib.full_object_path); | |
| 3467 | if (comp.compiler_rt_obj) |obj| try positionals.append(obj.full_object_path); | |
| 3469 | 3468 | |
| 3470 | 3469 | try wasm.parseInputFiles(positionals.items); |
| 3471 | 3470 | |
| ... | ... | @@ -4325,11 +4324,11 @@ fn linkWithLLD(wasm: *Wasm, comp: *Compilation, prog_node: *std.Progress.Node) ! |
| 4325 | 4324 | defer sub_prog_node.end(); |
| 4326 | 4325 | |
| 4327 | 4326 | const is_obj = wasm.base.options.output_mode == .Obj; |
| 4328 | ||
| 4329 | const compiler_rt_path: ?[]const u8 = if (wasm.base.options.include_compiler_rt and !is_obj) | |
| 4330 | comp.compiler_rt_lib.?.full_object_path | |
| 4331 | else | |
| 4332 | null; | |
| 4327 | const compiler_rt_path: ?[]const u8 = blk: { | |
| 4328 | if (comp.compiler_rt_lib) |lib| break :blk lib.full_object_path; | |
| 4329 | if (comp.compiler_rt_obj) |obj| break :blk obj.full_object_path; | |
| 4330 | break :blk null; | |
| 4331 | }; | |
| 4333 | 4332 | |
| 4334 | 4333 | const target = wasm.base.options.target; |
| 4335 | 4334 |
test/link/macho/bugs/16308/build.zig+1-1| ... | ... | @@ -17,7 +17,7 @@ pub fn build(b: *std.Build) void { |
| 17 | 17 | |
| 18 | 18 | const check = lib.checkObject(); |
| 19 | 19 | check.checkInSymtab(); |
| 20 | check.checkNotPresent("external"); | |
| 20 | check.checkNotPresent("external _abc"); | |
| 21 | 21 | |
| 22 | 22 | test_step.dependOn(&check.step); |
| 23 | 23 | } |