aboutsummaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)Author
2024-10-23branch fixesAndrew Kelley
2024-10-23move linker input file parsing to the compilation pipelineAndrew Kelley
2024-10-23link.Elf: untangle parseObject and parseArchiveAndrew Kelley
from link.Elf, so that they can be used earlier in the pipeline
2024-10-23refactor Compilation.crtFilePathAndrew Kelley
2024-10-23fix windows buildAndrew Kelley
2024-10-23link.Elf: refactor output mode checkingAndrew Kelley
2024-10-23link.MachO: fix missing input classificationAndrew Kelley
2024-10-23CLI: dylibs provided by path act as inferred root moduleAndrew Kelley
2024-10-23fix MachO linking regressionAndrew Kelley
2024-10-23fix resolving link inputsAndrew Kelley
2024-10-23CLI: fix detection of link inputsAndrew Kelley
2024-10-23link.Elf: fix double free of header in parseDsoAndrew Kelley
2024-10-23rework linker inputsAndrew Kelley
* Compilation.objects changes to Compilation.link_inputs which stores objects, archives, windows resources, shared objects, and strings intended to be put directly into the dynamic section. Order is now preserved between all of these kinds of linker inputs. If it is determined the order does not matter for a particular kind of linker input, that item should be moved to a different array. * rename system_libs to windows_libs * untangle library lookup from CLI types * when doing library lookup, instead of using access syscalls, go ahead and open the files and keep the handles around for passing to the cache system and the linker. * during library lookup and cache file hashing, use positioned reads to avoid affecting the file seek position. * library directories are opened in the CLI and converted to Directory objects, warnings emitted for those that cannot be opened.
2024-10-23introduce a CLI flag to enable .so scripts; default offAndrew Kelley
The compiler defaults this value to off so that users whose system shared libraries are all ELF files don't have to pay the cost of checking every file to find out if it is a text file instead. When a GNU ld script is encountered, the error message instructs users about the CLI flag that will immediately solve their problem.
2024-10-23move ld script processing to the frontendAndrew Kelley
along with the relevant logic, making the libraries within subject to the same search criteria as all the other libraries. this unfortunately means doing file system access on all .so files when targeting ELF to determine if they are linker scripts, however, I have a plan to address this.
2024-10-23move link.Elf.LdScript to link.LdScriptAndrew Kelley
2024-10-23link.Elf.LdScript: eliminate dependency on Elf.FileAndrew Kelley
this allows it to be used by the frontend
2024-10-23Merge pull request #21779 from ziglang/avoid-data-racesAndrew Kelley
link.MachO: remove buggy multi-threading
2024-10-23Merge pull request #21758 from kcbanner/dll_storage_classAndrew Kelley
Add `is_dll_import` to @extern, to support `__declspec(dllimport)` with the MSVC ABI
2024-10-23link.MachO: remove buggy multi-threadingAndrew Kelley
thread-sanitizer reports data races here when running test-link. I tried only removing the ones that triggered races, but after 10 back and forths with the compiler and tsan, I got impatient and removed all of them. next time, let's be sure the test suite runs tsan-clean before merging any changes that add parallelism. after this commit, `zig build test-link` completes without any tsan warnings. closes #21778
2024-10-23Merge pull request #21697 from mlugg/callconvMatthew Lugg
Replace `std.builtin.CallingConvention` with a tagged union, eliminating `@setAlignStack`
2024-10-22tests: add tests for is_dll_import externskcbanner
- tests/standalone/extern wasn't running its test step - add compile error tests for thread local / dll import @extern in a comptime scope
2024-10-22Change `ExternOptions.dll_storage_class` to `is_dll_import`kcbanner
It wouldn't make sense to have passe `.export` here, and that was in fact a compile error - so simply make this a bool instead.
2024-10-22Cause a compilation error to occur if using @extern with is_dll_import in a ↵kcbanner
comptime scope. Add a note about thread local / dll import being the cause.
2024-10-22Add support for specifying `dll_storage_class` in @externkcbanner
2024-10-21coff: fix incorrect default `image_base` values and re-enable shared library ↵kcbanner
tests on Windows This was the cause of aarch64-windows shared libraries causing "bad image" errors during load-time linking. I also re-enabled the tests that were surfacing this bug.
2024-10-20llvm: Add some missing fnptr alignment specifications in DataLayoutBuilder.Alex Rønne Petersen
2024-10-20link.Dwarf: Fix function alignment calculation to match the rest of the linker.Alex Rønne Petersen
In particular, for user-specified alignment values, we need to do max(user_align, minFunctionAlignment()) to respect the ABI minimum.
2024-10-20link: Use defaultFunctionAlignment() when function alignment is unspecified.Alex Rønne Petersen
max(user_align, minFunctionAlignment()) is only appropriate when the user has actually given an explicit, non-zero alignment value.
2024-10-20compiler: Remove uses of defaultFunctionAlignment() in the frontend.Alex Rønne Petersen
minFunctionAlignment() is something we can know ahead of time for any given target because it's a matter of ABI. However, defaultFunctionAlignment() is a matter of optimization and every backend can do it differently depending on any number of factors. For example, LLVM will base the choice on the CPU model in its aarch64 backend. So just don't use this value in the frontend.
2024-10-20compiler: Update defaultFunctionAlignment()/minFunctionAlignment() for more ↵Alex Rønne Petersen
targets. defaultFunctionAlignment() can be made more sophisticated over time based on the CPU model and/or features. For now, I've picked some reasonable values for the CPUs that are most commonly used in practice. (Values are sourced from LLVM.)
2024-10-20compiler: Disallow function alignment for nvptx and spirv.Alex Rønne Petersen
2024-10-19Sema: add and improve some callconv compile errorsmlugg
2024-10-19x86_64: handle incoming stack alignmentmlugg
2024-10-19x86_64,riscv64: fix incorrect `incoming_stack_alignment` handlingmlugg
The whole motivation behind this proposal in the first place was that the LLVM backend disagrees with the self-hosted backends on what `@setAlignStack` meant, so we can't just translate the old logic to the new system! These backends can introduce support for overriding `incoming_stack_alignment` later on.
2024-10-19llvm: fix lowering `arm_aapcs_vfp` functionsmlugg
2024-10-19Zcu: correct `callconvSupported` for self-hosted aarch64mlugg
2024-10-19llvn: fix incorrect mips64 callconv handlingmlugg
2024-10-19link.Dwarf: handle `avr_signal` and `avr_builtin` callconvsmlugg
2024-10-19llvm: fix lowering of avr_interrupt and m68k_interrupt callconvsmlugg
2024-10-19compiler: avoid unreasonable eval branch quotasmlugg
Using `@FieldType` (#21702).
2024-10-19Sema: minor cleanupmlugg
2024-10-19cbe,translate-c: support more callconvsmlugg
There are several more that we could support here, but I didn't feel like going down the rabbit-hole of figuring them out. In particular, some of the Clang enum fields aren't specific enough for us, so we'll have to switch on the target to figure out how to translate-c them. That can be a future enhancement.
2024-10-19link: add clarifying commentmlugg
2024-10-19std.Target: rename `defaultCCallingConvention` and `Cpu.Arch.fromCallconv`mlugg
2024-10-19test: update for `CallingConvention` changesmlugg
This also includes some compiler and std changes to correct error messages which weren't properly updated before.
2024-10-19compiler: remove @setAlignStackmlugg
This commit finishes implementing #21209 by removing the `@setAlignStack` builtin in favour of `CallingConvention` payloads. The x86_64 backend is updated to use the stack alignment given in the calling convention (the LLVM backend was already updated in a previous commit). Resolves: #21209
2024-10-19std: update for new `CallingConvention`mlugg
The old `CallingConvention` type is replaced with the new `NewCallingConvention`. References to `NewCallingConvention` in the compiler are updated accordingly. In addition, a few parts of the standard library are updated to use the new type correctly.
2024-10-19compiler: introduce new `CallingConvention`mlugg
This commit begins implementing accepted proposal #21209 by making `std.builtin.CallingConvention` a tagged union. The stage1 dance here is a little convoluted. This commit introduces the new type as `NewCallingConvention`, keeping the old `CallingConvention` around. The compiler uses `std.builtin.NewCallingConvention` exclusively, but when fetching the type from `std` when running the compiler (e.g. with `getBuiltinType`), the name `CallingConvention` is used. This allows a prior build of Zig to be used to build this commit. The next commit will update `zig1.wasm`, and then the compiler and standard library can be updated to completely replace `CallingConvention` with `NewCallingConvention`. The second half of #21209 is to remove `@setAlignStack`, which will be implemented in another commit after updating `zig1.wasm`.
2024-10-17Merge pull request #21610 from alexrp/riscv-abisAndrew Kelley
Fix some RISC-V ABI issues and add ILP32/LP64 (soft float) to module tests