aboutsummaryrefslogtreecommitdiff
path: root/src/os.cpp
AgeCommit message (Collapse)Author
2020-04-06stage1 fixes to support building with 32-bit mingw-w64Andrew Kelley
2020-03-31Fix possible unaligned ptr from `getauxval`Timon Kruiper
This caused SIGILL on armv7a-linux
2020-03-31fixes to 32-bit handling, to support 32-bit armAndrew Kelley
2020-03-23stage1: Remove fflush on file open for readingLemonBoy
On NetBSD this caused the libuserland compilation to fail. Closes #3719
2020-03-21zig cc: better support for the preprocessor option (-E)Andrew Kelley
2020-03-01stage1: fix compilation on 32-bit armAndrew Kelley
2020-02-22update std lib to integrate with libc for environAndrew Kelley
closes #3511
2020-02-17self-host dynamic linker detectionAndrew Kelley
2020-02-16stage1 os_update_file additionally compares src and dest sizeAndrew Kelley
prevents problems when source is created and then immediately copied to dest.
2020-02-16fix os_update_file implementation on WindowsAndrew Kelley
2020-02-16stage1 os: handle errors from read/writeAndrew Kelley
not sure why the CI is complaining about these now and not in master branch. but this is a slight code improvement anyway
2020-02-16stage1: don't copy unchanged output filesAndrew Kelley
when both `--cache on` and `--output-dir` parameters are provided. This prevents re-linking `zig` with every `make` even when `libzigstage2.a` was unchanged.
2020-02-16self-hosted libc detectionAndrew Kelley
* libc_installation.cpp is deleted. src-self-hosted/libc_installation.zig is now used for both stage1 and stage2 compilers. * (breaking) move `std.fs.File.access` to `std.fs.Dir.access`. The API now encourages use with an open directory handle. * Add `std.os.faccessat` and related functions. * Deprecate the "C" suffix naming convention for null-terminated parameters. "C" should be used when it is related to libc. However null-terminated parameters often have to do with the native system ABI rather than libc. "Z" suffix is the new convention. For example, `std.os.openC` is deprecated in favor of `std.os.openZ`. * Add `std.mem.dupeZ` for using an allocator to copy memory and add a null terminator. * Remove dead struct field `std.ChildProcess.llnode`. * Introduce `std.event.Batch`. This API allows expressing concurrency without forcing code to be async. It requires no Allocator and does not introduce any failure conditions. However it is not thread-safe. * There is now an ongoing experiment to transition away from `std.event.Group` in favor of `std.event.Batch`. * `std.os.execvpeC` calls `getenvZ` rather than `getenv`. This is slightly more efficient on most systems, and works around a limitation of `getenv` lack of integration with libc. * (breaking) `std.os.AccessError` gains `FileBusy`, `SymLinkLoop`, and `ReadOnlyFileSystem`. Previously these error codes were all reported as `PermissionDenied`. * Add `std.Target.isDragonFlyBSD`. * stage2: access to the windows_sdk functions is done with a manually maintained .zig binding file instead of `@cImport`. * Update src-self-hosted/libc_installation.zig with all the improvements that stage1 has seen to src/libc_installation.cpp until now. In addition, it now takes advantage of Batch so that evented I/O mode takes advantage of concurrency, but it still works in blocking I/O mode, which is how it is used in stage1.
2020-02-10stage1: memory/report overhaulMichael Dusan
- split util_base.hpp from util.hpp - new namespaces: `mem` and `heap` - new `mem::Allocator` interface - new `heap::CAllocator` impl with global `heap::c_allocator` - new `heap::ArenaAllocator` impl - new `mem::TypeInfo` extracts names without RTTI - name extraction is enabled w/ ZIG_ENABLE_MEM_PROFILE=1 - new `mem::List` takes explicit `Allocator&` parameter - new `mem::HashMap` takes explicit `Allocator&` parameter - add Codegen.pass1_arena and use for all `ZigValue` allocs - deinit Codegen.pass1_arena early in `zig_llvm_emit_output()`
2020-01-15stage1: move local native_libc.txt to globalMichael Dusan
Automatic creation of `native_libc.txt` now occurs only in global cache. Manual creation/placement into local cache is supported. closes #3975
2019-11-24removed unnecessary backslashes in windows' libc pathsSahnvour
2019-11-02stage1: add linux XDG Base Directory supportMichael Dusan
- define zig global cache based on XDG spec: if env XDG_CACHE_HOME { "$XDG_CACHE_HOME/zig" } else { "$HOME/.cache/zig" } - old definition "$HOME/.local/share/zig" is retired - closes #3573
2019-10-30DragonFlyBSD supportTse
2019-09-22more helpful error message when failing to parse glibc abi.txtAndrew Kelley
2019-09-05os: raise maximum file descriptor limitAndrew Kelley
Do a binary search for the maximum RLIMIT_NOFILE. Patch lifted from node.js commit 6820054d2d42ff9274ea0755bea59cfc4f26f353
2019-09-01Revert "Merge pull request #2991 from emekoi/mingw-ci"Andrew Kelley
This reverts commit ec7d7a5b14540ea3b2bab9f11318630338467965, reversing changes made to 81c441f8855d4c58f0b2ff86d3d007cf0bf395d3. It looks like this broke colors in Windows Command Prompt (#3147) and this method of detecting native C ABI isn't working well (#3121).
2019-08-02accept unix style paths on windows-gnuemekoi
2019-08-02implemented runtime abi detetction for windowsemekoi
2019-06-22make string literal const on windowsemekoi
2019-06-17Remove duplicate exe name with zig runJonathan Marler
2019-05-20Fix signedness mismatch in comparisonLemonBoy
2019-05-15fix static builds of zig from requiring c compilerAndrew Kelley
to be installed when linking libc. When zig links against libc, it requires a dynamic linker path. Usually this can be determined based on the architecture and operating system components of the target. However on some systems this is not correct; because of this zig checks its own dynamic linker. When zig is statically linked, this information is not available, and so it resorts to using cc -print-filename=foo to find the dynamic linker path. Before this commit, Zig incorrectly exited with an error if there was no c compiler installed. Now, Zig falls back to the dynamic linker determined based on the arch and os when no C compiler can be found.
2019-04-26Fix path canonicalization when $HOME has a trailing slashAndrew Kelley
2019-04-24remove Shebang (#!) supportShawn Landden
Closes: #2165
2019-04-13make os_file_close poison file handle after closeBen Noordhuis
This helps track down use-after-close bugs.
2019-04-02better error message when os_file_overwrite failsAndrew Kelley
2019-03-27fix build on arm64Shawn Landden
2019-03-11fix build on windowsAndrew Kelley
2019-03-11stage1 caching system: detect problematic mtimesAndrew Kelley
closes #2045
2019-03-08breaking changes to zig build API and improved cachingAndrew Kelley
* in Zig build scripts, getOutputPath() is no longer a valid function to call, unless setOutputDir() was used, or within a custom make() function. Instead there is more convenient API to use which takes advantage of the caching system. Search this commit diff for `exe.run()` for an example. * Zig build by default enables caching. All build artifacts will go into zig-cache. If you want to access build artifacts in a convenient location, it is recommended to add an `install` step. Otherwise you can use the `run()` API mentioned above to execute programs directly from their location in the cache. Closes #330. `addSystemCommand` is available for programs not built with Zig build. * Please note that Zig does no cache evicting yet. You may have to manually delete zig-cache directories periodically to keep disk usage down. It's planned for this to be a simple Least Recently Used eviction system eventually. * `--output`, `--output-lib`, and `--output-h` are removed. Instead, use `--output-dir` which defaults to the current working directory. Or take advantage of `--cache on`, which will print the main output path to stdout, and the other artifacts will be in the same directory with predictable file names. `--disable-gen-h` is available when one wants to prevent .h file generation. * `@cImport` is always independently cached now. Closes #2015. It always writes the generated Zig code to disk which makes debug info and compile errors better. No more "TODO: remember C source location to display here" * Fix .d file parsing. (Fixes the MacOS CI failure) * Zig no longer creates "temporary files" other than inside a zig-cache directory. This breaks the CLI API that Godbolt uses. The suggested new invocation can be found in this commit diff, in the changes to `test/cli.zig`.
2019-03-07fix windows buildAndrew Kelley
2019-03-07better behavior when cache dir unavailableAndrew Kelley
and choose different manifest dir for local cache to avoid conflict with zig build
2019-03-07fix regressions on macosAndrew Kelley
2019-03-04initial glibc supportAndrew Kelley
2019-02-28struct types get fully qualified namesAndrew Kelley
and function symbol names become fully qualified
2019-02-26windows returns EINVAL for fopen when there is an asterisk in the nameAndrew Kelley
closes #508
2019-02-25`@cImport` works with `--cache on`Andrew Kelley
We pass -MD -MF args to clang when doing `@cImport`, which gives us a complete list of files that the C code read from. Then we add these to the cache. So even when using `@cImport` Zig's caching system remains perfect. This is a proof of concept for the mechanism that the self-hosted compiler will use to watch and rebuild files.
2019-02-23better libc detection (#1996)Andrew Kelley
* better libc detection This introduces a new command `zig libc` which prints the various paths of libc files. It outputs them to stdout in a simple text file format that it is capable of parsing. You can use `zig libc libc.txt` to validate a file. These arguments are gone: --libc-lib-dir [path] directory where libc crt1.o resides --libc-static-lib-dir [path] directory where libc crtbegin.o resides --msvc-lib-dir [path] (windows) directory where vcruntime.lib resides --kernel32-lib-dir [path] (windows) directory where kernel32.lib resides Instead we have this argument: --libc [file] Provide a file which specifies libc paths This is used to pass a libc text file (which can be generated with `zig libc`). So it is easier to manage multiple cross compilation environments. `--cache on` now works when linking against libc. `ZigTarget` now has a bool field `is_native` Better error messaging when you try to link against libc or use `@cImport` but the various paths cannot be found. It should also be faster. * save native_libc.txt in zig-cache This avoids having to detect libc at runtime on every invocation.
2019-02-17Add NetBSD supportMaya Rashish
Mostly picking the same paths as FreeBSD. We need a little special handling for crt files, as netbsd uses its own (and not GCC's) for those, with slightly different names.
2019-01-31os.cpp: fix regression on Windows from 59c050e7Andrew Kelley
2019-01-30collapse os_file_mtime into os_file_open_r and check for directoryAndrew Kelley
This is a manual merge of kristate's pull request #1754, due to conflicts + a couple fixups. closes #1754
2018-12-12freebsd: fix os_self_exe_path function and update std libAndrew Kelley
2018-11-27Merge branch 'master' into freebsd2Andrew Kelley
2018-11-26stage1: better file path handlingAndrew Kelley
* better message printed when cache hash fails * better handling of '/' as root source file * os_path_split parses '/' and '/a' correctly closes #1693 closes #1746
2018-11-19Merge branch 'freebsd-up' of https://github.com/myfreeweb/zig into freebsd2Andrew Kelley