aboutsummaryrefslogtreecommitdiff
path: root/src/mingw.zig
AgeCommit message (Collapse)Author
2023-08-03frontend: fix linking to Windows DLLs as system libsAndrew Kelley
2023-07-11remove arbitrary stderr size limit when spawning a child process toolXavier Bouchoux
2023-05-26std.Target adjustmentsVeikka Tuominen
* move `ptrBitWidth` from Arch to Target since it needs to know about the abi * double isn't always 8 bits * AVR uses 1-byte alignment for everything in GCC
2023-03-15compiler: update function accepts a std.Progress.NodeAndrew Kelley
This makes progress be exposed to the top-level caller of update(). I tossed in a bonus change: when the `zig build` subcommand sees exit code 2, it omits the "following command failed" line, and the build runner uses exit code 2 when there are compile errors. This tidies up the output on build failure by a little bit.
2023-03-15progress towards semantic error serializationAndrew Kelley
Introduces std.zig.ErrorBundle which is a trivially serializeable set of compilation errors. This is in the standard library so that both the compiler and the build runner can use it. The idea is they will use it to communicate compilation errors over a binary protocol. The binary encoding of ErrorBundle is a bit problematic - I got a little too aggressive with compaction. I need to change it in a follow-up commit to use some indirection in the error message list, otherwise iteration is too unergonomic. In fact it's so problematic right now that the logic getAllErrorsAlloc() actually fails to produce a viable ErrorBundle because it puts SourceLocation data in between the root level ErrorMessage data. This commit has a simplification - redundant logic for rendering AST errors to stderr has been removed in favor of moving the logic for lowering AST errors into AstGen. So even if we get parse errors, the errors will get lowered into ZIR before being reported. I believe this will be useful when working on --autofix. Either way, some redundant brittle logic was happily deleted. In Compilation, updateSubCompilation() is improved to properly perform error reporting when a sub-compilation object fails. It no longer dumps directly to stderr; instead it populates an ErrorBundle object, which gets added to the parent one during getAllErrorsAlloc(). In package fetching code, instead of dumping directly to stderr, it now populates an ErrorBundle object, and gets properly reported at the CLI layer of abstraction.
2023-02-18update std lib and compiler sources to new for loop syntaxAndrew Kelley
2023-02-13move the cache system from compiler to std libAndrew Kelley
2023-01-31mingw: repair msvcrt-os build flagspraschke
__LIBMSVCRT__ is still used and is distinct from __LIBMSVCRT_OS__
2022-12-28mingw: add missing vscprintf.c fileAndrew Kelley
closes #13733 Thanks to @kcbanner for finding this.
2022-12-10fix aarch64-windows-gnu libcAndrew Kelley
We were missing some math functions. After this enhancement I verified that I was able to cross-compile ninja.exe for aarch64-windows and produce a viable binary.
2022-11-22Cache: introduce prefixes to manifestsAndrew Kelley
Before, cache manifest files would have absolute file paths. This is problematic for two reasons: * Absolute file paths are not portable. Some operating systems such as WASI have trouble with them. The files themselves are less portable; they cannot be migrated from one user's home directory to another's. And finally they can break due to file paths exceeding maximum path component size. * They would prevent some advanced use cases of Zig, where the lib dir has a different path in a different invocation but is ultimately the same Zig version and lib directory as before. This commit adds a new column that specifies the prefix directory for each file. 0 is an escape hatch and has the previous behavior. The other two prefixes introduced are zig lib directory, and the cache directory. This means files in zig-cache manifests can reference files local to these directories. In practice, this means it is possible to use a different file path for the zig lib directory in a subsequent run of zig and have it still take advantage of the global cache, provided that the files inside remain unchanged. closes #13050
2022-11-04all: rename i386 to x86Ali Chraghi
2022-10-11mingw-w64: pass -D__USE_MINGW_ANSI_STDIO=0 for crt filesAndrew Kelley
Thanks to Martin Storsjö for explaining this to me on IRC: __USE_MINGW_ANSI_STDIO redirects stdio functions towards mingw-w64 reimplementations of them (since msvcrt.dll lacks lots of things). For x86 with "long double", this is also needed to get long doubles formatted properly. It's enabled by default by headers when building in C99 mode, unless you're targeting UCRT. The headers normally enable this automatically - or you can request it enabled with -D__USE_MINGW_ANSI_STDIO=1. However, the mingw-w64-crt files are expected to be built with this explicitly turned off. Since there's a half dozen various ways of configuring the CRT and various features, the mingw-w64-crt files specifically need to be built in a very hardcoded configuration, which is different from how end user source files are compiled. This commit removes a patch that we were carrying previously. See #7356
2022-10-11stage2: update mingw-w64 build logic to v10.0.0Andrew Kelley
2022-10-11update mingw-w64 crt files to v10.0.0Andrew Kelley
2022-08-30avoid exposing supportsTailCall in the standard libraryAndrew Kelley
This is problematic because in practice it depends on whether the compiler backend supports it too, as evidenced by the TODO comment about LLVM not supporting some architectures that in fact do support tail calls. Instead this logic is organized strategically in src/target.zig, part of the internal compiler source code, and the behavior tests in question duplicate some logic for deciding whether to proceed with the test. The proper place to expose this flag is in `@import("builtin")` - the generated source file - so that third party compilers can advertise whether they support tail calls.
2022-08-25add ability to pass force undefined symbols to the linkerJakub Konka
This commit enables `-u <symbol>` for ELF and `-include:<symbol>` for COFF linkers for use internally. This means we do not expose these flags to the users just yet, however, we make use of them internally whenever required. One such use case is forcing inclusion of `_tls_index` when linking for Windows with mingw and LTO and dead code stripping enabled. This ensures we add `_tls_index` to the symbol resolver as an undefined symbol and force the linker to include an atom that provides it marking it a dead-code-stripping root - meaning it will not be garbage collected by the linker no matter what.
2022-04-29std: Do not allocate the result for ChildProcess.initJimmi Holst Christensen
Instead, just return ChildProcess directly. This structure does not require a stable address, so we can put it on the stack just fine. If someone wants it on the heap they should do. const proc = try allocator.create(ChildProcess); proc.* = ChildProcess.init(args, allocator);
2022-02-06Avoid depending on child process execution when not supported by host OSCody Tapscott
In accordance with the requesting issue (#10750): - `zig test` skips any tests that it cannot spawn, returning success - `zig run` and `zig build` exit with failure, reporting the command the cannot be run - `zig clang`, `zig ar`, etc. already punt directly to the appropriate clang/lld main(), even before this change - Native `libc` Detection is not supported Additionally, `exec()` and related Builder functions error at run-time, reporting the command that cannot be run
2022-01-07lint: duplicate import (#10519)Meghan
2021-11-30allocgate: renamed getAllocator function to allocatorLee Cannon
2021-11-30allocgate: stage 1 and 2 buildingLee Cannon
2021-11-30allocgate: std Allocator interface refactorLee Cannon
2021-11-15pre-merge cleanupsAndrew Kelley
* Annotate workarounds with their corresponding GitHub issue links. * Enable test coverage for LTO on Windows with the added c_compiler test.
2021-11-15build: workaround link error with LTO and mingwxavier
The symbol "_tls_index" gets lost when using LTO. Disabling LTO on the object file that defines it allows the link to work. fixes https://github.com/ziglang/zig/issues/8531
2021-11-15mingw-w64: add missing file frexp.c to mingwex.libJ.C. Moyer
Fixes a frexp() segfault on Windows.
2021-09-19Update all ensureCapacity calls to the relevant non-deprecated versionRyan Liptak
2021-09-15Added implementation for _fseeki64 and _ftelli64 from mingw-w64 9.0.0 ↵Michal Ziulek
(#9402). (#9766) * Added fseeki64.c from mingw-w64 9.0.0. This file was missing in Zig distribution. This file contains implementation for _fseeki64 and _ftelli64 functions.
2021-09-07changes to build zig-bootstrap aarch64-windowsJonathan Marler
2021-09-07Fix building aarch64-windows-gnu by adding missing libc files and ↵Jonathan Marler
compiler_rt functions (#9555) * fix issue 9519 Added some missing files from mingw * add missing compiler_rt functions * finish PR * add aarch64-windows-gnu to test targets * add more compiler_rt * add log2 * add pow * add modti3
2021-08-21mingw.zig: fix logic to add crt sourcesJonathan Marler
The current version of code uses isARM to check if we are compiling to any arm target then checks the target bit width to either add the 32-bit sources or 64-bit source. However, isARM only returns true for 32-bit targets, and isAARCH64 is for the 64-bit targets. I also replaced the unreachable with a @panic when we receive an unsupported arch because this code is reachable and should turn into an error.
2021-06-21std, src, doc, test: remove unused variablesJacob G-W
2021-01-22stage2: add missing frexpl.c to mingw c source file listAndrew Kelley
2021-01-06stage2: rename and move files related to LLVM backendTimon Kruiper
2021-01-02stage2: Use {s} instead of {} when formatting stringsLemonBoy
2020-12-28stage2: rename llvm.zig to llvm_bindings.zigTimon Kruiper
Putting functions in this file will create functions like `llvm.function`, and the compiler thinks these are llvm intrinsics.
2020-12-24stage2: re-use compiler runtime libs across opt modes and strip flagAndrew Kelley
Previously Zig would need to recompile runtime libs if you changed the values of --strip or -O. Now, unless the `debug_compiler_runtime_libs` flag is set (which is currently not exposed to the CLI), Zig will always choose ReleaseFast or ReleaseSmall for compiler runtime libraries. When the main application chooses ReleaseFast or ReleaseSmall, that value is propagated to compiler runtime libraries. Otherwise a decision is made based on the target, which is currently ReleaseSmall for freestanding WebAssembly and ReleaseFast for everything else. Ultimately the purpose of this commit is to have Debug and ReleaseSafe builds of applications still get optimized builds of, e.g. libcxx and libunwind, as well as to spend less time unnecessarily rebuilding compiler runtime libraries.
2020-11-05Fixed mingw-w64 8.0.0 compilationAlexandros Naskos
Reaplied mingw-w64 header patch
2020-11-05Updated mingw-w64 to version 8.0.0Alexandros Naskos
2020-10-01stage2: Add missing defines for building dllcrt2.oLemonBoy
Closes #6482
2020-09-29mingw: better -D arg for processing def.in filesAndrew Kelley
Thanks @LemonBoy
2020-09-28stage2: building DLL import lib filesAndrew Kelley
2020-09-28stage2: building mingw-w64 and COFF LDD linkingAndrew Kelley
still TODO is the task of creating import .lib files for DLLs on the fly both for -lfoo and for e.g. `extern "kernel32"`