28690 Commits

Author SHA1 Message Date
Jakub Konka
ee68f35bfe macho: fix section boundary symbols test 2024-01-24 12:34:39 +01:00
Jakub Konka
ee7a027059 macho: parse dependent dylibs 2024-01-24 12:34:39 +01:00
Jakub Konka
ef9aea75d0 macho: fix dead stripping logic to exclude debug sections 2024-01-24 12:34:39 +01:00
Jakub Konka
10a5536a7c macho: re-instate build-obj codepath 2024-01-24 12:34:39 +01:00
Jakub Konka
c2a0a88284 macho: report duplicate symbols 2024-01-24 12:34:39 +01:00
Jakub Konka
3968aea8ec macho: write to file 2024-01-24 12:34:39 +01:00
Jakub Konka
98d6d40cd6 macho: allocate sections, segments and atoms 2024-01-24 12:34:39 +01:00
Jakub Konka
32ebceea95 macho: sort sections; use Atom.Alignment for alignment; init segments 2024-01-24 12:34:39 +01:00
Jakub Konka
0b2231998f macho: init output and synthetic sections 2024-01-24 12:34:39 +01:00
Jakub Konka
f0119ce373 macho: report undefined symbols to the user 2024-01-24 12:34:39 +01:00
Jakub Konka
40e1bb11f8 macho: set dylib ordinals after pruning 2024-01-24 12:34:39 +01:00
Jakub Konka
eca9bc4c33 macho: dead strip dylibs 2024-01-24 12:34:39 +01:00
Jakub Konka
b28ff75f5d macho: mark imports and exports 2024-01-24 12:34:39 +01:00
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
92211135f1
Merge pull request #17155 from winterqt/ignore-nix-ldflags-linkage-directives
std.zig.system.NativePaths: ignore linkage directives in `NIX_LDFLAGS`
2024-01-24 00:01:23 -08: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
Krzysztof Wolicki
eff58d6c18 os.windows: Fix error 258 name in Win32Error 2024-01-23 18:06:23 -08:00
Andrew Kelley
f37513aa68 NativePaths: support -L and -l arguments in NIX_LDFLAGS
A slightly more robust parsing of these flags in case of a separate
argument appearing after "-L" in the flags.
2024-01-23 18:01:59 -07:00
Winter
6f3ee587ba std.zig.system.NativePaths: ignore linkage directives in NIX_LDFLAGS
`NIX_LDFLAGS` typically contains just `-rpath` and `-L`, which we already
handle. However, at least one setup hook in Nixpkgs [0] adds a linkage
directive to it. To prevent library paths from being missed (as I've
observed myself with `NIX_LDFLAGS` being `-liconv ...`, making it so that
*all* paths are missed), let's just skip over them.

[0]: 08f615eb1b/pkgs/development/libraries/libiconv/setup-hook.sh
2024-01-23 17:49:25 -07:00
mlugg
06d8bb32e3
InternPool: introduce TrackedInst
It is problematic for the cached `InternPool` state to directly
reference ZIR instruction indices, as these are not stable across
incremental updates. The existing ZIR mapping logic attempts to handle
this by iterating the existing Decl graph for a file after `AstGen` and
update ZIR indices on `Decl`s, struct types, etc. However, this is
unreliable due to generic instantiations, and relies on specialized
logic for everything which may refer to a ZIR instruction (e.g. a
struct's owner decl). I therefore determined that a prerequisite change
for incremental compilation would be to rework how we store these
indices.

This commit introduces a `TrackedInst` type which provides a stable
index (`TrackedInst.Index`) for a single ZIR instruction in the
compilation. The `InternPool` now stores these values in place of ZIR
instruction indices. This makes the ZIR mapping logic relatively
trivial: after `AstGen` completes, we simply iterate all `TrackedInst`
values and update those indices which have changed. In future, if the
corresponding ZIR instruction has been removed, we must also invalidate
any dependencies on this instruction to trigger any required
re-analysis, however the dependency system does not yet exist.
2024-01-23 21:19:53 +00:00
mlugg
ae845a33c0
Zir: represent declarations via an instruction
This commit changes how declarations (`const`, `fn`, `usingnamespace`,
etc) are represented in ZIR. Previously, these were represented in the
container type's extra data (e.g. as trailing data on a `struct_decl`).
However, this introduced the complexity of the ZIR mapping logic having
to also correlate some ZIR extra data indices. That isn't really a
problem today, but it's tricky for the introduction of `TrackedInst` in
the commit following this one. Instead, these type declarations now
simply contain a trailing list of ZIR indices to `declaration`
instructions, which directly encode all data related to the declaration
(including containing the declaration's body). Additionally, the ZIR for
`align` etc have been split out into their own bodies. This is not
strictly necessary, but it's much simpler to understand for an
insignificant cost in bytes, and will simplify the resolution of #131
(where we may need to evaluate the pointer type, including align etc,
without immediately evaluating the value body).
2024-01-23 19:16:47 +00:00
Khang Nguyen Duy
993a83081a std.fmt: fix unecessary deref on user-defined format function
When formatting a pointer to user type, currently it needs to be
dereferenced first, then call `formatType` on the child type.

Fix the problem by checking for "format" function on not only the type
itself, but also the struct it points to. Add hasMethod to std.meta.
2024-01-23 01:03:45 -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
Tristan Ross
c0e0bb385c std.process: return u64 in totalSystemMemory 2024-01-23 00:17:53 -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
Littleote
3331c5e7af Free threads in std.Thread.Pool.init only with pool.join
Free the allocated threads in the initialization of a thread pool only with pool.join instead of additionally calling allocator.free causing free to be called twice.

Resolves #18643
2024-01-22 11:24:35 -08:00
Tristan Ross
d0da3d731e std.io: replace readStructBig with readStructEndian 2024-01-22 10:53:27 -08:00
Andrew Kelley
b0c8a3f316
Merge pull request #18644 from ziglang/langref 2024-01-22 02:26:46 -08:00
Andrew Kelley
ce7c66e2d0 langref: make more consistent
* moves some langref into std.builtin doc comments
* use the same way of referencing stuff from std.builtin

closes #16483
2024-01-21 20:39:50 -07:00
Andrew Kelley
1b8e6b8ba9 langref: clean up the table of operators
* remove whitespace
* add column for name
* rename "description" to "remarks"
* clarify bit shift left and bit shift right

closes #17126
2024-01-21 20:31:13 -07:00
Andrew Kelley
f29217ae0c langref: reduce verbosity of string literal section 2024-01-21 20:31:13 -07:00
Andrew Kelley
9be831e15a langref: remove line numbers from code samples
It's unnecessary, more complicated, bloated, and it messes up the table
of operators.
2024-01-21 20:31:13 -07:00
Andrew Kelley
a054c01f5c Revert "langref: add section numbers"
This reverts commit 3542dbf0ea5bc1ddb1c5e1c856745dc07e6c0a18.

I don't like them
2024-01-21 20:31:13 -07:00