stage2: remove dead code; rename crtbegin_dir to gcc_dir
This commit is contained in:
@@ -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 },
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user