aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/libc_installation.zig1
-rw-r--r--src/link/Elf.zig9
-rw-r--r--src/stage1/os.hpp2
-rw-r--r--src/stage1/target.cpp5
-rw-r--r--src/target.zig7
-rw-r--r--src/type.zig2
6 files changed, 24 insertions, 2 deletions
diff --git a/src/libc_installation.zig b/src/libc_installation.zig
index 62174930f8..d54af71415 100644
--- a/src/libc_installation.zig
+++ b/src/libc_installation.zig
@@ -221,6 +221,7 @@ pub const LibCInstallation = struct {
batch.add(&async self.findNativeIncludeDirPosix(args));
switch (Target.current.os.tag) {
.freebsd, .netbsd, .openbsd, .dragonfly => self.crt_dir = try std.mem.dupeZ(args.allocator, u8, "/usr/lib"),
+ .solaris => self.crt_dir = try std.mem.dupeZ(args.allocator, u8, "/usr/lib/64"),
.linux => batch.add(&async self.findNativeCrtDirPosix(args)),
else => {},
}
diff --git a/src/link/Elf.zig b/src/link/Elf.zig
index ec047ced35..6c3220d39e 100644
--- a/src/link/Elf.zig
+++ b/src/link/Elf.zig
@@ -3446,6 +3446,15 @@ const CsuObjects = struct {
.static_pie => result.set( "start_dyn.o", "crti.o", "crtbeginS.o", "crtendS.o", "crtn.o" ),
// zig fmt: on
},
+ .solaris => switch (mode) {
+ // zig fmt: off
+ .dynamic_lib => result.set( null, "crti.o", null, null, "crtn.o" ),
+ .dynamic_exe,
+ .dynamic_pie => result.set( "crt1.o", "crti.o", null, null, "crtn.o" ),
+ .static_exe,
+ .static_pie => result.set( null, null, null, null, null ),
+ // zig fmt: on
+ },
else => {},
}
}
diff --git a/src/stage1/os.hpp b/src/stage1/os.hpp
index f1022778d4..6d086c8901 100644
--- a/src/stage1/os.hpp
+++ b/src/stage1/os.hpp
@@ -33,6 +33,8 @@
#define ZIG_OS_OPENBSD
#elif defined(__HAIKU__)
#define ZIG_OS_HAIKU
+#elif defined(__sun)
+#define ZIG_OS_SOLARIS
#else
#define ZIG_OS_UNKNOWN
#endif
diff --git a/src/stage1/target.cpp b/src/stage1/target.cpp
index 8415b1934e..4da19e4c36 100644
--- a/src/stage1/target.cpp
+++ b/src/stage1/target.cpp
@@ -399,6 +399,9 @@ Error target_parse_os(Os *out_os, const char *os_ptr, size_t os_len) {
#elif defined(ZIG_OS_HAIKU)
*out_os = OsHaiku;
return ErrorNone;
+#elif defined(ZIG_OS_SOLARIS)
+ *out_os = OsSolaris;
+ return ErrorNone;
#else
zig_panic("stage1 is unable to detect native target for this OS");
#endif
@@ -670,6 +673,7 @@ uint32_t target_c_type_size_in_bits(const ZigTarget *target, CIntType id) {
case OsOpenBSD:
case OsWASI:
case OsHaiku:
+ case OsSolaris:
case OsEmscripten:
case OsPlan9:
switch (id) {
@@ -728,7 +732,6 @@ uint32_t target_c_type_size_in_bits(const ZigTarget *target, CIntType id) {
case OsCloudABI:
case OsKFreeBSD:
case OsLv2:
- case OsSolaris:
case OsZOS:
case OsMinix:
case OsRTEMS:
diff --git a/src/target.zig b/src/target.zig
index 09e65ff909..621335209c 100644
--- a/src/target.zig
+++ b/src/target.zig
@@ -433,6 +433,13 @@ pub fn libcFullLinkFlags(target: std.Target) []const []const u8 {
"-lc",
"-lutil",
},
+ .solaris => &[_][]const u8{
+ "-lm",
+ "-lsocket",
+ "-lnsl",
+ // Solaris releases after 10 merged the threading libraries into libc.
+ "-lc",
+ },
.haiku => &[_][]const u8{
"-lm",
"-lroot",
diff --git a/src/type.zig b/src/type.zig
index 4a0f2a0536..a2da252f61 100644
--- a/src/type.zig
+++ b/src/type.zig
@@ -3800,6 +3800,7 @@ pub const CType = enum {
.wasi,
.emscripten,
.plan9,
+ .solaris,
=> switch (self) {
.short,
.ushort,
@@ -3851,7 +3852,6 @@ pub const CType = enum {
.fuchsia,
.kfreebsd,
.lv2,
- .solaris,
.zos,
.haiku,
.minix,