aboutsummaryrefslogtreecommitdiff
path: root/src/main.zig
AgeCommit message (Collapse)Author
2024-01-01CLI: fix compilation on WindowsAndrew Kelley
2024-01-01frontend: make dll_export_fns=false on non-windowsAndrew Kelley
Fixes a regression introduced in this branch.
2024-01-01zig build: reintroduce --prominent-compile-errorsAndrew Kelley
This reintroduced flag makes zig build behave the same as the previous commit. Without this flag, the default behavior is now changed to display compilation errors inline with the rest of error messages and the build tree context. This behavior is essential for making sense of error logs from projects that have two or more steps emitting compilation errors which is why it is now the default.
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-01CLI: fix logic for zig test error messageAndrew Kelley
When using the build system to do unit testing, it lowers to --mod arguments which were incorrectly tripping a "zig test requires a source file argument" error.
2024-01-01Compilation.Config.resolve: explicit error setAndrew Kelley
Some logic has comptime-known conditions, causing the inferred error set to be different on different compiler build configurations.
2024-01-01CLI: update main usage textAndrew Kelley
* Organize and reword some stuff * Add missing usage for `zig reduce`
2024-01-01CLI: fix logic for sending output file pathAndrew Kelley
via the compiler protocol
2024-01-01CLI: fix not respecting module remappingsAndrew Kelley
2024-01-01zig build: fix logic for extracting executable file from CompilationAndrew Kelley
2024-01-01zig build: pass resolved_target to Module.createAndrew Kelley
it's now required to pass this for the root module
2024-01-01CLI: rename clang_argv to cc_argvAndrew Kelley
The args apply to Aro as well.
2024-01-01CLI: better error messages for bad argsAndrew Kelley
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-01CLI: mark any_dyn_libs=true when encountering a shared objectAndrew Kelley
2024-01-01fix compilations without zig compilation unitsAndrew Kelley
2024-01-01frontend: fix handling of special builtin moduleAndrew Kelley
it's allocated differently and imported differently
2024-01-01fix --show-builtin when no positional argument is providedAndrew Kelley
2024-01-01fix compilation errors when enabling llvmAndrew 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-01update bin_file.options references in SemaAndrew Kelley
mainly pertaining to error return tracing
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-01compiler: update many references to bin_file.optionsAndrew Kelley
2024-01-01update libunwind references to bin_file.optionsAndrew Kelley
2024-01-01update image_base referencesAndrew 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-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-01resinator: update std.Target.Query usageAndrew Kelley
2024-01-01std.Target.Query: remove deprecated APIAndrew Kelley
These functions have been doomed for a long time. Finally I figured out what the proper relationship between this API and std.Target is.
2024-01-01std.Target: add DynamicLinkerAndrew Kelley
2024-01-01rename std.zig.CrossTarget to std.Target.QueryAndrew 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-01move is_libcpp_lib_name and is_libc_lib_name to std.TargetAndrew Kelley
2023-11-26`zig fetch`: add `--save` flagAndrew Kelley
``` --save Add the fetched package to build.zig.zon --save=[name] Add the fetched package to build.zig.zon as name ```
2023-11-26os: expect ETIMEDOUT, ECONNRESET, ENOTCONN from recvfrom & read familyLauri Tirkkonen
reads on eg. connected TCP sockets can fail with ETIMEDOUT, and ENOTCONN happens eg. if you try to read a TCP socket that has not been connected yet. interestingly read() was already handling CONNRESET & TIMEDOUT, but readv(), pread(), and preadv() were somewhat inconsistent.
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-22Revert "Merge pull request #12060 from Vexu/IterableDir"Andrew Kelley
This reverts commit da94227f783ec3c92859c4713b80a668f1183f96, reversing changes made to 8f943b3d33432a26b7e242c1181e4220ed400501. I was against this change originally, but decided to approve it to keep an open mind. After a year of trying it in practice, I firmly believe that the previous way of doing it was better.
2023-11-20zig init: also create a build.zig.zonAndrew Kelley
2023-11-20merge `zig init-exe` and `zig init-lib` into `zig init`Andrew Kelley
Instead of `zig init-lib` and `zig init-exe`, now there is only `zig init`, which initializes any of the template files that do not already exist, and makes a package that contains both an executable and a static library. The idea is that the user can delete whatever they don't want. In fact, I think even more things should be added to the build.zig template.
2023-11-19compiler: correct unnecessary uses of 'var'mlugg
2023-11-17aro-translate-c: update to upstream changesVeikka Tuominen
2023-11-07Merge pull request #17771 from ehaas/mingw-aroAndrew Kelley
mingw: Use aro instead of clang for preprocessing import libs
2023-11-05Merge pull request #17815 from Luukdegram/wasm-no-entryAndrew Kelley
wasm-linker: implement `-fno-entry` and correctly pass `--shared` and `--pie` when given