aboutsummaryrefslogtreecommitdiff
path: root/src/Compilation.zig
AgeCommit message (Collapse)Author
2023-04-28update codebase to use `@memset` and `@memcpy`Andrew Kelley
2023-04-25cbe: fix mutability issues with builtin test_functionsJacob Young
2023-04-21Merge pull request #15355 from mlugg/feat/liveness-control-flowAndrew Kelley
Liveness: control flow analysis and other goodies
2023-04-20fixes to the previous commitAndrew Kelley
* CompileStep: Avoid calling producesPdbFile() to determine whether the option should be respected. If the user asks for it, put it on the command line and let the Zig CLI deal with it appropriately. * Make the namespace of `std.dwarf.Format.dwarf32` no longer have a redundant "dwarf" in it. * Add `zig cc` integration for `-gdwarf32` and `-gdwarf64`. * Toss in a bonus bug fix for `-gdwarf-2`, `-gdwarf-3`, etc. * Avoid using default init values for struct fields unnecessarily. * Add missing cache hash addition for the new option.
2023-04-20Expose an option for producing 64-bit DWARF formatDavid Gonzalez Martin
This commit enables producing 64-bit DWARF format for Zig executables that are produced through the LLVM backend. This is achieved by exposing both command-line flags and CompileStep flags. The production of the 64-bit format only affects binaries that use the DWARF format and it is disabled on MacOS due to it being problematic. This commit, despite generating the interface for the Zig user to be able to tell the compile which format is wanted, is just implemented for the LLVM backend, so clang and the self-hosted backends will need this to be implemented in a future commit. This is an effort to work around #7962, since the emission of the 64-bit format automatically produces 64-bit relocations. Further investigation will be needed to make DWARF 32-bit format to emit bigger relocations when needed and not make the linker angry.
2023-04-20Liveness: add a liveness verification passJacob Young
This code only runs in a debug zig compiler, similar to verifying llvm modules.
2023-04-18compilation: fix generating coff debug info on -gnukcbanner
The issue with just passing `-gcodeview` is that it's not part of the `OPT_g_Group` in `clang/Driver/Options.td`, so it doesn't trigger debug info to be generated. Passing only `-g` is sufficient on MSVC, as there is logic in `Clang.cpp` which enables codeview if that is the default for the toolchain. Since the default for -gnu is not codeview, we do pass `-gcodeview` in that case.
2023-04-18Assembly file add soft float option for mips (#15340)hequn
2023-04-17compilation: fix non-zig compilations not using CacheMode.wholekcbanner
main: consume --debug-log argument even when logging is disabled
2023-04-12Autodoc usingnamespace (#15216)Loris Cro
* autodoc: init support for usingnamespace decls * autodoc: don't build autodoc when building zig2.c * autodoc: usingnamespace decls support in frontend (#15203) * autodoc: init support for usingnamespace decls * autodoc: usingnamespace decls support in frontend --------- Co-authored-by: Krzysztof Wolicki <46651553+der-teufel-programming@users.noreply.github.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-04-09dont destroy old bin file on link openpath failureRobin Voetter
This was causing some crashes.
2023-04-07zig cc: complete the -wrap flag implementationAndrew Kelley
* use a set instead of a list * use of this flag currently requires LLD * add documentation * make it only a zig cc compatibility flag for now because I personally think this is an anti-feature.
2023-04-07add linker -wrap flagZach Cheung
2023-04-05Merge remote-tracking branch 'origin/master' into llvm16Andrew Kelley
2023-04-01link: handle -u flag in all linkersJakub Konka
Also clean up parsing of linker args - reuse `ArgsIterator`. In MachO, ensure we add every symbol marked with `-u` as undefined before proceeding with symbol resolution. Additionally, ensure those symbols are never garbage collected. MachO entry_in_dylib test: pass `-u _my_main` when linking executable so that it is not incorrectly garbage collected by the linker.
2023-03-25compilation: fixup linker_dynamicbase default in InitOptionskcbanner
2023-03-17Merge remote-tracking branch 'origin/master' into llvm16Andrew Kelley
2023-03-17main: add debug option to dump unoptimized llvm irJacob Young
2023-03-16Merge remote-tracking branch 'origin/master' into llvm16Andrew Kelley
2023-03-15add compile log output to build runnerAndrew Kelley
2023-03-15fix ZIR decoding of error notesAndrew Kelley
2023-03-15std.Build.RunStep: add maxrss, duration, and cached statusAndrew Kelley
2023-03-15stage2: avoid linux-only APIs on other operating systemsAndrew Kelley
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-15add builtin.zig_version_stringAndrew Kelley
sometimes this is more useful than SemanticVersion
2023-03-15std.zig.ErrorBundle: rework binary encodingAndrew Kelley
* Separate into a "WIP" struct and a "finished" struct. * Use a bit of indirection for error notes to simplify ergonomics of this data structure.
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-03-15stage2: hot code swapping PoCAndrew Kelley
* CLI supports --listen to accept commands on a socket * make it able to produce an updated executable while it is running
2023-03-15extract ThreadPool and WaitGroup from compiler to std libAndrew Kelley
2023-02-27Merge remote-tracking branch 'origin/master' into llvm16Andrew Kelley
2023-02-22Merge pull request #14691 from jacobly0/ctypeAndrew Kelley
2023-02-21CBE: use CType for type definitionsJacob Young
2023-02-21CBE: remove typedef data structuresJacob Young
Adds a new mechanism for `@tagName` function generation that doesn't piggyback on the removed typedef system.
2023-02-20CBE: add CType interningJacob Young
2023-02-21Improve multi-module error messagesmlugg
- Fix assertion failure if AstGen failed on a multi-module file - Cap number of per-error reference notes and total multi-module errors each at 5 - Always put "root of package" reference notes first Resolves: #14499
2023-02-21Implement new module CLImlugg
2023-02-19Merge remote-tracking branch 'origin/master' into llvm16Andrew Kelley
2023-02-18update std lib and compiler sources to new for loop syntaxAndrew Kelley
2023-02-18Merge remote-tracking branch 'origin/master' into llvm16Andrew Kelley
2023-02-18unconditionally pass --no-default-config to clangAndrew Kelley
As of Clang 16.x, it will by default read extra flags from /etc/clang. I'm sure the person who implemented this means well, but they have a lot to learn about abstractions and where the appropriate boundaries between them are. The road to hell is paved with good intentions. Fortunately it can be disabled.
2023-02-16[elf linker] add --sort-sectionMotiejus Jakštys
Tested by: created a "hello world" C file and compiled with: zig cc -v main.c -Wl,--sort-section=name -o main ... and verified the `--sort-section=name` is passed to ld.lld. Refs https://github.com/zigchroot/zig-chroot/issues/1
2023-02-14comp: reinstate -fcompiler-rt when used with build-obj as outputJakub Konka
When the following is specified ``` $ zig build-obj -fcompiler-rt example.zig ``` the resulting relocatable object file will have the compiler-rt unconditionally embedded inside. ``` $ nm example.o ... 0000000012345678 W __truncsfhf2 ... ```
2023-02-13Merge pull request #14571 from ziglang/more-build-zigAndrew Kelley
std.Build.ConfigHeaderStep: support sentinel-terminated strings
2023-02-13Add -ferror-tracing and -fno-error-tracing compile optionsAdamGoertz
2023-02-13move the cache system from compiler to std libAndrew Kelley
2023-02-08clone package table into custom test runnerDominic
Co-authored-by: Veikka Tuominen <git@vexu.eu>
2023-02-08allow custom test runners to import modulesdweiller
2023-02-08fix custom test runner package path resolutiondweiller
Fixes #13970. This fix makes test runners resolve package paths relative to the directory the test runner is in. This means it is not possible to import a file from outside the file tree root at the directory containing the test runner.
2023-02-03use build.zig.zon instead of build.zig.ini for the manifest fileAndrew Kelley
* improve error message when build manifest file is missing * update std.zig.Ast to support ZON * Compilation.AllErrors.Message: make the notes field a const slice * move build manifest parsing logic into src/Manifest.zig and add more checks, and make the checks integrate into the standard error reporting code so that reported errors look sexy closes #14290