13906 Commits

Author SHA1 Message Date
Jakub Konka
b0327ff233 macho: handle dead stripping of atoms 2024-01-24 12:34:39 +01:00
Jakub Konka
21e3bb38af macho: claim unresolved symbols 2024-01-24 12:34:39 +01:00
Jakub Konka
1b76779857 macho: convert tentative defs and create objc sections 2024-01-24 12:34:39 +01:00
Jakub Konka
6b617afe2a macho: resolve synthetic symbols 2024-01-24 12:34:39 +01:00
Jakub Konka
8a1311733b macho: resolve symbols and mark files live 2024-01-24 12:34:39 +01:00
Jakub Konka
b8f67d7985 macho: init InternalObject and add forced undefined globals 2024-01-24 12:34:39 +01:00
Jakub Konka
8c7a34ae68 macho: prep for dylib deps (no resolution yet) 2024-01-24 12:34:39 +01:00
Jakub Konka
c023b762cd macho: parse tbds 2024-01-24 12:34:38 +01:00
Jakub Konka
d153bc2f0c macho: parse dylibs 2024-01-24 12:34:38 +01:00
Jakub Konka
c5e509595a macho: parse archives 2024-01-24 12:34:38 +01:00
Jakub Konka
d05e9c3792 macho: create scaffolding for parsing different input objects 2024-01-24 12:34:38 +01:00
Jakub Konka
0c171afab0 macho: parse an input object file! 2024-01-24 12:34:38 +01:00
Jakub Konka
7588eeccea macho: re-enable --verbose-link 2024-01-24 12:34:38 +01:00
Jakub Konka
dd0addab1f macho: get the ball rolling! 2024-01-24 12:34:38 +01:00
Jakub Konka
2f94dc939e macho: copy over new implementation sources from zld 2024-01-24 12:34:38 +01:00
Andrew Kelley
9d5a133f18 Revert "Don't assume a write if an operand is not in function parameters"
This reverts commit 2ab78937dd29fbc299ac434f962a5ff41002cc43.

Premature merge - apologies for the disruption.

