diff --git a/src/link/Elf.zig b/src/link/Elf.zig index 693ae3f83c..8e02f5d2c6 100644 --- a/src/link/Elf.zig +++ b/src/link/Elf.zig @@ -3319,6 +3319,15 @@ const CsuObjects = struct { .static_pie => result.set( "rcrt0.o", null, "crtbegin.o", "crtend.o", null ), // zig fmt: on }, + .haiku => switch (mode) { + // zig fmt: off + .dynamic_lib => result.set( null, "crti.o", "crtbeginS.o", "crtendS.o", "crtn.o" ), + .dynamic_exe => result.set( "start_dyn.o", "crti.o", "crtbegin.o", "crtend.o", "crtn.o" ), + .dynamic_pie => result.set( "start_dyn.o", "crti.o", "crtbeginS.o", "crtendS.o", "crtn.o" ), + .static_exe => result.set( "start_dyn.o", "crti.o", "crtbegin.o", "crtend.o", "crtn.o" ), + .static_pie => result.set( "start_dyn.o", "crti.o", "crtbeginS.o", "crtendS.o", "crtn.o" ), + // zig fmt: on + }, else => {}, } } @@ -3342,6 +3351,15 @@ const CsuObjects = struct { if (result.crtbegin) |*obj| obj.* = try fs.path.join(arena, &[_][]const u8{ crt_dir_path, gccv, obj.* }); 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; + 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.* }); + }, else => { inline for (std.meta.fields(@TypeOf(result))) |f,i| { if (@field(result, f.name)) |*obj| {