This way, tracking segment-to-section mapping becomes a lot easier
since it's effectively just start index plus number of sections
defined within the segment. If a section becomes empty however
care needs to be taken to remove the header upon committing to the
final binary.
Fix incorrect writing of symtab and strtab in dSYM bundle in incremental
context.
Fix incorrectly navigating unnamed consts (freeing) in incremental context.
This is currently hard-coded to require all consts to land in `__TEXT,__const`,
which is wrong and needs a rewrite.
Instead of generating sections upfront, allow generation by scanning
the object files for input -> output sections mapping. Next, always
strive to keep output sections in the final container sorted as they
appear in the final binary. This makes the linker less messy wrt
handling of output sections sort order for dyld/macOS not to complain.
There's still more work to be done for incremental context though
to make this work but looks promising already.
Previously we expected to only find decl refs in a `foo.bar.baz`
type of expression. This would crash when trying to render something
like `@typeInfo(T).Int.bits`. We now properly account for builtins
and other components.
From https://man7.org/linux/man-pages/man7/inotify.7.html
> **IN_MASK_CREATE** (since Linux 4.18)
>
> Watch pathname only if it does not already have a watch associated with it; the error EEXIST results if pathname is already being watched.
This change provides a basic implementation of #2349 for stage2. There's
still quite a lot of work before this logic is as complete as what's in
Clang (b364535304/clang/lib/CodeGen/CGStmt.cpp (L2304-L2795)),
particularly considering the diversity of constraints across targets.
It's probably not worth doing the complete work until there's a clearer
picture for constraints in Zig's future dedicated ASM syntax, but at
least this gives us a small improvement for now.
As a bonus, this also fixes a bug with how we were handling `_`
identifiers.
If you have multiple llvm-config executables in your path, and all of
them cause failures, then only the last failure will be printed. This
can cause confusion when the multiple llvm-config executables are from
different major LLVM versions, i.e. LLVM 13 and 14, which might mask an
error that happened on the LLVM 14 llvm-config with an unrelated error.
This commit makes it so that all errors are collected into a list and
printed all at once; this way, you can see how each llvm-config
executable failed to configure properly. Note that the failures still
won't be printed if a successful configuration is found.
We now warn the user if config.h could not be located.
This also updates the search to stop early upon encountering a
`.git` directory, so that we avoid recursing outside of the zig
source if possible.
Fixes: 2a990d696 ("stage1: rework tokenizer to match stage2")
Fixes: b6354ddd5 ("move AST rendering code to separate file")
Signed-off-by: Wei Fu <fuweid89@gmail.com>
This requires using -Dstatic-llvm and setting the search prefix and the
target, just like it is required for building stage2 and stage3. This
prevents Zig from trying to integrate with the system, which would
trigger an error due to the `cc` command not being installed.
closes#12144
Shared libraries can be provided on the command line as if they were
objects, as a path to the ".so" file. The "each-lib-rpath" functionality
was ignoring these shared libraries accidentally, causing missing rpaths
in the output executable.
* No longer emit div_exact AIR instruction that can produce a
remainder, invoking undefined behavior.
* div_trunc, div_exact, div_floor are extracted from analyzeArithmetic
and directly handled similarly to div_trunc, integrating them with
integer overflow safety checking.
* Also they no longer emit divide-by-zero safety checking when RHS
is comptime known to be non-zero.
Concrete improvements:
* Added safety for integer overflow (-MAX_INT/-1)
* Omit division by zero safety check when RHS is comptime known to
be non-zero.
* Avoid emitting `_optimized` variants of AIR instructions for integers
(this suffix is intended to be used for floats only).
Subjective changes: I extracted the div logic out from analyzeArithmetic
in order to reduce the amount of branches - not for performance reasons
but for code clarity. It is more lines of code however, and some logic
is duplicated.