aboutsummaryrefslogtreecommitdiff
path: root/src-self-hosted/stage2.zig
AgeCommit message (Collapse)Author
2020-09-17delete all stage1 c++ code not directly related to compiling stage2Andrew Kelley
Deleted 16,000+ lines of c++ code, including: * an implementation of blake hashing * the cache hash system * compiler.cpp * all the linking code, and everything having to do with building glibc, musl, and mingw-w64 * much of the stage1 compiler internals got slimmed down since it now assumes it is always outputting an object file. More stuff: * stage1 is now built with a different strategy: we have a tiny zig0.cpp which is a slimmed down version of what stage1 main.cpp used to be. Its only purpose is to build stage2 zig code into an object file, which is then linked by the host build system (cmake) into stage1. zig0.cpp uses the same C API that stage2 now has access to, so that stage2 zig code can call into stage1 c++ code. - stage1.h is - stage2.h is - stage1.zig is the main entry point for the Zig/C++ hybrid compiler. It has the functions exported from Zig, called in C++, and bindings for the functions exported from C++, called from Zig. * removed the memory profiling instrumentation from stage1. Abandon ship! * Re-added the sections to the README about how to build stage2 and stage3. * stage2 now knows as a comptime boolean whether it is being compiled as part of stage1 or as stage2. - TODO use this flag to call into stage1 for compiling zig code. * introduce -fdll-export-fns and -fno-dll-export-fns and clarify its relationship to link_mode (static/dynamic) * implement depending on LLVM to detect native target cpu features when LLVM extensions are enabled and zig lacks CPU feature detection for that target architecture. * C importing is broken, will need some stage2 support to function again.
2020-09-15stage2: update to new LibCInstallation APIAndrew Kelley
2020-09-15Merge remote-tracking branch 'origin/master' into stage2-zig-ccAndrew Kelley
Pulling in the changes to libc_installation.zig
2020-09-15Use std.log in LibcInstallation `parse` instead of taking `stderr`Samrat Man Singh
2020-09-09start moving `zig cc` to stage2Andrew Kelley
* build.zig: repair the ability to link against llvm, clang, and lld * move the zig cc arg parsing logic to stage2 - the preprocessor flag is still TODO - the clang arg iterator code is improved to use slices instead of raw pointers because it no longer has to deal with an extern struct. * clean up error printing with a `fatal` function and use log API for messages rather than std.debug.print * add support for more CLI options to stage2 & update usage text - hooking up most of these new options is TODO * clean up the way libc and libc++ are detected via command line options. target information is used to determine if any of the libc candidate names are chosen. * add native library directory detection * implement the ability to invoke clang from stage2 * introduce a build_options.have_llvm so we can comptime branch on whether LLVM is linked in or not.
2020-09-02std: Don't trust stat() size in readAllAlloc fnsLemonBoy
Some files such as the ones in /proc report a st_size of zero, try to read the file anyway if we hit that case.
2020-08-19Merge pull request #5745 from lun-4/ebadf-errorAndrew Kelley
map EBADF to error values for read and write
2020-08-17simplify `zig info` and rename it to `zig env`Andrew Kelley
also add version to it
2020-08-17add `zig info` commandSergey Poznyak
2020-07-24macOS: macho ld64.lld fixesMichael Dusan
* bring `construct_linker_job_macho` to parity with `construct_linker_job_elf` * macho now sets `-error-limit` * macho on macOS now sets `-macosx_version_min` and `-sdk_version` to `10.13` when running `zig0` * macho now detects when `-l` prefix is not needed * macho on macOS detects system libraries in a case-insensitive manner * macho now ads user-specified libraries to linker command-line args when condition `is_native_os != true` * re-ordered some macho args positions to match elf positions closes #5059 closes #5067
2020-07-05added custom format method for WindowsVersionemekoi
2020-06-28std.os: make EBADF return error for read and writeLuna
2020-05-16Merge remote-tracking branch 'origin/master' into ↵Andrew Kelley
self-hosted-incremental-compilation
2020-05-15self-hosted: update main.zigAndrew Kelley
After this commit there are no more bit rotted files. The testing program that was in ir.zig has been moved to main.zig Unsupported command line options have been deleted, or error messages added. The compiler repl is available from the build-exe, build-lib, build-obj commands with the --watch option. The main zig build script now builds the self-hosted compiler unconditionally. Linking against LLVM is behind a -Denable-llvm flag that defaults to off.
2020-05-04os.zig: add ETIMEDOUT error case to read functionJonathan Marler
According to documentation ETIMEDOUT (110) is a valid error code for the read function. I just had my long-running (been running for about 7 weeks) network program crash because it did not handle the ETIMEDOUT error code from "read".
2020-04-27zig fmt: still print the relative pathAndrew Kelley
The previous commit made zig fmt print absolute paths; this commit keeps the absolute path resolution but still prints the relative paths to stdout.
2020-04-27fmt: Fix relative paths with . and .. on WindowsRyan Liptak
This is a band-aid fix due to NtCreateFile failing on paths with . or .. in them.
2020-04-15translate-c cleanup and zig fmtVexu
2020-04-11fix compilation under mingwemekoi
2020-04-06Merge branch 'master' into feature-file-locksLeRoyce Pearson
2020-04-04detect an endless loop when trying to detect native libc installationAndrew Kelley
closes #4810
2020-04-04zig cc looks for native include directories unless -nostdincAndrew Kelley
closes #4938
2020-04-03Merge pull request #4868 from xackus/new-arraylist-apiAndrew Kelley
new ArrayList API
2020-04-02Fix compile errors in stage2LeRoyce Pearson
2020-04-02Merge branch 'master' into feature-file-locksLeRoyce Pearson
2020-04-02zig cc: support -F and -frameworkAndrew Kelley
2020-04-02zig cc: respect -MF -MV -MD optionsAndrew Kelley
Zig disables its caching and forwards these args when any are provided. see #4784
2020-04-02new ArrayList API: fix everything elsexackus
2020-04-01zig cc: detect -mcpu, -march, -mtuneAndrew Kelley
However these are all treated like zig's -mcpu parameter. See #4784
2020-04-01zig cc: add support for -L linker argumentsRejean Loyer
2020-04-01zig cc properly handles -S flag and .ll, .bc extensionsAndrew Kelley
2020-04-01(breaking) std.Buffer => std.ArrayListSentineled(u8, 0)Andrew Kelley
This new name (and the fact that it is a function returning a type) will make it more clear which use cases are better suited for ArrayList and which are better suited for ArrayListSentineled. Also for consistency with ArrayList, * `append` => `appendSlice` * `appendByte` => `append` Thanks daurnimator for pointing out the confusion of std.Buffer.
2020-04-01fixups and revert a few thingsAndrew Kelley
2020-04-01Use length field as passed in stage2 libc_installation instead of relying on ↵daurnimator
zero termination
2020-04-01std: use std.ArrayList(u8).OutStream instead of std.Buffer.OutStreamdaurnimator
2020-04-01Tidy up some mem.spanZ use-sites now that null is accepteddaurnimator
2020-03-30revert detection of rtti and exceptionsAndrew Kelley
This caused link errors in c++ code because it was not correct to pass these flags to child codegens. And that was the only reason to detect these flags. Otherwise we can safely rely on non-explicitly-detected flag forwarding.
2020-03-30std lib API deprecations for the upcoming 0.6.0 releaseAndrew Kelley
See #3811
2020-03-28Merge branch 'master' into feature-file-locksLeRoyce Pearson
2020-03-28zig cc: Add support for -zRyan Liptak
This is only the first step; it makes zig cc recognize -z and append it to the linker args, but the linker arg parsing doesn't support -z yet so it will just give the warning 'unsupported linker arg: -z'
2020-03-27zig cc: Add support for -Xlinker, --for-linker, --for-linker=Ryan Liptak
2020-03-27initial support of response filesAndrew Kelley
See #4833 It doesn't support comments or quotes yet.
2020-03-27Merge branch 'master' into feature-file-locksLeRoyce Pearson
2020-03-27zig c++: get it working with musl and mingw-w64Andrew Kelley
2020-03-26ability to compile c++ hello world with `zig c++`Andrew Kelley
closes #4786
2020-03-25improved handling of native system directoriesAndrew Kelley
* `-isystem` instead of `-I` for system include directories fixes a problem with native system directories interfering with zig's bundled libc. * separate Stage2Target.is_native into Stage2Target.is_native_os and Stage2Target.is_native_cpu.
2020-03-25zig cc: add detection for `-###`Andrew Kelley
it turns on --verbose-cc and --verbose-link
2020-03-25zig cc: support -T linker script optionAndrew Kelley
2020-03-23Merge branch 'master' into feature-file-locksLeRoyce Pearson
2020-03-22riscv: add -mrelax arg for C to work around upstream issueAndrew Kelley
See #4485