aboutsummaryrefslogtreecommitdiff
path: root/src/Compilation.zig
AgeCommit message (Collapse)Author
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
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-01compiler: get the dynamic linker from the targetAndrew Kelley
instead of passing it to Compilation separately and storing it separately in the linker options.
2024-01-01std.Target: add DynamicLinkerAndrew Kelley
2024-01-01zig build system: change target, compilation, and module APIsAndrew Kelley
Introduce the concept of "target query" and "resolved target". A target query is what the user specifies, with some things left to default. A resolved target has the default things discovered and populated. In the future, std.zig.CrossTarget will be rename to std.Target.Query. Introduces `std.Build.resolveTargetQuery` to get from one to the other. The concept of `main_mod_path` is gone, no longer supported. You have to put the root source file at the module root now. * remove deprecated API * update build.zig for the breaking API changes in this branch * move std.Build.Step.Compile.BuildId to std.zig.BuildId * add more options to std.Build.ExecutableOptions, std.Build.ObjectOptions, std.Build.SharedLibraryOptions, std.Build.StaticLibraryOptions, and std.Build.TestOptions. * remove `std.Build.constructCMacro`. There is no use for this API. * deprecate `std.Build.Step.Compile.defineCMacro`. Instead, `std.Build.Module.addCMacro` is provided. - remove `std.Build.Step.Compile.defineCMacroRaw`. * deprecate `std.Build.Step.Compile.linkFrameworkNeeded` - use `std.Build.Module.linkFramework` * deprecate `std.Build.Step.Compile.linkFrameworkWeak` - use `std.Build.Module.linkFramework` * move more logic into `std.Build.Module` * allow `target` and `optimize` to be `null` when creating a Module. Along with other fields, those unspecified options will be inherited from parent `Module` when inserted into an import table. * the `target` field of `addExecutable` is now required. pass `b.host` to get the host target.
2024-01-01Compilation: cleanup hashmap usageJacob Young
2023-12-13Compilation: remove parent_compilation_link_libcAndrew Kelley
This option is not needed since the link_libc flag can be set directly when creating compiler_rt. This fixes a problem where an immutable flag was being mutated in Sema.
2023-11-26move Module.Decl.Index and Module.Namespace.Index to InternPoolMeghan Denny
2023-11-26Merge pull request #18105 from Vexu/translate-cAndrew Kelley
Use Aro's tokenizer in `translate-c`
2023-11-25translate-c: use Aro's tokenizerVeikka Tuominen
2023-11-24spirv: add -fstructured-cfg optionRobin Voetter
This enables the compiler to generate a structured cfg even in opencl, even if it is not strictly required by the SPIR-V Kernel specification.
2023-11-19compiler: correct unnecessary uses of 'var'mlugg
2023-11-13compilation: forbid PIE for dynamic librariesMichael Dusan
but allow for { .exe, .o, .a }. closes #17928
2023-11-12rework memory management of Module.Namespace hash mapsAndrew Kelley
The motivating problem here was a memory leak in the hash maps of Module.Namespace. The commit deletes more of the legacy incremental compilation implementation. It had things like use of orderedRemove and trying to do too much OOP-style creation and deletion of objects. Instead, this commit iterates over all the namespaces on Module deinit and calls deinit on the hash map fields. This logic is much simpler to reason about. Similarly, change global inline assembly to an array hash map since iterating over the values is a primary use of it, and clean up the remaining values on Module deinit, solving another memory leak. After this there are no more memory leaks remaining when using the x86 backend in a libc-less compiler.
2023-11-10move libssp into libcompiler_rtAndrew Kelley
closes #7265
2023-11-10Compilation: fix logic regarding needs_c_symbolsAndrew Kelley
2023-11-09Compilation: forward clang diagnostics to error bundlesJacob Young
2023-11-07Merge pull request #17771 from ehaas/mingw-aroAndrew Kelley
mingw: Use aro instead of clang for preprocessing import libs
2023-11-07Merge pull request #17873 from ziglang/elf-archiveJakub Konka
elf: implement archiving input object files
2023-11-06Compilation: unconditionally close open file handles for writable danceJakub Konka
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-11-04Merge pull request #17844 from ziglang/elf-objectJakub Konka
elf: handle emitting relocatables and static libraries - humble beginnings
2023-11-04Compilation: take into account if LLVM is available in lib-building logicJakub Konka