Commit 10e172b1d7
Changed files (5)
lib/std/special/start.zig
@@ -32,14 +32,16 @@ comptime {
if (!@hasDecl(root, "WinMain") and !@hasDecl(root, "WinMainCRTStartup")) {
@export("WinMainCRTStartup", WinMainCRTStartup, .Strong);
}
- } else if (is_wasm and builtin.os == .freestanding) {
- if (!@hasDecl(root, "_start")) @export("_start", wasm_freestanding_start, .Strong);
} else if (builtin.os == .uefi) {
if (!@hasDecl(root, "EfiMain")) @export("EfiMain", EfiMain, .Strong);
- } else if (is_mips) {
- if (!@hasDecl(root, "__start")) @export("__start", _start, .Strong);
- } else {
- if (!@hasDecl(root, "_start")) @export("_start", _start, .Strong);
+ } else if (builtin.os != .freestanding) {
+ if (is_mips) {
+ if (!@hasDecl(root, "__start")) @export("__start", _start, .Strong);
+ } else {
+ if (!@hasDecl(root, "_start")) @export("_start", _start, .Strong);
+ }
+ } else if (is_wasm) {
+ if (!@hasDecl(root, "_start")) @export("_start", wasm_freestanding_start, .Strong);
}
}
}
lib/std/target.zig
@@ -46,6 +46,7 @@ pub const Target = union(enum) {
wasi,
emscripten,
uefi,
+ other,
};
pub const Arch = union(enum) {
@@ -432,6 +433,7 @@ pub const Target = union(enum) {
.contiki,
.amdpal,
.hermit,
+ .other,
=> return .eabi,
.openbsd,
.macosx,
src/target.cpp
@@ -180,6 +180,7 @@ static const Os os_list[] = {
OsWASI,
OsEmscripten,
OsUefi,
+ OsOther,
};
// Coordinate with zig_llvm.h
@@ -268,6 +269,7 @@ Os target_os_enum(size_t index) {
ZigLLVM_OSType get_llvm_os_type(Os os_type) {
switch (os_type) {
case OsFreestanding:
+ case OsOther:
return ZigLLVM_UnknownOS;
case OsAnanas:
return ZigLLVM_Ananas;
@@ -425,6 +427,8 @@ const char *target_os_name(Os os_type) {
return "freestanding";
case OsUefi:
return "uefi";
+ case OsOther:
+ return "other";
case OsAnanas:
case OsCloudABI:
case OsDragonFly:
@@ -1005,6 +1009,7 @@ uint32_t target_arch_largest_atomic_bits(ZigLLVM_ArchType arch) {
uint32_t target_c_type_size_in_bits(const ZigTarget *target, CIntType id) {
switch (target->os) {
case OsFreestanding:
+ case OsOther:
switch (target->arch) {
case ZigLLVM_msp430:
switch (id) {
@@ -1134,7 +1139,8 @@ bool target_allows_addr_zero(const ZigTarget *target) {
const char *target_o_file_ext(const ZigTarget *target) {
if (target->abi == ZigLLVM_MSVC ||
(target->os == OsWindows && !target_abi_is_gnu(target->abi)) ||
- target->os == OsUefi) {
+ target->os == OsUefi)
+ {
return ".obj";
} else {
return ".o";
@@ -1376,6 +1382,7 @@ const char *target_dynamic_linker(const ZigTarget *target) {
case OsUefi:
case OsWindows:
case OsEmscripten:
+ case OsOther:
return nullptr;
case OsAnanas:
@@ -1650,6 +1657,7 @@ ZigLLVM_EnvironmentType target_default_abi(ZigLLVM_ArchType arch, Os os) {
case OsContiki:
case OsAMDPAL:
case OsHermitCore:
+ case OsOther:
return ZigLLVM_EABI;
case OsOpenBSD:
case OsMacOSX:
src/target.hpp
@@ -50,6 +50,7 @@ enum Os {
OsWASI,
OsEmscripten,
OsUefi,
+ OsOther,
};
// Synchronize with target.cpp::subarch_list_list
src-self-hosted/c_int.zig
@@ -71,7 +71,7 @@ pub const CInt = struct {
pub fn sizeInBits(cint: CInt, self: Target) u32 {
const arch = self.getArch();
switch (self.getOs()) {
- .freestanding => switch (self.getArch()) {
+ .freestanding, .other => switch (self.getArch()) {
.msp430 => switch (cint.id) {
.Short,
.UShort,