improvements to zig's implementation of libc and WebAssembly
* rename std/special/builtin.zig to std/special/c.zig
not to be confused with @import("builtin") which is entirely
different, this is zig's multi-target libc implementation.
* WebAssembly: build-exe is for executables which have a main().
build-lib is for building libraries of functions to use from,
for example, a web browser environment.
- for now pass --export-all for libraries when there are any
C objects because we have no way to detect the list of exports
when compiling C code.
- stop passing --no-entry for executables. if you want --no-entry
then use build-lib.
* make the "musl" ABI the default ABI for wasm32-freestanding.
* zig provides libc for wasm32-freestanding-musl.
This commit is contained in:
@@ -1376,6 +1376,9 @@ bool target_is_single_threaded(const ZigTarget *target) {
|
||||
}
|
||||
|
||||
ZigLLVM_EnvironmentType target_default_abi(ZigLLVM_ArchType arch, Os os) {
|
||||
if (arch == ZigLLVM_wasm32 || arch == ZigLLVM_wasm64) {
|
||||
return ZigLLVM_Musl;
|
||||
}
|
||||
switch (os) {
|
||||
case OsFreestanding:
|
||||
case OsAnanas:
|
||||
@@ -1490,6 +1493,7 @@ static const AvailableLibC libcs_available[] = {
|
||||
{ZigLLVM_systemz, OsLinux, ZigLLVM_Musl},
|
||||
{ZigLLVM_sparc, OsLinux, ZigLLVM_GNU},
|
||||
{ZigLLVM_sparcv9, OsLinux, ZigLLVM_GNU},
|
||||
{ZigLLVM_wasm32, OsFreestanding, ZigLLVM_Musl},
|
||||
{ZigLLVM_x86_64, OsLinux, ZigLLVM_GNU},
|
||||
{ZigLLVM_x86_64, OsLinux, ZigLLVM_GNUX32},
|
||||
{ZigLLVM_x86_64, OsLinux, ZigLLVM_Musl},
|
||||
@@ -1508,7 +1512,6 @@ bool target_can_build_libc(const ZigTarget *target) {
|
||||
}
|
||||
|
||||
const char *target_libc_generic_name(const ZigTarget *target) {
|
||||
assert(target->os == OsLinux);
|
||||
switch (target->abi) {
|
||||
case ZigLLVM_GNU:
|
||||
case ZigLLVM_GNUABIN32:
|
||||
@@ -1520,6 +1523,7 @@ const char *target_libc_generic_name(const ZigTarget *target) {
|
||||
case ZigLLVM_Musl:
|
||||
case ZigLLVM_MuslEABI:
|
||||
case ZigLLVM_MuslEABIHF:
|
||||
case ZigLLVM_UnknownEnvironment:
|
||||
return "musl";
|
||||
case ZigLLVM_CODE16:
|
||||
case ZigLLVM_EABI:
|
||||
@@ -1530,7 +1534,6 @@ const char *target_libc_generic_name(const ZigTarget *target) {
|
||||
case ZigLLVM_Cygnus:
|
||||
case ZigLLVM_CoreCLR:
|
||||
case ZigLLVM_Simulator:
|
||||
case ZigLLVM_UnknownEnvironment:
|
||||
zig_unreachable();
|
||||
}
|
||||
zig_unreachable();
|
||||
|
||||
Reference in New Issue
Block a user