authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-05-24 10:41:59-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-05-24 10:41:59-07:00
log156b968ad85d6b2f6146d66f1a3a3c48b34193da
treeeb180ea03fe2320cf94e3588f4cf773bad9ea14c
parente8cf15236d3b3f6d337858ad076f3ed11fca626b

stage2: remove dead code; rename crtbegin_dir to gcc_dir


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
32863286 return full_path;
32873287}
32883288
3289pub 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
32963289fn addBuildingGLibCJobs(comp: *Compilation) !void {
32973290 try comp.work_queue.write(&[_]Job{
32983291 .{ .glibc_crt_file = .crti_o },
src/libc_installation.zig+7-7
......@@ -21,7 +21,7 @@ pub const LibCInstallation = struct {
2121 crt_dir: ?[]const u8 = null,
2222 msvc_lib_dir: ?[]const u8 = null,
2323 kernel32_lib_dir: ?[]const u8 = null,
24 crtbegin_dir: ?[]const u8 = null,
24 gcc_dir: ?[]const u8 = null,
2525
2626 pub const FindError = error{
2727 OutOfMemory,
......@@ -114,8 +114,8 @@ pub const LibCInstallation = struct {
114114 });
115115 return error.ParseError;
116116 }
117 if (self.crtbegin_dir == null and is_haiku) {
118 log.err("crtbegin_dir may not be empty for {s}\n", .{@tagName(Target.current.os.tag)});
117 if (self.gcc_dir == null and is_haiku) {
118 log.err("gcc_dir may not be empty for {s}\n", .{@tagName(Target.current.os.tag)});
119119 return error.ParseError;
120120 }
121121
......@@ -129,7 +129,7 @@ pub const LibCInstallation = struct {
129129 const crt_dir = self.crt_dir orelse "";
130130 const msvc_lib_dir = self.msvc_lib_dir orelse "";
131131 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 "";
133133
134134 try out.print(
135135 \\# The directory that contains `stdlib.h`.
......@@ -156,7 +156,7 @@ pub const LibCInstallation = struct {
156156 \\
157157 \\# The directory that contains `crtbeginS.o` and `crtendS.o`
158158 \\# Only needed when targeting Haiku.
159 \\crtbegin_dir={s}
159 \\gcc_dir={s}
160160 \\
161161 , .{
162162 include_dir,
......@@ -164,7 +164,7 @@ pub const LibCInstallation = struct {
164164 crt_dir,
165165 msvc_lib_dir,
166166 kernel32_lib_dir,
167 crtbegin_dir,
167 gcc_dir,
168168 });
169169 }
170170
......@@ -442,7 +442,7 @@ pub const LibCInstallation = struct {
442442 }
443443
444444 fn findNativeCrtBeginDirHaiku(self: *LibCInstallation, args: FindNativeOptions) FindError!void {
445 self.crtbegin_dir = try ccPrintFileName(.{
445 self.gcc_dir = try ccPrintFileName(.{
446446 .allocator = args.allocator,
447447 .search_basename = "crtbeginS.o",
448448 .want_dirname = .only_dir,
src/link/Elf.zig+7-7
......@@ -3310,7 +3310,7 @@ const CsuObjects = struct {
33103310 .static_pie => result.set( "crt0.o", "crti.o", "crtbeginT.o", "crtendS.o", "crtn.o" ),
33113311 // zig fmt: on
33123312 },
3313 .openbsd => switch(mode) {
3313 .openbsd => switch (mode) {
33143314 // zig fmt: off
33153315 .dynamic_lib => result.set( null, null, "crtbeginS.o", "crtendS.o", null ),
33163316 .dynamic_exe,
......@@ -3352,24 +3352,24 @@ const CsuObjects = struct {
33523352 if (result.crtend) |*obj| obj.* = try fs.path.join(arena, &[_][]const u8{ crt_dir_path, gccv, obj.* });
33533353 },
33543354 .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;
33563356 if (result.crt0) |*obj| obj.* = try fs.path.join(arena, &[_][]const u8{ crt_dir_path, obj.* });
33573357 if (result.crti) |*obj| obj.* = try fs.path.join(arena, &[_][]const u8{ crt_dir_path, obj.* });
33583358 if (result.crtn) |*obj| obj.* = try fs.path.join(arena, &[_][]const u8{ crt_dir_path, obj.* });
33593359
3360 if (result.crtbegin) |*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{ 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{ gcc_dir_path, obj.* });
33623362 },
33633363 else => {
3364 inline for (std.meta.fields(@TypeOf(result))) |f,i| {
3364 inline for (std.meta.fields(@TypeOf(result))) |f, i| {
33653365 if (@field(result, f.name)) |*obj| {
33663366 obj.* = try fs.path.join(arena, &[_][]const u8{ crt_dir_path, obj.* });
33673367 }
33683368 }
3369 }
3369 },
33703370 }
33713371 } else {
3372 inline for (std.meta.fields(@TypeOf(result))) |f,i| {
3372 inline for (std.meta.fields(@TypeOf(result))) |f, i| {
33733373 if (@field(result, f.name)) |*obj| {
33743374 if (comp.crt_files.get(obj.*)) |crtf| {
33753375 obj.* = crtf.full_object_path;