aboutsummaryrefslogtreecommitdiff
path: root/src/target.zig
AgeCommit message (Collapse)Author
2024-06-13ZigObject: include all RISCs in `minFunctionAlignment`David Rubin
2024-06-13ZigObject: enforce min function alignement on riscvDavid Rubin
2024-05-22Revert "implement `@expect` builtin (#19658)"Andrew Kelley
This reverts commit a7de02e05216db9a04e438703ddf1b6b12f3fbef. This did not implement the accepted proposal, and I did not sign off on the changes. I would like a chance to review this, please.
2024-05-22implement `@expect` builtin (#19658)David Rubin
* implement `@expect` * add docs * add a second arg for expected bool * fix typo * move `expect` to use BinOp * update to newer langref format
2024-05-20Target: add OpenHarmonyOS ABIVeikka Tuominen
Closes #20009
2024-05-11riscv: back to hello world panicsDavid Rubin
2024-05-11riscv: big rewrite to use latest livenessDavid Rubin
this one is even harder to document then the last large overhaul. TLDR; - split apart Emit.zig into an Emit.zig and a Lower.zig - created seperate files for the encoding, and now adding a new instruction is as simple as just adding it to a couple of switch statements and providing the encoding. - relocs are handled in a more sane maner, and we have a clear defining boundary between lea_symbol and load_symbol now. - a lot of different abstractions for things like the stack, memory, registers, and others. - we're using x86_64's FrameIndex now, which simplifies a lot of the tougher design process. - a lot more that I don't have the energy to document. at this point, just read the commit itself :p
2024-05-11riscv: add a custom panic functionDavid Rubin
this provides a much better indication of when we are having a controlled panic with an error message or when we are actually segfaulting, as before the `trap` as causing a segfault.
2024-05-11riscv: implement `@abs`David Rubin
- add the `abs` MIR instruction - implement `@abs` by shifting to the right by `bits - 1`, and xoring.
2024-05-09handle visionos target OS tag in the compilerJakub Konka
* rename .xros to .visionos as agreed in the tracking issue * add support for VisionOS platform in the MachO linker
2024-05-08LLVM 18 std lib updates and fixesAndrew Kelley
* some manual fixes to generated CPU features code. In the future it would be nice to make the script do those automatically. * add to various target OS switches. Some of the values I was unsure of and added TODO panics, for example in the case of spirv CPU arch.
2024-04-08haiku: default to single threaded to work around tls bugsJacob Young
2024-03-30cbe: rewrite `CType`Jacob Young
Closes #14904
2024-03-23haiku: debitrotJacob Young
2024-02-27move `zig libc` command to be lazily builtAndrew Kelley
part of #19063 This is a prerequisite for doing the same for Resinator.
2024-01-08lift artificial restriction on minimum glibc versionAndrew Kelley
Fixes a regression introduced in c22d1c00a8825f60e7b01b97c6f73cbc21ca8257. See #17769
2024-01-04minor cosmetic fixupsAndrew Kelley
* fix typos and redundancies in docs * use Target.isGnuLibc
2024-01-04src/target: Restrict usable glibc versionsPat Tullmann
At a minimum required glibc is v2.17, as earlier versions do not define some symbols (e.g., getauxval()) used by the Zig standard library. Additionally, glibc only supports some architectures at more recent versions (e.g., riscv64 support came in glibc v2.27). So add a `glibc_min` field to `available_libcs` for architectures with stronger version requirements. Extend the existing `canBuildLibC` function to check the target against the Zig minimum, and the architecture/os minimum. Also filter the list shown by `zig targets`, too: $ zig targets | jq -c '.glibc' ["2.17.0","2.18.0","2.19.0","2.20.0","2.21.0","2.22.0","2.23.0","2.24.0","2.25.0","2.26.0","2.27.0","2.28.0","2.29.0","2.30.0","2.31.0","2.32.0","2.33.0","2.34.0","2.35.0","2.36.0","2.37.0","2.38.0"] Fixes #17034 Fixes #17769
2024-01-01frontend: fix incorrect WebAssembly hasDebugInfo=falseAndrew Kelley
2024-01-01compiler: push entry symbol name resolution into the linkerAndrew Kelley
This is necessary because on COFF, the entry symbol name is not known until the linker has looked at the set of global symbol names to determine which of the four possible main entry points is present.
2024-01-01resolve error tracing logic at module creation timeAndrew Kelley
rather than checking multiple conditions in Sema
2024-01-01fix entry symbol name on mipsAndrew Kelley
2024-01-01frontend: fix stack protector option logicAndrew Kelley
Commit 97e23896a9168132b6d36ca22ae1af10dd53d80d regressed this behavior because it made target_util.supportsStackProtector *correctly* notice which zig backend is being used to generate code, while the logic calling that function *incorrectly assumed* that .zig code is being compiled, when in reality it might be only C code being compiled. This commit adjusts the option resolution logic for stack protector so that it takes into account the zig backend only if there is a zig compilation unit. A separate piece of logic checks whether clang supports stack protector for a given target. closes #18009 closes #18114 closes #18254
2024-01-01move a large chunk of linker logic away from "options"Andrew Kelley
These options are only supposed to be provided to the initialization functions, resolved, and then computed values stored in the appropriate place (base struct or the object-format-specific structs). Many more to go...
2024-01-01WIP: move many global settings to become per-ModuleAndrew Kelley
Much of the logic from Compilation.create() is extracted into Compilation.Config.resolve() which accepts many optional settings and produces concrete settings. This separate step is needed by API users of Compilation so that they can pass the resolved global settings to the Module creation function, which itself needs to resolve per-Module settings. Since the target and other things are no longer global settings, I did not want them stored in link.File (in the `options` field). That options field was already a kludge; those options should be resolved into concrete settings. This commit also starts to work on that, deleting link.Options, moving the fields into Compilation and ObjectFormat-specific structs instead. Some fields were ephemeral and should not have been stored at all, such as symbol_size_hint. The link.File object of Compilation is now a `?*link.File` and `null` when -fno-emit-bin is passed. It is now arena-allocated along with Compilation itself, avoiding some messy cleanup code that was there before. On the command line, it is now possible to configure the standard library itself by using `--mod std` just like any other module. This meant that the CLI needed to create the standard library module rather than having Compilation create it. There are a lot of changes in this commit and it's still not done. I didn't realize how quickly this changeset was going to balloon out of control, and there are still many lines that need to be changed before it even compiles successfully. * introduce std.Build.Cache.HashHelper.oneShot * add error_tracing to std.Build.Module * extract build.zig file generation into src/Builtin.zig * each CSourceFile and RcSourceFile now has a Module owner, which determines some of the C compiler flags.
2024-01-01move is_libcpp_lib_name and is_libc_lib_name to std.TargetAndrew Kelley
2023-11-12elf: lower TLS data into appropriate TLS sectionJakub Konka
2023-11-10move libssp into libcompiler_rtAndrew Kelley
closes #7265
2023-11-06frontend: fix -fsingle-threaded default detection logicAndrew Kelley
The logic in 509be7cf1f10c5d329d2b0524f2af6bfcabd52de assumed that `use_llvm` meant that the LLVM backend would be used, however, use_llvm is false when there are no zig files to compile, which is the case for zig cc. This logic resulted in `-fsingle-threaded` which made libc++ fail to compile for C++ code that includes the threading abstractions (such as LLVM).
2023-10-02Add illumos OS tagStephen Gregoratto
- Adds `illumos` to the `Target.Os.Tag` enum. A new function, `isSolarish` has been added that returns true if the tag is either Solaris or Illumos. This matches the naming convention found in Rust's `libc` crate[1]. - Add the tag wherever `.solaris` is being checked against. - Check for the C pre-processor macro `__illumos__` in CMake to set the proper target tuple. Illumos distros patch their compilers to have this in the "built-in" set (verified with `echo | cc -dM -E -`). Alternatively you could check the output of `uname -o`. Right now, both Solaris and Illumos import from `c/solaris.zig`. In the future it may be worth putting the shared ABI bits in a base file, and mixing that in with specific `c/solaris.zig`/`c/illumos.zig` files. [1]: https://github.com/rust-lang/libc/tree/6e02a329a2a27f6887ea86952f389ca11e06448c/src/unix/solarish
2023-09-25macos: update libc names for darwinMichael Dusan
- dropped incorrect names - added list of names found in the SDKs - ios, tvos and watchos filesystems are case-sensitive
2023-09-25macos: vendored libc: combine headers: part 2Michael Dusan
- update include dirs to use combined dir - use one libSystem.tbd (drop use of libSystem.VERSION.tbd) - update canBuildLibC to check for minimum os version only
2023-09-21compiler: move struct types into InternPool properAndrew Kelley
Structs were previously using `SegmentedList` to be given indexes, but were not actually backed by the InternPool arrays. After this, the only remaining uses of `SegmentedList` in the compiler are `Module.Decl` and `Module.Namespace`. Once those last two are migrated to become backed by InternPool arrays as well, we can introduce state serialization via writing these arrays to disk all at once. Unfortunately there are a lot of source code locations that touch the struct type API, so this commit is still work-in-progress. Once I get it compiling and passing the test suite, I can provide some interesting data points such as how it affected the InternPool memory size and performance comparison against master branch. I also couldn't resist migrating over a bunch of alignment API over to use the log2 Alignment type rather than a mismash of u32 and u64 byte units with 0 meaning something implicitly different and special at every location. Turns out you can do all the math you need directly on the log2 representation of alignments.
2023-08-09change uses of std.builtin.Mode to OptimizeMode (#16745)Zachary Raineri
std.builtin.Mode is deprecated.
2023-08-03frontend: update is_libc_lib_name for mingw-w64 crt filesAndrew Kelley
2023-07-26target: emit unwind tables if the platform supports unwindingkcbanner
2023-07-20compilation: pass omit_frame_pointer through to builtin.zigkcbanner
Renamed dwarf_unwinding -> stack_iterator to better reflect that it's not just DWARF unwinding. Added a test for unwinding with a frame pointer.
2023-07-20debug: fix initialization of the optional fields on StackIteratorkcbanner
dwarf: documentation fixups target: enable unwind tables on macho
2023-06-26default to single-threaded for WebAssemblyLuuk de Gram
When targeting WebAssembly, we default to building a single-threaded build as threads are still experimental. The user however can enable a multi- threaded build by specifying '-fno-single-threaded'. It's a compile-error to enable this flag, but not also enable shared-memory.
2023-06-26Compilation: allow threads for Wasm when shared-memory is enabledLuuk de Gram
When the user enabled the linker-feature 'shared-memory' we do not force a singlethreaded build. The linker already verifies all other CPU features required for threads are enabled. This is true for both WASI and freestanding.
2023-06-17std: replace builtin.Version with SemanticVersionr00ster91
2023-06-10stage2: move function types to InternPoolAndrew Kelley
2023-06-10stage2: start the InternPool transitionAndrew Kelley
Instead of doing everything at once which is a hopelessly large task, this introduces a piecemeal transition that can be done in small increments at a time. This is a minimal changeset that keeps the compiler compiling. It only uses the InternPool for a small set of types. Behavior tests are not passing. Air.Inst.Ref and Zir.Inst.Ref are separated into different enums but compile-time verified to have the same fields in the same order. The large set of changes is mainly to deal with the fact that most Type and Value methods now require a Module to be passed in, so that the InternPool object can be accessed.
2023-04-21cbe: implement 128-bit atomics supportJacob Young
* Disable 128-bit atomics for x86_64 generic (currently also baseline) because they require heavy abi agreement to correctly lower. ** This is a breaking change ** * Enable 128-bit atomics for aarch64 in Sema since it just works.
2023-04-21Do not use -fPIC when compiling a UEFI applicationEric Rowley
2023-04-10glibc: allow linking against external libcrypt.Piotr Sikora
Support for the built-in libcrypt was removed in commit 6b7ddfba, but the -lcrypt flag remained ignored, preventing linking against external libcrypt. Fixes #5990. Signed-off-by: Piotr Sikora <piotr@aviatrix.com>
2023-04-09spirv: cannot build libcRobin Voetter
SPIR-V cannot build libc, ssp, compiler-rt, etc at the time of this commit, so prevent trying to build them.
2023-03-03Merge remote-tracking branch 'origin/master' into llvm16Andrew Kelley
2023-03-03sema: Place functions on AVR in flash addrspaceEckhart Köppen
- Use .flash as the default address space for functions on AVR - Return .flash as the address space for function pointers on AVR without explicit address space
2023-02-27Merge remote-tracking branch 'origin/master' into llvm16Andrew Kelley