Reopens #15685
Reopens #17580
2024-01-23 20:24:58 -07:00
Rahul Prabhu
2ab78937dd Don't assume a write if an operand is not in function parameters
Liveness assumes that if the operand is not in the parameters of
a function call it is being written to, resulting in pointless memcpies.
2024-01-23 18:32:34 -08:00
Andrew Kelley
aef1da1634 Sema: use Sema.typeAbiSize rather than Type.abiSize
This resolves the type instead of asserting that the type is resolved,
fixing a crash.
2024-01-23 00:56:52 -08:00
jacwil
68ea1121fc objcopy ofmt=hex iterates through segments instead of sections 2024-01-22 21:29:21 -08:00
Veikka Tuominen
eeec34ccb6 Sema: implement comptime error return traces 2024-01-22 18:08:56 -08:00
ndbn
9e684e8d1a
Fix wrong if condition for windows (#18637)
Fixes #18594
2024-01-22 15:32:23 -05:00
Tristan Ross
d0da3d731e std.io: replace readStructBig with readStructEndian 2024-01-22 10:53:27 -08:00
Veikka Tuominen
2e7d28dd0d Sema: replace uses of toUnsignedInt with toUnsignedIntAdvanced
During semantic analysis the value may be an unresolved lazy value
which makes using `toUnsignedInt` invalid.

Add assertions to detect similar issues in the future.

Closes #18624
2024-01-20 12:21:05 -08:00
Andrew Kelley
10aff67502
Merge pull request #18596 from ypsvlq/mingw
mingw-w64: add missing CRT sources
2024-01-20 12:01:33 -08:00
David Rubin
1b8f7e46fa
AstGen: detect duplicate field names
This logic was previously in Sema, which was unnecessary complexity, and meant the issue was not detected unless the declaration was semantically analyzed. This commit finishes the work which 941090d started.

Resolves: #17916
2024-01-20 17:23:47 +00:00
Andrew Kelley
5c4cb60f4f
Merge pull request #18622 from ziglang/zig-mod-edge-case
build system: better handle modules that do not have a zig root source file
2024-01-20 03:22:02 -08:00
Xavier Bouchoux
1a98fcd00a zig cc: expose clang precompiled C header support
see https://releases.llvm.org/17.0.1/tools/clang/docs/UsersManual.html#generating-a-pch-file

syntax examples:
`zig cc -x c-header test.h -o test.pch`
`zig cc -include-pch test.pch main.c`

`zig c++ -x c++-header test.h -o test.pch`
`zig c++ -include-pch test.pch main.cpp`
2024-01-19 22:05:09 -08:00
Andrew Kelley
29cce62a25 CLI: introduce -M; deprecate --mod
I changed my mind on how the CLI for Zig modules should work. I don't
like that `--mod` takes 2 parameters. Instead let's swing all the way in
the other direction: `-M[name][=src]`

This is shorter (Zig CLI invocations are long enough already), avoids
the double parameter edge case, and supports the concept of omitting the
source file part of the argument, which was already wanted for `-Mstd`.
The legacy way to encode that was `--mod std ''` - awkward!

Undocumented support for `--mod` remains so that this branch does not
need a zig1.wasm update. The next time that file is updated, support for
`--mod` can be dropped.

Importantly, this commit also adds support for modules that do not have
a root zig source file. In such case, it sets root to cwd and
root_src_path to empty string, and only sets have_zcu to true if a
module is provided with a root zig source file.
2024-01-19 22:26:13 -07:00
Andrew Kelley
41eff5723d Compilation: avoid caching root source file twice
The deleted lines here are redundant because they happen first thing
inside the function call below.

Additionally, skip hashing the root source file if it is an empty
string. I explored making this field along with `root` optional but
found this to be less messy actually.
2024-01-19 22:18:04 -07:00
Elaine Gibson
398ab5fcfb mingw: update build logic 2024-01-20 00:24:39 +00:00
Meghan Denny
46d592e485 do not enforce function parameters to be marked comptime if only called at comptime 2024-01-19 15:31:18 -08:00
David Rubin
100efcf8d3
return optional state to zirPtrCastNoDest 2024-01-19 21:25:05 +02:00
Emil Tywoniak
b80cad2484 libcxx: fix C++ builds with glibc <2.16 without aligned_alloc 2024-01-18 21:37:41 -08:00
Andrew Kelley
6ecf3b1ef3
Merge pull request #18599 from dweiller/err-union-switch-err-trace
astgen: fix error return trace on error union switch
2024-01-18 18:32:52 -08:00
Krzysztof Wolicki
14efbbfd89
std.Uri: change specifier for printing with scheme to semicolon ;
Fetch: print scheme when suggesting adding a ref to git URIs
2024-01-18 09:13:04 +02:00
David Rubin
6e5bdb5397
add type check to zirSwitchBlockErrUnion 2024-01-18 00:46:00 +00:00
dweiller
7ef3d3876a astgen: fix error return trace on error union switch 2024-01-18 04:47:31 +11:00
Techatrix
ec358d6db5 sema: fix safe integer arithmetic operations on undefined values
Previously `@as(i64, undefined) +% 1` would produce `@as(@TypeOf(undefined), undefined)` which now gives `@as(i64, undefined)`.
Previously `@as(i64, undefined) +| 1` would hit an assertion which now gives `@as(i64, undefined)`.
2024-01-16 16:27:31 -08:00
ocrap7
1ce12db5c8 Skip all dbg instructions 2024-01-16 15:01:42 -08:00
travisstaloch
f3353708d8
AstGen: use correct token_src for switch, if and while exprs
fixes #18579
2024-01-16 18:22:44 +02:00
february cozzocrea
da506aaf6e
translate-c: Explicit cast bool from float fix 2024-01-16 18:12:05 +02:00
february cozzocrea
50457482b1
translate-c: Fix for compound assign implicit cast error 2024-01-16 17:57:31 +02:00
Andrew Kelley
fe870418b1
Merge pull request #18584 from Techatrix/fix-switch-on-err
fix ast gen failure to catch incorrect by ref error captures
2024-01-16 02:42:06 -08:00
Andrew Kelley
d1ce8b8837
Merge pull request #18168 from cipharius/feature/zig-build-fossil-support
Adds support for Fossil SCM source tree archives as zig build dependencies
2024-01-15 23:02:50 -08:00
Andrew Kelley
ca8c6dd4d6
Merge pull request #18569 from dweiller/17944-followup
17944 followup
2024-01-15 22:59:33 -08:00
Techatrix
06410f58bd AstGen: properly handle ill-formed switch on error 2024-01-16 05:55:26 +01:00
Techatrix
8b9425c248 AstGen: add error message for capture error by ref in switch on error 2024-01-16 05:55:26 +01:00
cipharius
2e77956629 Accepts generic application/x-compressed in package fetch 2024-01-15 18:26:12 +02:00
dweiller
1861423862 sema: fix OOM bug when constructing error messages 2024-01-15 20:55:01 +11:00
Jacob Young
03ed3f56cf Sema: fix @extern decls
Closes #18550
2024-01-15 07:39:05 +01:00