| author | |
| committer | |
| log | 156b968ad85d6b2f6146d66f1a3a3c48b34193da |
| tree | eb180ea03fe2320cf94e3588f4cf773bad9ea14c |
| parent | e8cf15236d3b3f6d337858ad076f3ed11fca626b |
3 files changed, 14 insertions(+), 21 deletions(-)
src/Compilation.zig-7| ... | @@ -3286,13 +3286,6 @@ pub fn get_libc_crt_file(comp: *Compilation, arena: *Allocator, basename: []cons | ... | @@ -3286,13 +3286,6 @@ pub fn get_libc_crt_file(comp: *Compilation, arena: *Allocator, basename: []cons |
| 3286 | return full_path; | 3286 | return full_path; |
| 3287 | } | 3287 | } |
| 3288 | 3288 | ||
| 3289 | pub fn get_libc_crtbegin_file(comp: *Compilation, arena: *Allocator, basename: []const u8) ![]const u8 { | ||
| 3290 | const lci = comp.bin_file.options.libc_installation orelse return error.LibCInstallationNotAvailable; | ||
| 3291 | const crtbegin_dir_path = lci.crtbegin_dir orelse return error.LibCInstallationMissingCRTDir; | ||
| 3292 | const full_path = try std.fs.path.join(arena, &[_][]const u8{ crtbegin_dir_path, basename }); | ||
| 3293 | return full_path; | ||
| 3294 | } | ||
| 3295 | |||
| 3296 | fn addBuildingGLibCJobs(comp: *Compilation) !void { | 3289 | fn addBuildingGLibCJobs(comp: *Compilation) !void { |
| 3297 | try comp.work_queue.write(&[_]Job{ | 3290 | try comp.work_queue.write(&[_]Job{ |
| 3298 | .{ .glibc_crt_file = .crti_o }, | 3291 | .{ .glibc_crt_file = .crti_o }, |
src/libc_installation.zig+7-7| ... | @@ -21,7 +21,7 @@ pub const LibCInstallation = struct { | ... | @@ -21,7 +21,7 @@ pub const LibCInstallation = struct { |
| 21 | crt_dir: ?[]const u8 = null, | 21 | crt_dir: ?[]const u8 = null, |
| 22 | msvc_lib_dir: ?[]const u8 = null, | 22 | msvc_lib_dir: ?[]const u8 = null, |
| 23 | kernel32_lib_dir: ?[]const u8 = null, | 23 | kernel32_lib_dir: ?[]const u8 = null, |
| 24 | crtbegin_dir: ?[]const u8 = null, | 24 | gcc_dir: ?[]const u8 = null, |
| 25 | 25 | ||
| 26 | pub const FindError = error{ | 26 | pub const FindError = error{ |
| 27 | OutOfMemory, | 27 | OutOfMemory, |
| ... | @@ -114,8 +114,8 @@ pub const LibCInstallation = struct { | ... | @@ -114,8 +114,8 @@ pub const LibCInstallation = struct { |
| 114 | }); | 114 | }); |
| 115 | return error.ParseError; | 115 | return error.ParseError; |
| 116 | } | 116 | } |
| 117 | if (self.crtbegin_dir == null and is_haiku) { | 117 | if (self.gcc_dir == null and is_haiku) { |
| 118 | log.err("crtbegin_dir may not be empty for {s}\n", .{@tagName(Target.current.os.tag)}); | 118 | log.err("gcc_dir may not be empty for {s}\n", .{@tagName(Target.current.os.tag)}); |
| 119 | return error.ParseError; | 119 | return error.ParseError; |
| 120 | } | 120 | } |
| 121 | 121 | ||
| ... | @@ -129,7 +129,7 @@ pub const LibCInstallation = struct { | ... | @@ -129,7 +129,7 @@ pub const LibCInstallation = struct { |
| 129 | const crt_dir = self.crt_dir orelse ""; | 129 | const crt_dir = self.crt_dir orelse ""; |
| 130 | const msvc_lib_dir = self.msvc_lib_dir orelse ""; | 130 | const msvc_lib_dir = self.msvc_lib_dir orelse ""; |
| 131 | const kernel32_lib_dir = self.kernel32_lib_dir orelse ""; | 131 | const kernel32_lib_dir = self.kernel32_lib_dir orelse ""; |
| 132 | const crtbegin_dir = self.crtbegin_dir orelse ""; | 132 | const gcc_dir = self.gcc_dir orelse ""; |
| 133 | 133 | ||
| 134 | try out.print( | 134 | try out.print( |
| 135 | \\# The directory that contains `stdlib.h`. | 135 | \\# The directory that contains `stdlib.h`. |
| ... | @@ -156,7 +156,7 @@ pub const LibCInstallation = struct { | ... | @@ -156,7 +156,7 @@ pub const LibCInstallation = struct { |
| 156 | \\ | 156 | \\ |
| 157 | \\# The directory that contains `crtbeginS.o` and `crtendS.o` | 157 | \\# The directory that contains `crtbeginS.o` and `crtendS.o` |
| 158 | \\# Only needed when targeting Haiku. | 158 | \\# Only needed when targeting Haiku. |
| 159 | \\crtbegin_dir={s} | 159 | \\gcc_dir={s} |
| 160 | \\ | 160 | \\ |
| 161 | , .{ | 161 | , .{ |
| 162 | include_dir, | 162 | include_dir, |
| ... | @@ -164,7 +164,7 @@ pub const LibCInstallation = struct { | ... | @@ -164,7 +164,7 @@ pub const LibCInstallation = struct { |
| 164 | crt_dir, | 164 | crt_dir, |
| 165 | msvc_lib_dir, | 165 | msvc_lib_dir, |
| 166 | kernel32_lib_dir, | 166 | kernel32_lib_dir, |
| 167 | crtbegin_dir, | 167 | gcc_dir, |
| 168 | }); | 168 | }); |
| 169 | } | 169 | } |
| 170 | 170 | ||
| ... | @@ -442,7 +442,7 @@ pub const LibCInstallation = struct { | ... | @@ -442,7 +442,7 @@ pub const LibCInstallation = struct { |
| 442 | } | 442 | } |
| 443 | 443 | ||
| 444 | fn findNativeCrtBeginDirHaiku(self: *LibCInstallation, args: FindNativeOptions) FindError!void { | 444 | fn findNativeCrtBeginDirHaiku(self: *LibCInstallation, args: FindNativeOptions) FindError!void { |
| 445 | self.crtbegin_dir = try ccPrintFileName(.{ | 445 | self.gcc_dir = try ccPrintFileName(.{ |
| 446 | .allocator = args.allocator, | 446 | .allocator = args.allocator, |
| 447 | .search_basename = "crtbeginS.o", | 447 | .search_basename = "crtbeginS.o", |
| 448 | .want_dirname = .only_dir, | 448 | .want_dirname = .only_dir, |
src/link/Elf.zig+7-7| ... | @@ -3310,7 +3310,7 @@ const CsuObjects = struct { | ... | @@ -3310,7 +3310,7 @@ const CsuObjects = struct { |
| 3310 | .static_pie => result.set( "crt0.o", "crti.o", "crtbeginT.o", "crtendS.o", "crtn.o" ), | 3310 | .static_pie => result.set( "crt0.o", "crti.o", "crtbeginT.o", "crtendS.o", "crtn.o" ), |
| 3311 | // zig fmt: on | 3311 | // zig fmt: on |
| 3312 | }, | 3312 | }, |
| 3313 | .openbsd => switch(mode) { | 3313 | .openbsd => switch (mode) { |
| 3314 | // zig fmt: off | 3314 | // zig fmt: off |
| 3315 | .dynamic_lib => result.set( null, null, "crtbeginS.o", "crtendS.o", null ), | 3315 | .dynamic_lib => result.set( null, null, "crtbeginS.o", "crtendS.o", null ), |
| 3316 | .dynamic_exe, | 3316 | .dynamic_exe, |
| ... | @@ -3352,24 +3352,24 @@ const CsuObjects = struct { | ... | @@ -3352,24 +3352,24 @@ const CsuObjects = struct { |
| 3352 | if (result.crtend) |*obj| obj.* = try fs.path.join(arena, &[_][]const u8{ crt_dir_path, gccv, obj.* }); | 3352 | if (result.crtend) |*obj| obj.* = try fs.path.join(arena, &[_][]const u8{ crt_dir_path, gccv, obj.* }); |
| 3353 | }, | 3353 | }, |
| 3354 | .haiku => { | 3354 | .haiku => { |
| 3355 | const crtbegin_dir_path = lci.crtbegin_dir orelse return error.LibCInstallationMissingCRTDir; | 3355 | const gcc_dir_path = lci.gcc_dir orelse return error.LibCInstallationMissingCRTDir; |
| 3356 | if (result.crt0) |*obj| obj.* = try fs.path.join(arena, &[_][]const u8{ crt_dir_path, obj.* }); | 3356 | if (result.crt0) |*obj| obj.* = try fs.path.join(arena, &[_][]const u8{ crt_dir_path, obj.* }); |
| 3357 | if (result.crti) |*obj| obj.* = try fs.path.join(arena, &[_][]const u8{ crt_dir_path, obj.* }); | 3357 | if (result.crti) |*obj| obj.* = try fs.path.join(arena, &[_][]const u8{ crt_dir_path, obj.* }); |
| 3358 | if (result.crtn) |*obj| obj.* = try fs.path.join(arena, &[_][]const u8{ crt_dir_path, obj.* }); | 3358 | if (result.crtn) |*obj| obj.* = try fs.path.join(arena, &[_][]const u8{ crt_dir_path, obj.* }); |
| 3359 | 3359 | ||
| 3360 | if (result.crtbegin) |*obj| obj.* = try fs.path.join(arena, &[_][]const u8{ crtbegin_dir_path, obj.* }); | 3360 | if (result.crtbegin) |*obj| obj.* = try fs.path.join(arena, &[_][]const u8{ gcc_dir_path, obj.* }); |
| 3361 | if (result.crtend) |*obj| obj.* = try fs.path.join(arena, &[_][]const u8{ crtbegin_dir_path, obj.* }); | 3361 | if (result.crtend) |*obj| obj.* = try fs.path.join(arena, &[_][]const u8{ gcc_dir_path, obj.* }); |
| 3362 | }, | 3362 | }, |
| 3363 | else => { | 3363 | else => { |
| 3364 | inline for (std.meta.fields(@TypeOf(result))) |f,i| { | 3364 | inline for (std.meta.fields(@TypeOf(result))) |f, i| { |
| 3365 | if (@field(result, f.name)) |*obj| { | 3365 | if (@field(result, f.name)) |*obj| { |
| 3366 | obj.* = try fs.path.join(arena, &[_][]const u8{ crt_dir_path, obj.* }); | 3366 | obj.* = try fs.path.join(arena, &[_][]const u8{ crt_dir_path, obj.* }); |
| 3367 | } | 3367 | } |
| 3368 | } | 3368 | } |
| 3369 | } | 3369 | }, |
| 3370 | } | 3370 | } |
| 3371 | } else { | 3371 | } else { |
| 3372 | inline for (std.meta.fields(@TypeOf(result))) |f,i| { | 3372 | inline for (std.meta.fields(@TypeOf(result))) |f, i| { |
| 3373 | if (@field(result, f.name)) |*obj| { | 3373 | if (@field(result, f.name)) |*obj| { |
| 3374 | if (comp.crt_files.get(obj.*)) |crtf| { | 3374 | if (comp.crt_files.get(obj.*)) |crtf| { |
| 3375 | obj.* = crtf.full_object_path; | 3375 | obj.* = crtf.full_object_path; |