aboutsummaryrefslogtreecommitdiff
path: root/src/main.zig
AgeCommit message (Collapse)Author
2023-11-04Merge pull request #17852 from ziglang/zig-reduceAndrew Kelley
introduce `zig reduce` subcommand
2023-11-04print_zir: fix more crashes during printingJacob Young
2023-11-03fix bootstrapAndrew Kelley
2023-11-03fix compilation regressionAndrew Kelley
2023-11-03add zig reduce subcommandAndrew Kelley
Also adds `-Donly-reduce` flag in build.zig which disables LLVM and irrelevant code for faster iteration cycles.
2023-11-03comp: remove CBE guards for aroEvan Haas
2023-11-03cli: consolidate entry point flagsLuuk de Gram
2023-11-03wasm-linker: correctly pass --shared and --pieLuuk de Gram
When linking a WebAssembly binary using wasm-ld, we will now correctly pass --shared when building a dynamic library and --pie when `-fpic` is given. This is a breaking change and users who currently build dynamic libraries for WebAssembly but wish to have an executable without a main, should use build-exe instead while supplying `-fno-entry`. We also verify the user does not supply --export-memory when -dynamic is enabled. By default we set this flag now to 'false' when `-dynamic` is used to ensure we do not enable it as it's enabled by default for regular WebAssembly binaries.
2023-11-03wasm-linker: implement `-fno-entry` flagLuuk de Gram
This adds support for the `-fno-entry` and `-fentry` flags respectively, for zig build-{exe/lib} and the build system. For `zig cc` we use the `--no-entry` flag to be compatible with clang and existing tooling. In `start.zig` we now make the main function optional when the target is WebAssembly, as to allow for the build-exe command in combination with `-fno-entry`. When the execution model is set, and is set to 'reactor', we now verify when an entry name is given it matches what is expected. When no entry point is given, we set it to `_initialize` by default. This means the user will also be met with an error when they use the reactor model, but did not provide the correct function.
2023-10-28frontend: make Decl.zir_decl_index typedAndrew Kelley
This field had the wrong type. It's not a `Zir.Inst.Index`, it's actually a `Zir.OptionalExtraIndex`. Also, the former is currently aliased to `u32` while the latter is a nonexhaustive enum that gives us more type checking. This commit is preparation for making this field non-optional. Now it can be changed to `Zir.ExtraIndex` and then the compiler will point out all the places that the non-optional assumption is being violated.
2023-10-26main: enable debug modes in build scriptsJacob Young
2023-10-23delete dead codeAndrew Kelley
2023-10-23Merge pull request #17651 from Vexu/error-limitAndrew Kelley
Make distinct error limit configurable (attempt #2)
2023-10-22Merge pull request #17407 from truemedian/http-ngAndrew Kelley
std.http: more proxy support, buffer writes, tls toggle
2023-10-22child_process + Build: rename exec to run + all related codeJan Philipp Hafer
Justification: exec, execv etc are unix concepts and portable version should be called differently. Do no touch non-Zig code. Adjust error names as well, if associated. Closes #5853.
2023-10-21std.http: use loadDefaultProxies in compilerNameless
2023-10-21make distinct error limit configurableVeikka Tuominen
Closes #786
2023-10-20Revert "make distinct error limit configurable"Andrew Kelley
This reverts commit 78855bd21866b515018259a2194e036e4b3120df. This commit did not replace uses of `Type.err_int` of which there are currently 60 uses. Re-opens #786
2023-10-19build system: fixups to --seed mechanismAndrew Kelley
* support 0x prefixed hex code for CLI seed arguments * don't change the build summary; the printed CLI on build runner failure is sufficient * use `std.crypto.random` instead of system time for entropy
2023-10-19std.Build: add --seed argument to randomize step dependencies spawningSahnvour
help detect possibly hidden dependencies on the running order of steps, especially in -j1 mode
2023-10-18Merge pull request #14428 from perillo/improve-zig-envAndrew Kelley
zig env: add support for line based output
2023-10-18Merge pull request #17524 from Vexu/aro-translate-cAndrew Kelley
Add ability to test Aro based `translate-c`
2023-10-17rework zig envAndrew Kelley
Introduce introspect.EnvVar which tracks all the environment variables that are observed by the compiler, so that we can print them with `zig env`. The `zig env` command now prints both the resolved values as well as all the possibly observed environment variables.
2023-10-17add c_frontend to translate-c cache hashVeikka Tuominen
2023-10-16zig fetch: add `--debug-hash` argumentAndrew Kelley
This argument causes zig to print verbose hashing information to stdout, which can be used to diff two different fetches and find out why the hashes do not equal each other.
2023-10-16Merge pull request #17531 from moosichu/fix/frameworksJakub Konka
Fix some frameworks not linking macos
2023-10-16make distinct error limit configurableVeikka Tuominen
Closes #786
2023-10-15Add warning if .xml file is used, since it's likely intended to be a Windows ↵Ryan Liptak
manifest file Example: > zig build-exe test.zig test.xml warning: embedded manifest files must have the extension '.manifest' error: unrecognized file extension of parameter 'test.xml'
2023-10-15Add preliminary support for Windows .manifest filesRyan Liptak
An embedded manifest file is really just XML data embedded as a RT_MANIFEST resource (ID = 24). Typically, the Windows-only 'Manifest Tool' (`mt.exe`) is used to embed manifest files, and `mt.exe` also seems to perform some transformation of the manifest data before embedding, but in testing it doesn't seem like the transformations are necessary to get the intended result. So, to handle embedding manifest files, Zig now takes the following approach: - Generate a .rc file with the contents `1 24 "path-to-manifest.manifest"` - Compile that generated .rc file into a .res file - Link the .res file into the final binary This effectively achieves the same thing as `mt.exe` minus the validation/transformations of the XML data that it performs. How this is used: On the command line: ``` zig build-exe main.zig main.manifest ``` (on the command line, specifying a .manifest file when the target object format is not COFF is an error) or in build.zig: ``` const exe = b.addExecutable(.{ .name = "manifest-test", .root_source_file = .{ .path = "main.zig" }, .target = target, .optimize = optimize, .win32_manifest = .{ .path = "main.manifest" }, }); ``` (in build.zig, the manifest file is ignored if the target object format is not COFF) Note: Currently, only one manifest file can be specified per compilation. This is because the ID of the manifest resource is currently always 1. Specifying multiple manifests could be supported if a way for the user to specify an ID for each manifest is added (manifest IDs must be a u16). Closes #17406 options
2023-10-15Fix some frameworks not linking macosTom Read Cutting
Pull request #16888 removed searching for libraries with no extensions when linking frameworks... this adds that feature back.
2023-10-12Add `zig rc` subcommand, a drop-in replacement for rc.exeRyan Liptak
Uses resinator under-the-hood (see https://github.com/ziglang/zig/pull/17069) Closes #9564
2023-10-08restore progress reporting for package fetchingAndrew Kelley
2023-10-08give modules friendly names for error reportingAndrew Kelley
2023-10-08zig fetch: require 'paths' field in the manifestAndrew Kelley
2023-10-08give build.zig modules access to their dependencies' build.zig modulesAndrew Kelley
2023-10-08Package.Fetch: fix handling of relative pathsAndrew Kelley
2023-10-08CLI: fix only_core_functionality logicAndrew Kelley
2023-10-08zig build: add `--fetch` argumentAndrew Kelley
closes #14280
2023-10-08dependencies.zig: omit modules without build.zig as depsAndrew Kelley
2023-10-08finish hooking up new dependency tree logicAndrew Kelley
* add Module instances for each package's build.zig and attach it to the dependencies.zig module with the hash digest hex string as the name. * fix incorrectly skipping the wrong packages for creating dependencies.zig * a couple more renaming of "package" to "module"
2023-10-08finish implementing the auto-generated dependencies.zig moduleAndrew Kelley
2023-10-08package fetching: generate dependencies.zig fileAndrew Kelley
Only problem is that it looks like `has_build_zig` is being false when it should be true. After that is fixed then main.zig needs to create the `@dependencies` module from the generated source code.
2023-10-08fix inverted logic for allowing/disallowing paths fieldAndrew Kelley
2023-10-08CLI: finish updating module API usageAndrew Kelley
Finish the work started in 4c4fb839972f66f55aa44fc0aca5f80b0608c731. Now the compiler compiles again. Wire up dependency tree fetching code in the CLI for `zig build`. Everything is hooked up except for `createDependenciesModule` is not yet implemented.
2023-10-08require inclusion directives in root manifest but not depsAndrew Kelley
see #14311
2023-10-08get `zig fetch` working with the new systemAndrew Kelley
* start renaming "package" to "module" (see #14307) - build system gains `main_mod_path` and `main_pkg_path` is still there but it is deprecated. * eliminate the object-oriented memory management style of what was previously `*Package`. Now it is `*Package.Module` and all pointers point to externally managed memory. * fixes to get the new Fetch.zig code working. The previous commit was work-in-progress. There are still two commented out code paths, the one that leads to `Compilation.create` and the one for `zig build` that fetches the entire dependency tree and creates the required modules for the build runner.
2023-10-08rework package managerAndrew Kelley
Organize everything around a Fetch task which does a bunch of stuff in a worker thread without touching any shared state, and then queues up Fetch tasks for its dependencies. This isn't the theoretical optimal package fetching performance because CPU cores don't necessarily map 1:1 with I/O tasks, and each fetch task contains a mixture of computations and I/O. However, it is expected for this to significantly outperform master branch, which fetches everything recursively with only one thread. The logic is now a lot more linear and easy to follow. Everything that is embarassingly parallel is done on the thread pool, and then after everything is fetched, the worker threads are joined and the main thread does the finishing touches of stitching together the dependencies.zig import files. There is only one tiny little critical section and it does not even have any error handling in it. This also lays the groundwork for #14281 because in system mode, all this fetching logic will be skipped, but the "finishing touches" mentioned above still need to be done. With this branch, that logic is separated out and no longer recursively tangled with fetching stuff. Additionally, this branch: * Implements inclusion directives in `build.zig.zon` for deciding which files belong the package (#14311). * Adds basic documentation for `build.zig.zon` files. * Adds support for fetching dependencies with the `file://` protocol scheme (#17364). * Adds a workaround for a Linux/btrfs file system bug (#17282). This commit is a work-in-progress. Still todo: 1. Hook up the CLI to the new system. 2. Restore the module table creation logic after all the fetching is done. 3. Fix compilation errors, get the tests passing, and regression test against real world projects.
2023-10-06std: fix memory bug in getExternalExecutorJakub Konka
Until now, we would pass `candidate: NativeTargetInfo` which creates a copy of the `NativeTargetInfo.DynamicLinker` buffer. We would then return this buffer in `bad_dl: []const u8` which would goes out-of-scope the moment we leave this function frame yielding garbage. To fix this, we just need to remember to pass by const-pointer `candidate: *const NativeTargetInfo`.
2023-10-04comp: add support for -fdata-sectionsJakub Konka
2023-10-02zig fetch: enhanced error reportingAndrew Kelley
* Package: use std.tar diagnostics to give detailed error messages * std.tar: add diagnostic for unsupported file type