aboutsummaryrefslogtreecommitdiff
path: root/src/Compilation.zig
AgeCommit message (Collapse)Author
2024-01-09Merge pull request #18491 from ziglang/fix-mod-link-obj-pathAndrew Kelley
std.Build.Step.Compile: fix link object paths
2024-01-08compilation: fix bad path in error messageAndrew Kelley
2024-01-08Compilation: only add __MSVCRT_VERSION__ for -lcAndrew Kelley
prevents it from being defined twice when building mingw-w64 libs.
2024-01-08Compilation: add definition to prefer ucrt for windows C/C++ filesAndrew Kelley
This makes C/C++ files when targeting mingw-w64 choose to depend on ucrt for stdio.
2024-01-08mingw: update from msvcrt to ucrtAndrew Kelley
2024-01-06Compilation: pass code model in buildOutputFromZigTristan Ross
2024-01-03compiler: fix build runner not added to cache hashAndrew Kelley
Closes #18438
2024-01-01link: accept the update arena in flushAndrew Kelley
This branch introduced an arena allocator for temporary allocations in Compilation.update. Almost every implementation of flush() inside the linker code was already creating a local arena that had the lifetime of the function call. This commit passes the update arena so that all those local ones can be deleted, resulting in slightly more efficient memory usage with every compilation update. While at it, this commit also removes the Compilation parameter from the linker flush function API since a reference to the Compilation is now already stored in `link.File`.
2024-01-01CLI: introduce global -I args for C include pathsAndrew Kelley
This isn't technically needed since per-module -I args can suffice, but this can produce very long CLI invocations when several --mod args are combined with --search-prefix args since the -I args have to be repeated for each module. This is a partial revert of ecbe8bbf2df2ed4d473efbc32e0b6d7091fba76f.
2024-01-01Compilation: rename before flush during whole cache modeAndrew Kelley
The linker needs to know the file system path of output in the flush function because file paths inside the build artifacts reference each other. Fixes a regression introduced in this branch.
2024-01-01Compilation: fix cache hash of incremental buildsAndrew Kelley
Without this commit, unrelated test builds using incremental cache mode (self-hosted, no lld) would end up using the same cache namespace, which is undesireable since concurrent builds will clobber each other's work. This happened because of passing the root module to addModuleToCacheHash. In the case of a test build, the root module actually does not connect to the rest of the import table. Instead, the main module needs to be passed, which has "root" in its import table. The other call to addModuleTableToCacheHash which is in addNonIncrementalStuffToCacheManifest already correctly passes the main module. In the future, I think this problem can be fully addressed by obtaining an advisory lock on the output binary file. However, even in that case, it is still valuable to make different compilations use different cache namespaces lest unrelated compilations suffer from pointless thrashing rather than being independently edited.
2024-01-01Compilation: make create() take an arena allocatorAndrew Kelley
Instead of making its own inside create. 10 out of 10 calls to create() had already an arena in scope, so this commit means that 10 instances of Compilation now reuse an existing arena with the same lifetime rather than creating a redundant one. In other words, this very slightly optimizes initialization of the frontend in terms of memory allocation.
2024-01-01restore -fno-emit-bin -femit-llvm-ir functionalityAndrew Kelley
Now, link.File will always be null when -fno-emit-bin is specified, and in the case that LLVM artifacts are still required, the Zcu instance has an LlvmObject.
2024-01-01Compilation: don't add importlib jobs when outputting C codeAndrew Kelley
Fixes "building import libs not included in core functionality" when bootstrapping on Windows.
2024-01-01move misc_errors from linker to CompilationAndrew Kelley
So that they can be referenced by getAllErrorsAlloc(). Fixes missing compile errors.
2024-01-01Compilation: inline the flush functionAndrew Kelley
There is only one call to this function and this made it easier to troubleshoot the logic.
2024-01-01Compilation: fix whole mode cache hashAndrew Kelley
before this commit it was trying to hash based on resolved bin_file settings, but bin_file was always null since cache mode is always whole when this function is called! hash based on the lf_open_opts instead.
2024-01-01Compilation: consolidate module hashing codeAndrew Kelley
2024-01-01move eh_frame_hdr from link.File to CompilationAndrew Kelley
since it's accessed by Compilation. fixes an invalid check of bin_file==null
2024-01-01move force_undefined_symbols into CompilationAndrew Kelley
This field is needed by Compilation regardless of whether a link file is instantiated. Fixes an invalid check for bin_file=null.
2024-01-01Compilation: several branch regression fixesAndrew Kelley
* move wasi_emulated_libs into Compilation - It needs to be accessed from Compilation, which needs to potentially build those artifacts. * Compilation: improve error reporting for two cases - the setMiscFailure mechanism is handy - let's use it! * fix one instance of incorrectly checking for emit_bin via `comp.bin_file != null`. There are more instances of this that need to be fixed in a future commit. * fix renameTmpIntoCache not handling the case where it needs to make the "o" directory in the zig-cache directory. - while I'm at it, simplify the logic for handling the fact that Windows returns error.AccessDenied rather than error.PathAlreadyExists for failure to rename a directory over another one. * fix missing cache hash additions - there are still more to add in a future commit - addNonIncrementalStuffToCacheManifest is called when bin_file is always null, and then it incorrectly checks if bin_file is non-null and only then adds a bunch of stuff to the cache hash. It needs to instead add to the cache hash based on lf_open_opts.
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-01frontend: remove deprecated field from CompilationAndrew Kelley
2024-01-01frontend: fix "any" default resolution ambiguityAndrew Kelley
In Compilation.create, update the resolved config to account for the default resolution of the root module. This makes it so that, for example, reading comp.config.any_non_single_threaded is valid in order to determine whether any module has single_threaded=false.
2024-01-01frontend: skip astgen for builtin.zigAndrew Kelley
since it's already done ahead of time and always unchanging
2024-01-01CLI: fix logic for sending output file pathAndrew Kelley
via the compiler protocol
2024-01-01CLI: fix regressed logic for any_dyn_libsAndrew Kelley
This value needs access to the fully resolved set of system libraries, which required restructuring a bunch of CLI logic.
2024-01-01fix compilations without zig compilation unitsAndrew Kelley
2024-01-01fix memory leak in addModuleTableToCacheHashAndrew Kelley
2024-01-01Compilation: don't store arena until it's done being usedAndrew Kelley
2024-01-01fix compilation errors when enabling llvmAndrew Kelley
2024-01-01compilation: fix build artifact communication from sub-compilationAndrew Kelley
in whole cache mode, build artifacts are communicated by accessing the whole cache information, for which there is a helper method called toCrtFile
2024-01-01fix population of builtin.zig not making the parent dirAndrew Kelley
2024-01-01Compilation: oops! used comp before initAndrew Kelley
2024-01-01fix remaining compile errors except oneAndrew Kelley
2024-01-01fix more compilation errors introduced by this branchAndrew Kelley
2024-01-01move dll_export_fns and rdynamic to Compilation.ConfigAndrew Kelley
2024-01-01glibc: update to new Compilation APIAndrew Kelley
2024-01-01musl: update references to bin_file.optionsAndrew Kelley
2024-01-01fix a round of compile errors caused by this branchAndrew Kelley
2024-01-01compiler: miscellaneous branch progressAndrew Kelley
implement builtin.zig file population for all modules rather than assuming there is only one global builtin.zig module. move some fields from link.File to Compilation move some fields from Module to Compilation compute debug_format in global Compilation config resolution wire up C compilation to the concept of owner modules make whole cache mode call link.File.createEmpty() instead of link.File.open()
2024-01-01Compilation: redo whole vs incremental logic in create and updateAndrew Kelley
2024-01-01compiler: update many references to bin_file.optionsAndrew Kelley
2024-01-01compiler: update references to targetAndrew Kelley
2024-01-01update libunwind references to bin_file.optionsAndrew Kelley
2024-01-01update references to module (to be renamed to zcu)Andrew Kelley
2024-01-01remove parent_compilation_link_libcAndrew Kelley
2024-01-01linkers: update references to "options" fieldAndrew Kelley
2024-01-01update image_base referencesAndrew Kelley
2024-01-01compiler: update references to single_threadedAndrew Kelley