Alex Rønne Petersen
084ec97811
zig.h: Introduce object format macros.
2024-12-03 12:07:34 +01:00
Alex Rønne Petersen
ace8396076
zig.h: Move some macros and includes closer to where they're used.
2024-12-03 12:07:34 +01:00
Alex Rønne Petersen
0e934c7df1
zig.h: Use C99/C11 headers if available regardless of language standard.
...
If present, these headers are usable even when compiling for older C language
versions.
Most notably, this enables zig.h atomics to work with slimcc and TinyCC in C99
mode (and earlier).
2024-12-03 12:07:34 +01:00
Alex Rønne Petersen
1c43c2c209
zig.h: Remove duplicate and unguarded stdint.h include.
...
We already do this for C99 only later in the file.
2024-12-03 12:07:34 +01:00
Alex Rønne Petersen
125bf05c27
zig.h: Implement zig_unreachable() with __assume(0) for MSVC.
2024-12-03 12:07:34 +01:00
Alex Rønne Petersen
062feb6c82
zig.h: Implement zig_frame_address() with _AddressOfReturnAddress() for MSVC.
2024-12-03 12:07:34 +01:00
Alex Rønne Petersen
37538f19cd
zig.h: Use zig_*_windows_teb() inline assembly with TinyCC and slimcc.
2024-12-03 12:07:34 +01:00
Alex Rønne Petersen
204df19d79
zig.h: Avoid depending on cpuid.h for zig_x86_cpuid().
...
Just use inline assembly instead, which is what that header does. Also make sure
we have a dummy implementation when inline assembly is unavailable.
2024-12-03 12:07:32 +01:00
Alex Rønne Petersen
24b57f4d30
zig.h: Introduce architecture macros to simplify checks throughout.
2024-12-03 11:57:21 +01:00
Alex Rønne Petersen
ba66814185
zig.h: Don't use __debugbreak() for MinGW.
...
It seems like only Clang supports this in MinGW mode, and Clang will already
take the __builtin_debugtrap() path anyway.
2024-12-03 11:57:20 +01:00
Alex Rønne Petersen
d19e1919da
zig.h: Define zig_gnuc for both GCC and Clang and stop using __GNUC__.
...
There's only one spot in the header where we want to handle GCC but not Clang,
so just add an extra check there.
2024-12-03 11:57:20 +01:00
Alex Rønne Petersen
dd1d9cce3c
zig.h: Add a zig_msvc macro to be used instead of _MSC_VER.
2024-12-03 11:57:20 +01:00
Alex Rønne Petersen
f29daebd90
zig.h: Use __thread for slimcc in pre-C11 mode.
2024-12-03 11:57:20 +01:00
Alex Rønne Petersen
fa6946f645
zig.h: Add support for C23 keywords.
...
The old spellings from C11 are deprecated in C23.
2024-12-03 11:57:20 +01:00
Alex Rønne Petersen
023a7fefb1
zig.h: Add TinyCC support where appropriate.
...
tcc doesn't have __has_attribute and __has_builtin, so we need to manually check
for tcc in these preprocessor paths.
2024-12-03 11:57:20 +01:00
Alex Rønne Petersen
43a1b88bc8
zig.h: Use __BYTE_ORDER__ instead of __LITTLE_ENDIAN__ for endianness check.
...
The former is supported by most compilers while the latter is Clang-only.
2024-12-03 11:57:20 +01:00
Andrew Kelley
4e09e363cd
Merge pull request #21720 from kubkon/macho-dwarf-v5
...
macho: add basic handling of DWARFv5
2024-12-03 02:28:22 -05:00
Jakub Konka
29c7f6810f
macho: fix 32bit builds
2024-12-02 22:05:21 -05:00
Jakub Konka
f78006c1bf
CMakeLists: add MachO/Dwarf.zig and remove MachO/dwarf.zig
2024-12-02 22:05:21 -05:00
Jakub Konka
0769afbb0f
macho: refactors errors from parsing DWARF
...
Currently we don't report any errors to the user due to a bug in
self-hosted x86_64-macos backend.
2024-12-02 22:05:21 -05:00
Jakub Konka
c824b35051
macho: move things around in MachO/Object.zig and refactor
2024-12-02 22:05:21 -05:00
Jakub Konka
8e81500051
macho: handle DWARFv5 when parsing debug info in objects
2024-12-02 22:05:21 -05:00
Jakub Konka
808306f49a
macho: rename dwarf.zig to Dwarf.zig
...
Separate commit since macOS is case-insensitive by default and so
I had to do it from Linux.
2024-12-02 22:05:21 -05:00
Jacob Young
c013f45ad0
coff: fix memory leak
2024-12-02 16:01:58 -05:00
Alex Rønne Petersen
5c6b25d9bb
Merge pull request #22115 from alexrp/x32-tests
...
`test`: Add `x86_64-linux-(gnux32,muslx32)` to module tests.
2024-12-01 13:43:16 +01:00
Alex Rønne Petersen
1731510933
test: Add x86_64-linux-(gnux32,muslx32) to module tests.
2024-12-01 02:23:55 +01:00
Alex Rønne Petersen
14c79203c4
std.os.linux: Fix fadvise64 syscall selection for n32/x32.
2024-12-01 02:23:55 +01:00
Tw
aa7d138462
zig fetch: add missing path separator in error message
...
Signed-off-by: Tw <tw19881113@gmail.com>
2024-11-29 18:50:21 -05:00
Andrew Kelley
8d8801c96d
Merge pull request #19968 from wooster0/eql
...
std.mem.eql: make comparisons for zero-sized and non-sized types work
2024-11-29 16:19:39 -05:00
Pat Tullmann
5e1a83ad29
defaultPanic: @trap on 'other' target
...
The freestanding and other OS targets by default need to just @trap in the
default Panic implementation.
And `isValidMemory` won't work with freestanding or other targets.
Update the unwind_freestanding.zig test case to also run on the 'other' OS
target, too. This should keep the Zig's stacktrace generation from
regressing on the standalone targets.
2024-11-29 15:30:05 -05:00
Andrew Kelley
a47aa9dd9d
Merge pull request #22095 from alexrp/test-llvm-emit
...
Change `llvm_targets` tests to actually emit objects, and fix bugs found as a result
2024-11-29 15:28:54 -05:00
mlugg
c3821fe4ca
compiler: use @Type instead of @TypeOf to print enum literal type
2024-11-29 15:26:58 -05:00
Rohan Vashisht
88d57917b7
Updated ascii.zig's isWhitespace function to use switch instead of for loop. ( #22094 )
2024-11-29 12:26:23 -08:00
Justin Braben
07cd488d42
Add build option to set tracy-callstack-depth in build.zig ( #21990 )
2024-11-29 12:13:06 -08:00
Jay Petacat
97b8d662e6
std.Build: Detect pkg-config names with "lib" prefix
2024-11-29 15:11:14 -05:00
Andrew Kelley
cfdb001a8f
Merge pull request #22099 from Rexicon226/fix-cat-mul
...
change `++` and `**` to not return mutable pointers
2024-11-29 15:05:49 -05:00
David Rubin
77f16d457b
test: adjust behaviour test to new concat/mul semantics
2024-11-28 18:05:36 -08:00
David Rubin
1d78d4f8c1
sema: hotpath ++ and ** for array-pointers
2024-11-28 18:05:36 -08:00
Alex Rønne Petersen
4a73b8cbb3
std.builtin: Add VaListXtensa.
2024-11-28 23:31:11 +01:00
Alex Rønne Petersen
78b8ce5095
test: Change llvm_targets to actually emit an object for each target.
...
Without doing this, we don't actually test whether the data layout string we
generate matches LLVM's.
A number of targets had to be commented out due to this change:
* Some are using a non-working experimental LLVM backend (arc, csky, ...).
* Some don't have working LLD support (lanai, sparc, ...).
* Some don't have working self-hosted linker support (nvptx).
* Some are using ABIs that haven't been standardized (loongarch32).
Finally, all non-x86 uefi targets are hopelessly broken and can't really be
fixed until we change our emit logic to lower *-uefi-* verbatim rather than to
*-windows-*. See: https://github.com/ziglang/zig/issues/21630
2024-11-28 22:04:00 +01:00
Alex Rønne Petersen
0bf054f4c5
test: Remove aarch64(_be)-linux-gnuilp32 from llvm_targets.
...
LLVM doesn't handle this target correctly (pointer size, etc).
2024-11-28 22:04:00 +01:00
Alex Rønne Petersen
abf3032ff1
test: Add m68k-linux-musl to llvm_targets.
2024-11-28 22:04:00 +01:00
Alex Rønne Petersen
322013c648
test: Add aarch64(_be)-linux-musl to llvm_targets.
2024-11-28 22:04:00 +01:00
Alex Rønne Petersen
11d51ea5a2
test: Remove aarch64-rtems-ilp32 from llvm_targets.
...
LLVM can't represent this target at the moment.
2024-11-28 22:04:00 +01:00
Alex Rønne Petersen
4369d3b93d
test: Add *-windows-cygnus triples to llvm_targets.
2024-11-28 22:04:00 +01:00
Alex Rønne Petersen
7361f0bafa
link.MachO: Don't try to get a semver value for bridgeos.
2024-11-28 22:04:00 +01:00
Alex Rønne Petersen
f0f2dc52cc
llvm: Lower ohoseabi to ohos instead of verbatim.
...
LLVM doesn't recognize ohoseabi.
2024-11-28 22:04:00 +01:00
Alex Rønne Petersen
7fe219998f
std.Target: Fix long double alignment for wasm(32,64)-emscripten-*.
2024-11-28 21:31:28 +01:00
Alex Rønne Petersen
6cd67cec67
std.Target: Fix long double size for aarch64-bridgeos-*.
2024-11-28 21:31:28 +01:00
Alex Rønne Petersen
310d1c1ff4
std.Target: Fix long/unsigned long size for aarch64-watchos-ilp32.
2024-11-28 21:31:28 +01:00