aboutsummaryrefslogtreecommitdiff
path: root/src/main.cpp
AgeCommit message (Collapse)Author
2019-10-08src/main: minor grammar fix in the help for `zig builtin`Christine Dodrill
2019-10-06generated docs: docs/ instead of doc/Andrew Kelley
This appears to be more of a standard directory name. See #21
2019-10-04proof of concept of stage1 doc generationAndrew Kelley
This commit adds `-fgenerate-docs` CLI option, and it outputs: * doc/index.html * doc/data.js * doc/main.js In this strategy, we have 1 static html page and 1 static javascript file, which loads the semantic analysis dump directly and renders it using dom manipulation. Currently, all it does is list the declarations. But there is a lot more data available to work with. The next step would be making the declarations hyperlinks, and handling page navigation. Another strategy would be to generate a static site with no javascript, based on the semantic analysis dump that zig now provides. I invite the Zig community to take on such a project. However this version which heavily relies on javascript will also be a direction explored. I also welcome contributors to improve the html, css, and javascript of what this commit started, as well as whatever improvements are necessary to the static analysis dumping code to provide more information. See #21.
2019-10-03add -fdump-analysis to dump type information to jsonAndrew Kelley
This commit adds -fdump-analysis which creates a `$NAME-analysis.json` file with all of the finished semantic analysis that the stage1 compiler produced. It contains types, packages, declarations, and files. This is an initial implementation; some data will be missing. However it's easy to improve the implementation, which is in `src/dump_analysis.cpp`. The next step for #21 will be to create Zig code which parses this json file and creates user-facing HTML documentation. This feature has other uses, however; for example, it could be used for IDE integration features until the self-hosted compiler is available.
2019-09-27avoid duplicated code of specifying the default glibc versionAndrew Kelley
2019-09-25remove --override-std-dir. fix issues caused by moving std libAndrew Kelley
2019-09-23zig build: linkSystemLibrary integrates with pkg-configAndrew Kelley
* add -D CLI option for setting C macros * add std.ascii.allocLowerString * add std.ascii.eqlIgnoreCase * add std.ascii.indexOfIgnoreCasePos * add std.ascii.indexOfIgnoreCase
2019-09-21zig test: don't skip execution when explicit command providedAndrew Kelley
2019-09-15Fix typos: "seperate" to "separate"Jay Weisskopf
Fixes #3236
2019-09-10make the std lib support event-based I/OAndrew Kelley
also add -fstack-report
2019-09-05add -l as an alias for --libraryAndrew Kelley
2019-09-02add ability to specify darwin framework search dirsAndrew Kelley
2019-08-15note that -mllvm is unsupportedAndrew Kelley
closes #3045
2019-07-22disable segfault handler when panickingAndrew Kelley
this prevents a segfault in stack trace printing to activate the segfault handler.
2019-07-15fix the build on windowsAndrew Kelley
2019-07-15move some of the installation from cmake to zig buildAndrew Kelley
This moves the installation of shipped source files from large CMakeLists.txt lists to zig build recursive directory installation. On my computer a cmake `make install` takes 2.4 seconds even when it has to do nothing, and prints a lot of unnecessary lines to stdout that say "up-to-date: [some file it is installing]". After this commit, the default output of `make` is down to 1 second, and it does not print any junk to stdout. Further, a `make install` is no longer required and `make` is sufficient. This closes #2874. It also closes #2585. `make` now always invokes `zig build` for installing files and libuserland.a, and zig's own caching system makes that go fast.
2019-07-12Merge pull request #2868 from ziglang/windows-libcAndrew Kelley
provide a libc for windows using mingw-w64
2019-07-12fix typo in help text for bundle-compiler-rtthomas
2019-07-11add -Wno-pragma-pack when targeting windows-gnuAndrew Kelley
windows.h has files such as pshpack1.h which do #pragma packing, triggering a clang warning. So for this target, this warning is disabled. this commit also improves the error message printed when no libc can be used, printing the "zig triple" rather than the "llvm triple".
2019-07-07expose glibc version in builtinAndrew Kelley
2019-07-07add -target-glibc to cli help and zig buildAndrew Kelley
2019-07-07ability to target any glibc versionAndrew Kelley
2019-07-04zig build: search upwards for build.zig fileAndrew Kelley
closes #2587
2019-07-04stage1: add missing help for `--override-lib-dir`Michael Dusan
2019-07-03Merge branch 'function-sections' of https://github.com/timonkruiper/zig into ↵Andrew Kelley
timonkruiper-function-sections
2019-07-02enable segfault stack traces in stage1 compilerAndrew Kelley
2019-07-01Added function-section functionalityTimon Kruiper
2019-06-27better CLI error message for missing sub-architectureAndrew Kelley
2019-06-17Remove duplicate exe name with zig runJonathan Marler
2019-06-14expose builtin.strip_debug_infoAndrew Kelley
zig code now can be made aware that it will not have any debug information available at runtime.
2019-05-29main: set subsystem in `zig builtin` when explicitly providedAndrew Kelley
2019-05-28Warn the user if run/test is paired with emit optionsLemonBoy
2019-05-27improve the stack check CLI optionsAndrew Kelley
See #2526
2019-05-13Assemble asm files using CCLemonBoy
Stuffing all the files together and compiling the resulting blob with the main program is a terrible idea. Some files, namely the .S ones, must be run trough the C preprocessor before assembling them (#2437). Beside that the aggregate may be mis-compiled due to the presence of some flags that affect the following code. For example let's consider two files, a.s and b.s a.s ``` fn1: ret .data data1: .word 0 ``` b.s ``` fn2: ret ``` Now, fn1 and fn2 will be both placed in the .text section as intended if the two files are compiled separately. But if we merge them the `.data` flag ends up placing fn2 in the wrong section! This fixes a nasty crash where musl's memset ended up in the non-executable data segment, leading to too many hours of head-scratching.
2019-05-08fix build on macOSAndrew Kelley
Sadly due to a workaround for LLD linker limitations on macOS we cannot put libuserland into an .a file; instead we have to use object files. Again due to linker limitations, bundling compiler_rt.o into another relocatable object also doesn't work. So we're left with disabling stack probing on macOS for the stage1 self-hosted code. These workarounds could all be removed if the macos support in the LLD linker improved, or if Zig project had its own linker that did not have these issues.
2019-05-08add --bundle-compiler-rt function to link optionsAndrew Kelley
and use it when building libuserland.a The self-hosted part of stage1 relies on zig's compiler-rt, and so we include it in libuserland.a. This should potentially be the default, but for now it's behind a linker option. self-hosted translate-c: small progress on translating functions.
2019-05-08stage1: remove unneeded extern functionAndrew Kelley
2019-05-08Implement stack probes for x86/x86_64LemonBoy
Enabled on non-Windows systems only since it already requires stack probes.
2019-05-01main: change --enable-pic and --disable-pic to -fPIC and -fno-PICDong-hee Na
2019-04-29Fix crash due to command line argument parsingMatt Stancliff
zig --help -> ok zig --help --c-source -> ok zig --c-source --help -> crash [fixed] 'i' was being incremented without regard for the 'argc' limit, so we were running off the end of 'argv'.
2019-04-26zig fmt is built directly into stage1 rather than child processAndrew Kelley
Previously, `zig fmt` on the stage1 compiler (which is what we currently ship) would perform what equates to `zig run std/special/fmt_runner.zig` Now, `zig fmt` is implemented with the hybrid zig/C++ strategy outlined by #1964. This means Zig no longer has to ship some of the stage2 .zig files, and there is no longer a delay when running `zig fmt` for the first time.
2019-04-25translate-c: a little closer to self-hosted implementationAndrew Kelley
2019-04-24remove Shebang (#!) supportShawn Landden
Closes: #2165
2019-04-16stage1 is now a hybrid of C++ and ZigAndrew Kelley
This modifies the build process of Zig to put all of the source files into libcompiler.a, except main.cpp and userland.cpp. Next, the build process links main.cpp, userland.cpp, and libcompiler.a into zig1. userland.cpp is a shim for functions that will later be replaced with self-hosted implementations. Next, the build process uses zig1 to build src-self-hosted/stage1.zig into libuserland.a, which does not depend on any of the things that are shimmed in userland.cpp, such as translate-c. Finally, the build process re-links main.cpp and libcompiler.a, except with libuserland.a instead of userland.cpp. Now the shims are replaced with .zig code. This provides all of the Zig standard library to the stage1 C++ compiler, and enables us to move certain things to userland, such as translate-c. As a proof of concept I have made the `zig zen` command use text defined in userland. I added `zig translate-c-2` which is a work-in-progress reimplementation of translate-c in userland, which currently calls `std.debug.panic("unimplemented")` and you can see the stack trace makes it all the way back into the C++ main() function (Thanks LemonBoy for improving that!). This could potentially let us move other things into userland, such as hashing algorithms, the entire cache system, .d file parsing, pretty much anything that libuserland.a itself doesn't need to depend on. This can also let us have `zig fmt` in stage1 without the overhead of child process execution, and without the initial compilation delay before it gets cached. See #1964
2019-04-14organize how the single threaded option is passed aroundAndrew Kelley
2019-04-14wasm: force single threadedShritesh Bhattarai
2019-04-10pass exec_path to zig runShritesh Bhattarai
2019-04-04fix thread local variables for non- position independent codeAndrew Kelley
This fixes comes thanks to Rich Felker from the musl libc project, who gave me this crucial information: "to satisfy the abi, your init code has to write the same value to that memory location as the value passed to the [arch_prctl] syscall" This commit also changes the rules for when to build statically by default. When building objects and static libraries, position independent code is disabled if no libraries will be dynamically linked and the target does not require position independent code. closes #2063
2019-03-31fix zig run to accept executable argsMichael Dusan
The `--` double-hyphen is now used to end further `zig` processing of command line options. All arguments after `--` will be passed on to the executable. eg. `--help` will be passed on. `zig run foo.zig -- --help` closes #2148
2019-03-19zig targets prints the available libcsAndrew Kelley