0.7.1 Release Notes
Download & Documentation
Zig is a general-purpose programming language and toolchain for maintaining
robust, optimal, and reusable software.
This release solves 69 bugs.
- start code: fix TLS symbol collisions causing compile error when linking against libc on Windows.
- debug: fix compilation error on platforms where debug info is unsupported. Non-tier-1
platforms will now return
error.UnsupportedDebugInfo when attempting
to print a stack trace, rather than a compile error.
- debug: Avoid deadlock in the signal handler.
still be held when we reach the signal handler, grab our own stderr handle to print
the error messages and avoid deadlocking. (#7247)
- debug: Add nosuspend around
stderr.print calls. Fixes
compilation errors with non-blocking I/O mode.
- fix json parsing with unmatched closing tokens (#6865). Also fix swapped parsing errors.
- fix HashMapputAssumeCapacity and clearRetainingCapacity
null when input path is root. (#6746) (#6727) (#6584) (#6592) (#6602)
os.windows.ReadFile allow short reads.
This makes it behave like the read() wrapper for unix systems. Reading
the whole buffer breaks some use-cases like buffered readers over sockets. (#7121)
- mem: make
sliceAsBytes, etc. respect
Version.parse less strict. (#6649)
- crypto: Change seed for
- crypto: edwards25519 - skip useless operations and duplicate lookup table.
- os: add
time_t definiton for x86_64 linux.
- os: define and use
dev_t for linux x86_64.
- os: fix
which can accept an arbitrary alignment. Fixes a compile error in
fs.File.readToEndAllocOptions when an alignment is specified.
- BufMap: fix memory leak.
WindowsDynLib.openW trying to strip the
\??\ prefix when it does not exist.
- networking: support localhost independently from the system hosts list.
This matches RFC 6761. (#6955)
- Make the use of
pthread_join POSIX-compliant. (#7275)
- event: Fix import path for
- c: make
free's parameter optional.
- GeneralPurposeAllocator: Fix incorrectly modifying
total_requested_bytes in some cases.
- os.windows: add
error.AccessDenied to the
MoveFileEx error set.
- json: make
- stage1: Print correct error message for vector
- stage1: Fix comparison of unions containing zero-sized types. (#7047)
- stage1: Fix zero length arrays with type of containing struct/union producing "error: struct/union 'TYPE' depends on itself" (#7058)
- stage1: Fix crash when storing an array of type in a field. (#7027)
- stage1: Prevent TypeInfo payload from incorrectly being undefined.
- stage1: Fix ReleaseSmall not properly asking LLVM backend for small code. (#7048) (#7077)
- stage1: Enable loop interleaving when unrolling is enabled.
- stage1: Fix bug: Cannot reify ErrorUnion before generating its
- stage1: Disambiguate Wasm imports with same name. Fixes functions with the
same name but in different modules being mixed up. (#7088)
- stage1: Fix generation of pass-by-value args in async fns. (#7104)
- stage1: Fix asyncCall with non-abi-aligned arguments. Make the code used
to calculate the variable slot index into the frame match what's done during
the structure layout calculation. Prevents a few nasty LLVM errors when such
types are passed around.
- stage1: Add architecture-specific clobbers to asm()
- stage1: Fix undefined assignment for bitfields. Prevents silent memory corruption. (#7055)
- stage1: Resolve usingnamespace decls when calling
- stage1: Fix ICE when generating struct fields with padding. (#5398)
- stage1: Force union member types to be resolved.
- stage1: Fix crash in
conversion with zst. (#6951)
- stage1: Add missing bitcast when rendering var ptr. Some types require this
extra bitcast, eg. structs or unions with extra padding fields
inserted by the compiler. (#7250)
- stage1: Fix
@typeInfo generation for arrays without
- stage1: Fix floating point parsing on big-endian systems. (#7256)
- stage1: Add compile error for pointer arithmetic on ptr-to-array. (#2018)
- stage1: Fix ICE when global error set is empty. (#7030)
- stage1: Don't fold single-element enums too aggressively.
- stage1: Initialize single-element union tag correctly.
- stage1: Fix constant folding of single-element enums.
- stage1: Fix type mapping for
c_longdouble and implement
msp430 mapping. (#7333)
- stage1: Resolve
- CLI: fix incorrectly calling exit(0) after a failed compilation that emitted
compile errors. (#6976)
- CLI: make help in commands more consistent. (#7101)
- CLI: add -h alias for --help, and make -h,--help consistent in usage text and parsing.
- CLI: infer --name based on first C source file or object. Previously,
--name would only be inferred if there was exactly 1 C source file or exactly
1 object. Now it will be inferred if there is at least one of either.
- CLI: improved local cache directory logic. (#7342)
Previously, when choosing the local cache directory, if there was no
root source file, an explicitly chosen path, or other clues, zig would
choose cwd + zig-cache/ as the local cache directory.
This can be problematic if Zig is invoked with the CWD set to a
read-only directory, or a directory unrelated to the actual source files
being compiled. In the real world, we see this when using `zig cc` with
CGo, which for some reason changes the current working directory to the
read-only go standard library path before running the C compiler.
This commit conservatively chooses to use the global cache directory
as the local cache directory when there is no other reasonable choice,
and no longer will rely on the cwd path to choose a local cache directory.
As a reminder, the --cache-dir CLI flag and ZIG_LOCAL_CACHE_DIR
environment variable are available for overriding the decision. For the
zig build system, it will always choose the directory that build.zig is
- Bump default version max for macOS from 10.15.3 to 10.15.7
- build: Fix compile error with Clang 11 on x86_64-windows-gnu.
- build: cmake properly detects when to rebuild zig1.o (#6724)
- build: Update the minimum cmake version we require so that cmake stops complaining
- build: fix for GCC 9.2: -Wno-maybe-uninitialized
- link: Prevent double file close in Mach-O linking.
- link: Fix static archives cauling compiler related file (llvm-ar.id) in the current
working directory. (#6943)
- link: Don't pass -l arguments when building .a or .o files. (#7094)
- link: Fix regression when targeting macOS due to LLD Mach-O code not supporting newer
macOS systems by target-version-gating
-syslibroot on the linker line.
- link: macho: specify -install_name as full dylib's name. This then allows
for proper resolution of names via runpath search path list, i.e.,
-rpath @loader_path will correctly resolve to
@rpath/libxxx.dylib (...) in the linked binary.
- link: LLD is invoked as a child process rather than a library. LLD library
code improperly calls exit() as well as having global state that it does not
reset between invocations. Zig now works around this by invoking itself with
special CLI parameters which are then forwarded to LLD library calls. (#3825)
- Rework the bundle-compiler-rt feature (#7013) (#6817):
- It is now
to override the (quite reasonable) default of bundling compiler-rt only
for executables and dynamic libraries.
- The build.zig API is still called
however it is now an optional bool instead of a bool. leaving it as
null means to use the compiler default.
- Additionally support
-fcompiler-rt when doing
for ELF files since that target already supports linking multiple objects into one.
- Includes an error message when attempting this for non-ELF. In the
future this could additionally be supported with a more advanced
implementation that does not rely on the linker.
- Properly populate the linker cache hash.
- Fixed an internal compiler error when an absolute path passed as a system library.
Now emits a proper compile error. Absolute paths to shared objects must be passed
as positional parameters. (#7139) (#6868)
- Fix not detecting all dynamic libraries. Positional shared library arguments
were not being detected as causing dynamic linking, resulting in invalid linker
lines. LLD did not have an error message for this when targeting x86_64-linux
but it did emit an error message when targeting aarch64-linux, which is how I
noticed the problem.
-target wasm32-freestanding-musl for C headers. (#5854)
- caching system: include root name in the cache. This fixes a bug where the
caching system did not notice when the
--name flag changed.
- caching system: add package names and paths into the root module cache hash
so that Zig notices when the package mappings change.
- caching system: add
-femit-foo=bar args to the cache hash. (#6979) (#7036)
- caching system: fix compiler crash when compiling C objects. (#7096)
- caching system: add
@cImport files to
Compilation cache manifest. Fixes caching system not
noticing when C header files changed. (#7007)
- caching system: detect redundant C/C++ source files and emit an error instead
of deadlocking. (#7308)
- caching system: fix deadlock with build-exe on an object for Windows. (#5825)
- type: Change tag returned by
Function was returning Int before.
- Fix file extension stripping. Previously it looked for the first '.' but now
- Explicitly cast indices to
usize. This is needed for
usize is the same size as
u16, eg. MSP430.
- Fix compilation of clzsi for armv6 targets.
- Avoid exposing atomic builtins when not supported. Prevents
compilation/LLVM errors for niche targets such as AVR/MSP430 or ARM v6m.
By not exporting any atomic builtin anymore the user is free to provide their
own implementation (that disable the IRQs) or to provide the
--single-threaded switch and forget about this.
- Fix code model passing as the wrong CLI flag to Zig.
bundle_compiler_rt not being respected. It is now
an optional bool. Leaving the value as
null means to use
the compiler-chosen default.
- COFF linking: fix incorrectly passing .dll instead of .lib
addBuildOption special handling for
- Do not keep the build.zig cache manifest file locked. This allows to have
multiple instances of
zig build at the same time.
For example when you have a long running
zig build run and
then want to run
zig build somethingelse.
- Added global-cache argument to build system + removed extra args. Fixes
crash when trying to override the cache directories in tandem with
zig-cache/ directories. (#7352)
- Improve var decl initializer formatting.
- Fix alignment of initializer elements. (#7289)
- Update to latest Clang release/11.x C headers.
- Add missing
-m<os>-version-min CLI args to Clang.
This fixes some code generation issues when targeting macOS and compiling C/C++ code.
- zig cc no longer forces dynamic libraries to use a soname, matching C compiler behavior. ((#5861)
- Prevent invoking the linker for non-ELF targets when -c is passed. (#7094)
- Always use codeview (pdb) when object_format is PE/COFF.
Previously, when mixing Zig and C/C++ code for windows-gnu targets, zig
would get codeview format but the C/C++ code would not get any debug
info. Now, C/C++ code properly emits debug info in codeview format and
everything just works.
- When targeting Windows, support more DLL import libs (#7268):
- wldap32.dll (#7395)
- xinput1_4.dll (#7398)
- mingw-w64: patch to silence implicit-function-declaration warnings. (#7356)
- Add support for dynamically linking musl libc. (#5364)
- Fix backticked code in langref.
- Fix operator precedence documentation.
and even some
Zig is immature. Even with Zig 0.7.1, working on a non-trivial project using Zig will
likely require participating in the development process.
The first release to ship with no known bugs will be 1.0.0.
These release notes have been edited down to avoid excessive detail as to not overwhelm
the reader with content. In order to make sure everyone gets credit who contributed, here
is a list of everyone who landed commits during this release cycle (produced with
git shortlog -sne 0.7.0..0.7.1):
- Andrew Kelley
- Frank Denis
- Isaac Freund
- Jakub Konka
- Timon Kruiper
- Veikka Tuominen
- Alexandros Naskos
- Jonathan Marler
- Alex Cameron
- Guoxin Yin
- Hubert Jasudowicz
- Jonas Carpay
- Lee Cannon
- Martin Wickham
- Mathieu Guay-Paquet
- Michael Freundorfer
- Miles Alan
- Nathan Michaels
- Nathanaël Courant
Special thanks to those who sponsor Zig.
Because of you, Zig is driven by the open source community,
rather than the goal of making profit. In particular, these fine donors
sponsor Zig for $50/month or more:
- Akbar Dhanaliwala
- Lager Data
- Stevie Hryciw
- Matthew Knight
- Björn Linse
- Hannes Kochniß
- Jethro Nederhof
- Karrick McDermott
- Josh Wolfe
- Dirk de Visser
- Steve Powers
- Anton Kochkov
- Michael Raymond
- Michal Ziulek
- Isaac Yonemoto
- Agam Dua
- Max Bernstein
- Jesus Alvarez
- Max De Marzi
- Santiago Andaluz
- Rui Ueyama
- Charlie Cheever
- Simon A. Nielsen Knights
- Felix Queißner
- Martin Wickham
- Asherah Connor
- Joran Dirk Greef
- Auguste Rame
- Filippo Valsorda
- Clay Kuppinger
- Jay Petacat
- Jamie Brandon
- Rand Fitzpatrick
- Vincent Rischmann
- Robert Hencke
- Timothy Ham