diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2021-05-24 10:41:59 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2021-05-24 10:41:59 -0700 |
| commit | 156b968ad85d6b2f6146d66f1a3a3c48b34193da (patch) | |
| tree | eb180ea03fe2320cf94e3588f4cf773bad9ea14c /src | |
| parent | e8cf15236d3b3f6d337858ad076f3ed11fca626b (diff) | |
| download | zig-156b968ad85d6b2f6146d66f1a3a3c48b34193da.tar.gz zig-156b968ad85d6b2f6146d66f1a3a3c48b34193da.zip | |
stage2: remove dead code; rename crtbegin_dir to gcc_dir
Diffstat (limited to 'src')
| -rw-r--r-- | src/Compilation.zig | 7 | ||||
| -rw-r--r-- | src/libc_installation.zig | 14 | ||||
| -rw-r--r-- | src/link/Elf.zig | 14 |
3 files changed, 14 insertions, 21 deletions
diff --git a/src/Compilation.zig b/src/Compilation.zig index b3a01b3c9d..023a54ca8d 100644 --- a/src/Compilation.zig +++ b/src/Compilation.zig @@ -3286,13 +3286,6 @@ pub fn get_libc_crt_file(comp: *Compilation, arena: *Allocator, basename: []cons return full_path; } -pub fn get_libc_crtbegin_file(comp: *Compilation, arena: *Allocator, basename: []const u8) ![]const u8 { - const lci = comp.bin_file.options.libc_installation orelse return error.LibCInstallationNotAvailable; - const crtbegin_dir_path = lci.crtbegin_dir orelse return error.LibCInstallationMissingCRTDir; - const full_path = try std.fs.path.join(arena, &[_][]const u8{ crtbegin_dir_path, basename }); - return full_path; -} - fn addBuildingGLibCJobs(comp: *Compilation) !void { try comp.work_queue.write(&[_]Job{ .{ .glibc_crt_file = .crti_o }, diff --git a/src/libc_installation.zig b/src/libc_installation.zig index 372caefc36..b9f0f0ecc7 100644 --- a/src/libc_installation.zig +++ b/src/libc_installation.zig @@ -21,7 +21,7 @@ pub const LibCInstallation = struct { crt_dir: ?[]const u8 = null, msvc_lib_dir: ?[]const u8 = null, kernel32_lib_dir: ?[]const u8 = null, - crtbegin_dir: ?[]const u8 = null, + gcc_dir: ?[]const u8 = null, pub const FindError = error{ OutOfMemory, @@ -114,8 +114,8 @@ pub const LibCInstallation = struct { }); return error.ParseError; } - if (self.crtbegin_dir == null and is_haiku) { - log.err("crtbegin_dir may not be empty for {s}\n", .{@tagName(Target.current.os.tag)}); + if (self.gcc_dir == null and is_haiku) { + log.err("gcc_dir may not be empty for {s}\n", .{@tagName(Target.current.os.tag)}); return error.ParseError; } @@ -129,7 +129,7 @@ pub const LibCInstallation = struct { const crt_dir = self.crt_dir orelse ""; const msvc_lib_dir = self.msvc_lib_dir orelse ""; const kernel32_lib_dir = self.kernel32_lib_dir orelse ""; - const crtbegin_dir = self.crtbegin_dir orelse ""; + const gcc_dir = self.gcc_dir orelse ""; try out.print( \\# The directory that contains `stdlib.h`. @@ -156,7 +156,7 @@ pub const LibCInstallation = struct { \\ \\# The directory that contains `crtbeginS.o` and `crtendS.o` \\# Only needed when targeting Haiku. - \\crtbegin_dir={s} + \\gcc_dir={s} \\ , .{ include_dir, @@ -164,7 +164,7 @@ pub const LibCInstallation = struct { crt_dir, msvc_lib_dir, kernel32_lib_dir, - crtbegin_dir, + gcc_dir, }); } @@ -442,7 +442,7 @@ pub const LibCInstallation = struct { } fn findNativeCrtBeginDirHaiku(self: *LibCInstallation, args: FindNativeOptions) FindError!void { - self.crtbegin_dir = try ccPrintFileName(.{ + self.gcc_dir = try ccPrintFileName(.{ .allocator = args.allocator, .search_basename = "crtbeginS.o", .want_dirname = .only_dir, diff --git a/src/link/Elf.zig b/src/link/Elf.zig index 8e02f5d2c6..599d6fa2bf 100644 --- a/src/link/Elf.zig +++ b/src/link/Elf.zig @@ -3310,7 +3310,7 @@ const CsuObjects = struct { .static_pie => result.set( "crt0.o", "crti.o", "crtbeginT.o", "crtendS.o", "crtn.o" ), // zig fmt: on }, - .openbsd => switch(mode) { + .openbsd => switch (mode) { // zig fmt: off .dynamic_lib => result.set( null, null, "crtbeginS.o", "crtendS.o", null ), .dynamic_exe, @@ -3352,24 +3352,24 @@ const CsuObjects = struct { if (result.crtend) |*obj| obj.* = try fs.path.join(arena, &[_][]const u8{ crt_dir_path, gccv, obj.* }); }, .haiku => { - const crtbegin_dir_path = lci.crtbegin_dir orelse return error.LibCInstallationMissingCRTDir; + const gcc_dir_path = lci.gcc_dir orelse return error.LibCInstallationMissingCRTDir; if (result.crt0) |*obj| obj.* = try fs.path.join(arena, &[_][]const u8{ crt_dir_path, obj.* }); if (result.crti) |*obj| obj.* = try fs.path.join(arena, &[_][]const u8{ crt_dir_path, obj.* }); if (result.crtn) |*obj| obj.* = try fs.path.join(arena, &[_][]const u8{ crt_dir_path, obj.* }); - if (result.crtbegin) |*obj| obj.* = try fs.path.join(arena, &[_][]const u8{ crtbegin_dir_path, obj.* }); - if (result.crtend) |*obj| obj.* = try fs.path.join(arena, &[_][]const u8{ crtbegin_dir_path, obj.* }); + if (result.crtbegin) |*obj| obj.* = try fs.path.join(arena, &[_][]const u8{ gcc_dir_path, obj.* }); + if (result.crtend) |*obj| obj.* = try fs.path.join(arena, &[_][]const u8{ gcc_dir_path, obj.* }); }, else => { - inline for (std.meta.fields(@TypeOf(result))) |f,i| { + inline for (std.meta.fields(@TypeOf(result))) |f, i| { if (@field(result, f.name)) |*obj| { obj.* = try fs.path.join(arena, &[_][]const u8{ crt_dir_path, obj.* }); } } - } + }, } } else { - inline for (std.meta.fields(@TypeOf(result))) |f,i| { + inline for (std.meta.fields(@TypeOf(result))) |f, i| { if (@field(result, f.name)) |*obj| { if (comp.crt_files.get(obj.*)) |crtf| { obj.* = crtf.full_object_path; |
