| author | |
| committer | |
| log | 6e0904504155d3cba80955c108116170fd739aec |
| tree | 478d4c606d36f4b77405fe10ddf678de1f784862 |
| parent | 2ca7cc46c41dc5fe91fe385df4f3330634bd88f3 |
It's simpler to link against compiler_rt.o directly.5 files changed, 13 insertions(+), 40 deletions(-)
src/Compilation.zig+1-18| ... | ... | @@ -112,7 +112,6 @@ unwind_tables: bool, |
| 112 | 112 | test_evented_io: bool, |
| 113 | 113 | debug_compiler_runtime_libs: bool, |
| 114 | 114 | debug_compile_errors: bool, |
| 115 | job_queued_compiler_rt_lib: bool = false, | |
| 116 | 115 | job_queued_compiler_rt_obj: bool = false, |
| 117 | 116 | alloc_failure_occurred: bool = false, |
| 118 | 117 | formatted_panics: bool = false, |
| ... | ... | @@ -158,9 +157,6 @@ libssp_static_lib: ?CRTFile = null, |
| 158 | 157 | /// Populated when we build the libc static library. A Job to build this is placed in the queue |
| 159 | 158 | /// and resolved before calling linker.flush(). |
| 160 | 159 | libc_static_lib: ?CRTFile = null, |
| 161 | /// Populated when we build the libcompiler_rt static library. A Job to build this is indicated | |
| 162 | /// by setting `job_queued_compiler_rt_lib` and resolved before calling linker.flush(). | |
| 163 | compiler_rt_lib: ?CRTFile = null, | |
| 164 | 160 | /// Populated when we build the compiler_rt_obj object. A Job to build this is indicated |
| 165 | 161 | /// by setting `job_queued_compiler_rt_obj` and resolved before calling linker.flush(). |
| 166 | 162 | compiler_rt_obj: ?CRTFile = null, |
| ... | ... | @@ -1877,13 +1873,8 @@ pub fn create(gpa: Allocator, options: InitOptions) !*Compilation { |
| 1877 | 1873 | } |
| 1878 | 1874 | |
| 1879 | 1875 | if (comp.bin_file.options.include_compiler_rt and capable_of_building_compiler_rt) { |
| 1880 | if (is_exe_or_dyn_lib) { | |
| 1881 | log.debug("queuing a job to build compiler_rt_lib", .{}); | |
| 1882 | comp.job_queued_compiler_rt_lib = true; | |
| 1883 | } else if (options.output_mode != .Obj) { | |
| 1876 | if (is_exe_or_dyn_lib or options.output_mode != .Obj) { | |
| 1884 | 1877 | log.debug("queuing a job to build compiler_rt_obj", .{}); |
| 1885 | // In this case we are making a static library, so we ask | |
| 1886 | // for a compiler-rt object to put in it. | |
| 1887 | 1878 | comp.job_queued_compiler_rt_obj = true; |
| 1888 | 1879 | } |
| 1889 | 1880 | } |
| ... | ... | @@ -1938,9 +1929,6 @@ pub fn destroy(self: *Compilation) void { |
| 1938 | 1929 | if (self.libcxxabi_static_lib) |*crt_file| { |
| 1939 | 1930 | crt_file.deinit(gpa); |
| 1940 | 1931 | } |
| 1941 | if (self.compiler_rt_lib) |*crt_file| { | |
| 1942 | crt_file.deinit(gpa); | |
| 1943 | } | |
| 1944 | 1932 | if (self.compiler_rt_obj) |*crt_file| { |
| 1945 | 1933 | crt_file.deinit(gpa); |
| 1946 | 1934 | } |
| ... | ... | @@ -3407,11 +3395,6 @@ pub fn performAllTheWork( |
| 3407 | 3395 | break; |
| 3408 | 3396 | } |
| 3409 | 3397 | |
| 3410 | if (comp.job_queued_compiler_rt_lib) { | |
| 3411 | comp.job_queued_compiler_rt_lib = false; | |
| 3412 | buildCompilerRtOneShot(comp, .Lib, &comp.compiler_rt_lib, main_progress_node); | |
| 3413 | } | |
| 3414 | ||
| 3415 | 3398 | if (comp.job_queued_compiler_rt_obj) { |
| 3416 | 3399 | comp.job_queued_compiler_rt_obj = false; |
| 3417 | 3400 | buildCompilerRtOneShot(comp, .Obj, &comp.compiler_rt_obj, main_progress_node); |
src/link/Coff/lld.zig+2-2| ... | ... | @@ -491,8 +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); | |
| 494 | if (comp.compiler_rt_obj) |obj| { | |
| 495 | try argv.append(obj.full_object_path); | |
| 496 | 496 | } |
| 497 | 497 | } |
| 498 | 498 |
src/link/Elf.zig-2| ... | ... | @@ -1257,7 +1257,6 @@ pub fn flushModule(self: *Elf, comp: *Compilation, prog_node: *std.Progress.Node |
| 1257 | 1257 | // to be after the shared libraries, so they are picked up from the shared |
| 1258 | 1258 | // libraries, not libcompiler_rt. |
| 1259 | 1259 | const compiler_rt_path: ?[]const u8 = blk: { |
| 1260 | if (comp.compiler_rt_lib) |x| break :blk x.full_object_path; | |
| 1261 | 1260 | if (comp.compiler_rt_obj) |x| break :blk x.full_object_path; |
| 1262 | 1261 | break :blk null; |
| 1263 | 1262 | }; |
| ... | ... | @@ -1957,7 +1956,6 @@ fn linkWithLLD(self: *Elf, comp: *Compilation, prog_node: *std.Progress.Node) !v |
| 1957 | 1956 | const stack_size = self.base.options.stack_size_override orelse 16777216; |
| 1958 | 1957 | const allow_shlib_undefined = self.base.options.allow_shlib_undefined orelse !self.base.options.is_native_os; |
| 1959 | 1958 | const compiler_rt_path: ?[]const u8 = blk: { |
| 1960 | if (comp.compiler_rt_lib) |x| break :blk x.full_object_path; | |
| 1961 | 1959 | if (comp.compiler_rt_obj) |x| break :blk x.full_object_path; |
| 1962 | 1960 | break :blk null; |
| 1963 | 1961 | }; |
src/link/MachO/zld.zig+4-4| ... | ... | @@ -186,8 +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 }); | |
| 189 | if (comp.compiler_rt_obj) |obj| { | |
| 190 | try positionals.append(.{ .path = obj.full_object_path }); | |
| 191 | 191 | } |
| 192 | 192 | |
| 193 | 193 | // libc++ dep |
| ... | ... | @@ -301,8 +301,8 @@ pub fn linkWithZld( |
| 301 | 301 | try argv.append(p); |
| 302 | 302 | } |
| 303 | 303 | |
| 304 | if (comp.compiler_rt_lib) |lib| { | |
| 305 | try argv.append(lib.full_object_path); | |
| 304 | if (comp.compiler_rt_obj) |obj| { | |
| 305 | try argv.append(obj.full_object_path); | |
| 306 | 306 | } |
| 307 | 307 | |
| 308 | 308 | if (options.link_libcpp) { |
src/link/Wasm.zig+6-14| ... | ... | @@ -3257,11 +3257,7 @@ 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 = if (comp.compiler_rt_obj) |o| o.full_object_path else null; | |
| 3265 | 3261 | const id_symlink_basename = "zld.id"; |
| 3266 | 3262 | |
| 3267 | 3263 | var man: Cache.Manifest = undefined; |
| ... | ... | @@ -3376,8 +3372,8 @@ fn linkWithZld(wasm: *Wasm, comp: *Compilation, prog_node: *std.Progress.Node) l |
| 3376 | 3372 | try positionals.append(c_object.status.success.object_path); |
| 3377 | 3373 | } |
| 3378 | 3374 | |
| 3379 | if (comp.compiler_rt_lib) |lib| { | |
| 3380 | try positionals.append(lib.full_object_path); | |
| 3375 | if (comp.compiler_rt_obj) |obj| { | |
| 3376 | try positionals.append(obj.full_object_path); | |
| 3381 | 3377 | } |
| 3382 | 3378 | |
| 3383 | 3379 | try wasm.parseInputFiles(positionals.items); |
| ... | ... | @@ -3463,8 +3459,8 @@ pub fn flushModule(wasm: *Wasm, comp: *Compilation, prog_node: *std.Progress.Nod |
| 3463 | 3459 | try positionals.append(c_object.status.success.object_path); |
| 3464 | 3460 | } |
| 3465 | 3461 | |
| 3466 | if (comp.compiler_rt_lib) |lib| { | |
| 3467 | try positionals.append(lib.full_object_path); | |
| 3462 | if (comp.compiler_rt_obj) |obj| { | |
| 3463 | try positionals.append(obj.full_object_path); | |
| 3468 | 3464 | } |
| 3469 | 3465 | |
| 3470 | 3466 | try wasm.parseInputFiles(positionals.items); |
| ... | ... | @@ -4325,11 +4321,7 @@ fn linkWithLLD(wasm: *Wasm, comp: *Compilation, prog_node: *std.Progress.Node) ! |
| 4325 | 4321 | defer sub_prog_node.end(); |
| 4326 | 4322 | |
| 4327 | 4323 | 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; | |
| 4324 | const compiler_rt_path: ?[]const u8 = if (comp.compiler_rt_obj) |o| o.full_object_path else null; | |
| 4333 | 4325 | |
| 4334 | 4326 | const target = wasm.base.options.target; |
| 4335 | 4327 |