aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2022-09-13add compile error test for pointless discardsAndrew Kelley
2022-09-13remove pointless discards in test casesAndrew Kelley
2022-09-13stage2: remove pointless discards from source codeAndrew Kelley
Good riddance!
2022-09-13translate-c: lower discards differentlyAndrew Kelley
This makes translate-c lower discards as `_ = @TypeOf(foo);` to avoid tripping the "pointless discard" error. Ideally, translate-c would avoid emitting pointless discards, in which case this commit can be reverted, however, that is a separate enhancement.
2022-09-12Sema: introduce Type.ptrAlignmentAdvancedAndrew Kelley
I'm not sure why the other commits in this branch caused this fix to be necessary. Also, there seems to be more fixes necessary before tests will pass.
2022-09-12remove pointless discardsAndrew Kelley
2022-09-12stage2: change how defers are stored in ZirVeikka Tuominen
Storing defers this way has the benefits that the defer doesn't get analyzed multiple times in AstGen, it takes up less space, and it makes Sema aware of defers allowing for 'unreachable else prong' error on error sets in generic code. The disadvantage is that it is a bit more complex and errdefers with payloads now emit a placeholder instruction (but those are rare). Sema.zig before: Total ZIR bytes: 3.7794370651245117MiB Instructions: 238996 (2.051319122314453MiB) String Table Bytes: 89.2802734375KiB Extra Data Items: 430144 (1.640869140625MiB) Sema.zig after: Total ZIR bytes: 3.3344192504882812MiB Instructions: 211829 (1.8181428909301758MiB) String Table Bytes: 89.2802734375KiB Extra Data Items: 374611 (1.4290275573730469MiB)
2022-09-11chore: Remove unused constantsShane Kennedy
2022-09-11Merge pull request #12814 from ziglang/native-libc-integrationAndrew Kelley
stage2: no condition on system libs to link native libc
2022-09-11Compilation: handle system C compiler not foundAndrew Kelley
When linking libc and compiling natively, Zig tries to integrate with the system C compiler. However, this caused Zig to fail when no system C compiler is installed, despite the fact that Zig is perfectly capable of compiling & linking libc without one. This commit makes Zig fall back to using its own ability to provide libc in the case that no C compiler is installed. For glibc, it means sometimes getting the warning "zig cannot build new glibc version abc, providing instead xyz". Ideally, Zig would do some more validation about the system libraries being linked against, and report an error in case it could not provide the exact correct libc version of the system libraries (or that the system libraries themselves conflict with each other), however, I think it is fair to call that a separate enhancement.
2022-09-11autodoc: fix regression in frontend rendering of valuesLoris Cro
2022-09-11stage2: no condition on system libs to link native libcAndrew Kelley
Before, Zig tried to use its own libc files (e.g. glibc) when there were no system libs being linked. This prevented building against native glibc on systems that have newer glibc than the ones Zig provides. Closes #12797
2022-09-11autodoc: reduce json payload sizeLoris Cro
this commit removes whitespace and changes Decl, AstNode and Type to be json arrays instead of json objects. This change reduces json payload size for the stdlib from 25mb to < 10mb.
2022-09-10autodoc: remove unnecessary string copyLoris Cro
2022-09-10x86_64: pass more behavior testsJakub Konka
2022-09-10Merge pull request #12799 from joachimschmidt557/stage2-armJakub Konka
stage2 ARM: introduce allocRegs mechanism and other improvements
2022-09-10Merge pull request #12802 from ziglang/macho-refactorJakub Konka
Self-hosted backends and linkers refactor: x86_64 + aarch64 + macho + coff
2022-09-10coff: remove unused functionJakub Konka
2022-09-10macho: refactor direct use of locals container in favour of helpersJakub Konka
2022-09-10aarch64: update codegen to using a global index rather than local indexJakub Konka
2022-09-10type: print comptime on fn type paramsJacob Young
This avoids the following confusing error message: error: expected type 'fn(i32, i32) void', found 'fn(i32, i32) void'
2022-09-10translate-c: Escape non-ASCII characters that appear in macrosEvan Haas
Macro definitions are simply a slice of bytes, which may not be UTF-8 encoded. If they are not UTF-8 encoded, escape non-printable and non-ASCII characters as `\xNN`. Fixes #12784
2022-09-10x86_64: combine got_load, direct_load and imports_load into linker_load MCVJakub Konka
2022-09-09macho+coff: return index into global table from getGlobalSymbolJakub Konka
2022-09-09coff: use global accessor abstractions from MachOJakub Konka
2022-09-09macho: use globals free list like in COFF linkerJakub Konka
2022-09-09stage2 ARM: implement basic array_elem_valjoachimschmidt557
2022-09-09stage2 ARM: implement ptr_elem_valjoachimschmidt557
2022-09-09stage2 ARM: support larger function stacksjoachimschmidt557
This is done by introducing a new Mir pseudo-instruction
2022-09-09stage2 ARM: implement struct_field_val for registersjoachimschmidt557
2022-09-09stage2 ARM: fix multiple uses of reuseOperandjoachimschmidt557
- add missing checks whether destination fits into the operand - remove reuseOperand invocations from airIsNullPtr and similar functions as we need to load the operands into temporary locations
2022-09-09stage2 ARM: amend implementation of various AIR instructionsjoachimschmidt557
- unwrap_errunion_err for registers - unwrap_errunion_payload for registers - ptr_slice_len_ptr for all MCValues - ptr_slice_ptr_ptr for all MCValues
2022-09-09stage2 ARM: implement field_parent_ptrjoachimschmidt557
2022-09-09stage2 ARM: remove remaining uses of binOp{Register,Immediate}joachimschmidt557
2022-09-09stage2 ARM: extract remaining operations out of binOpjoachimschmidt557
2022-09-09stage2 ARM: extract mul, div, and mod out of binOpjoachimschmidt557
2022-09-09stage2 ARM: extract add+sub from binOpjoachimschmidt557
This commit also lays the groundwork for further extractions from binOp.
2022-09-09stage2 ARM: move cmp to new allocReg mechanism; remove from binOpjoachimschmidt557
2022-09-09stage2 ARM: introduce allocRegsjoachimschmidt557
This new register allocation mechanism which is designed to be more generic and flexible will replace binOp.
2022-09-09stage2 ARM: improve Mir representation of mov and cmpjoachimschmidt557
2022-09-09Merge pull request #12788 from ziglang/detect-native-glibcAndrew Kelley
std.zig.system.NativeTargetInfo: improve glibc version and dynamic linker detection
2022-09-09std.zig.system.NativeTargetInfo: more headroom for libc.so.6 .dynstrAndrew Kelley
2022-09-09std.os.uefi: mark BlockIoProtocol and EfiBlockMedia as publicYusuf Bham
2022-09-09Merge pull request #12772 from ziglang/coff-basic-importsJakub Konka
coff: implement enough of the incremental linker to pass behavior and incremental tests on Windows
2022-09-09std.zig.system.NativeTargetInfo: add fallback checkAndrew Kelley
After failing to find RUNPATH in the ELF of /usr/bin/env, not finding the answer in a symlink of the dynamic interpreter, and not finding libc.so.6 in the same directory as the dynamic interpreter, Zig will check `/lib/$triple`. This fixes incorrect native glibc version detected on Debian bookworm.
2022-09-09macho: fix compilation for 32bit targetsJakub Konka
2022-09-08std.zig.system.NativeTargetInfo: restore symlink logicAndrew Kelley
This is a partial revert of the previous commit, fixing a regression on Debian. However, the commit additionally improves the detectAbiAndDynamicLinker function to read more than 1 byte at a time when detecting a shebang line.
2022-09-08std.zig.system.NativeTargetInfo: handle missing DT_RUNPATHAndrew Kelley
This commit removes the check that takes advantage of when the dynamic linker is a symlink. Instead, it falls back on the same directory as the dynamic linker as a de facto runpath. Empirically, this gives correct results on Gentoo and NixOS. Unfortunately it is still falling short for Debian, which has libc.so.6 in a different directory as the dynamic linker.
2022-09-08stage2: fix building for 32-bit targetsAndrew Kelley
2022-09-08std.zig.system.NativeTargetInfo: detection ignores self exeAndrew Kelley
Before, native glibc and dynamic linker detection attempted to use the executable's own binary if it was dynamically linked to answer both the C ABI question and the dynamic linker question. However, this could be problematic on a system that uses a RUNPATH for the compiler binary, locking it to an older glibc version, while system binaries such as /usr/bin/env use a newer glibc version. The problem is that libc.so.6 glibc version will match that of the system while the dynamic linker will match that of the compiler binary. Executables with these versions mismatching will fail to run. Therefore, this commit changes the logic to be the same regardless of whether the compiler binary is dynamically or statically linked. It inspects `/usr/bin/env` as an ELF file to find the answer to these questions, or if there is a shebang line, then it chases the referenced file recursively. If that does not provide the answer, then the function falls back to defaults. This commit also solves a TODO to remove an Allocator parameter to the detect() function.