solaris: hard-code ABI and dynamic linker

Solaris/illumos is multi-lib, so you can't rely on an arbitrary
executable to give you the correct dynamic linker. Besides, it's
always the same path.
This commit is contained in:
Ryan Zezeski 2023-09-26 16:15:00 -06:00
parent 68bcd7ddd4
commit 54ad5f31c6
2 changed files with 5 additions and 3 deletions

View File

@ -526,7 +526,6 @@ pub const Target = struct {
.cloudabi,
.dragonfly,
.lv2,
.solaris,
.zos,
.minix,
.rtems,
@ -569,6 +568,7 @@ pub const Target = struct {
.driverkit,
.shadermodel,
.liteos, // TODO: audit this
.solaris,
=> return .none,
}
}
@ -1575,7 +1575,7 @@ pub const Target = struct {
.netbsd => return copy(&result, "/libexec/ld.elf_so"),
.openbsd => return copy(&result, "/usr/libexec/ld.so"),
.dragonfly => return copy(&result, "/libexec/ld-elf.so.2"),
.solaris => return copy(&result, "/lib/64/ld.so.1"),
.solaris => return copy(&result, "/usr/lib/amd64/ld.so.1"),
.linux => switch (self.cpu.arch) {
.x86,
.sparc,

View File

@ -257,10 +257,12 @@ fn detectAbiAndDynamicLinker(
) DetectError!NativeTargetInfo {
const native_target_has_ld = comptime builtin.target.hasDynamicLinker();
const is_linux = builtin.target.os.tag == .linux;
const is_solaris = builtin.target.os.tag == .solaris;
const have_all_info = cross_target.dynamic_linker.get() != null and
cross_target.abi != null and (!is_linux or cross_target.abi.?.isGnu());
const os_is_non_native = cross_target.os_tag != null;
if (!native_target_has_ld or have_all_info or os_is_non_native) {
// The Solaris/illumos environment is always the same.
if (!native_target_has_ld or have_all_info or os_is_non_native or is_solaris) {
return defaultAbiAndDynamicLinker(cpu, os, cross_target);
}
if (cross_target.abi) |abi| {