25575 Commits

Author SHA1 Message Date
Jakub Konka
42e0850d78 macho: save indexes to all sections of interest 2023-08-29 11:39:35 +02:00
Jakub Konka
84853c5c56 macho: unify resolving globals 2023-08-29 11:39:35 +02:00
Jakub Konka
7f6973fbae macho: unify segment handling 2023-08-29 11:39:35 +02:00
Jakub Konka
d17867939e macho: unify writeLinkeditSegmentData func 2023-08-29 11:39:35 +02:00
Jakub Konka
7f74b3562d macho: unify creating atoms 2023-08-29 11:39:35 +02:00
Jakub Konka
ef0d35e00c macho: unify allocating special symbols 2023-08-29 11:39:35 +02:00
Jakub Konka
664b983518 macho: unify writeSegmentHeaders func 2023-08-29 11:39:35 +02:00
Jakub Konka
b2773cd712 macho: move initSection into MachO from Zld 2023-08-29 11:39:34 +02:00
Jakub Konka
180979ee41 macho: move getOutputSection into Atom 2023-08-29 11:39:34 +02:00
Jakub Konka
f29d9ec61c macho: unify entry point handling 2023-08-29 11:39:34 +02:00
Jakub Konka
b2af2dc8b7 macho: move symbol resolver into zld driver's state 2023-08-29 11:39:34 +02:00
Jakub Konka
19afd794d0 macho: remove dead code 2023-08-29 11:39:34 +02:00
Jakub Konka
e54f286c3b macho: assert every global is extern in incremental context 2023-08-29 11:39:34 +02:00
Jakub Konka
e9ad9e04c9 macho: collect bind data by scanning atoms directly in objects 2023-08-29 11:39:34 +02:00
Jakub Konka
7c11355556 macho: collect rebase data by scanning atoms directly in objects 2023-08-29 11:39:34 +02:00
Jakub Konka
bf5c35145d macho: remove dead code 2023-08-29 11:39:34 +02:00
Jakub Konka
4b934b1f78 macho: use TableSection for stub entries in zld driver
Write thunks separately from other atoms - this can still be improved
by not using atoms at all, but one thing at a time.
2023-08-29 11:39:34 +02:00
Jakub Konka
ee02517bce macho: remove obsolete function createDyldStubBinderGotAtom 2023-08-29 11:39:34 +02:00
Jakub Konka
5750620715 macho: use TableSection for TLV pointer entries in zld driver 2023-08-29 11:39:34 +02:00
Jakub Konka
04e93dd265 macho: use TableSection for GOT entries in zld driver 2023-08-29 11:39:34 +02:00
Jakub Konka
837114f019 macho: change dyld_private_sym_index to dyld_private_atom_index in zld 2023-08-29 11:39:34 +02:00
Jakub Konka
da9e7e498a macho: unify Atom concept between drivers 2023-08-29 11:39:34 +02:00
Jakub Konka
85f2df5050 macho: unify more of the linker state 2023-08-29 11:39:34 +02:00
Jakub Konka
e1e0ccb0c7 macho: unify Section concept across drivers 2023-08-29 11:39:34 +02:00
Jakub Konka
05c9d6c00b macho: add simple error reporting for misc errors 2023-08-29 11:39:34 +02:00
Jakub Konka
7b282dffe6 macho: unify concept of SymbolWithLoc across drivers 2023-08-29 11:39:34 +02:00
Jakub Konka
702bcfecf5 macho: simplify input file parsing for both drivers 2023-08-29 11:39:34 +02:00
Jakub Konka
69193a4ae4 macho: remove page_size field as it can be computed when and where required 2023-08-29 11:39:34 +02:00
Jakub Konka
e6891b2422 macho: remove dead code 2023-08-29 11:39:34 +02:00
Jakub Konka
3b2b9fcbc5 darwin: move inference of SDK version into the linker
`std.zig.system.darwin.getSdk` now pulls only the SDK path
so we execute a child process only once and not twice as it was
until now since we parse the SDK version directly from the pulled path.
This is actually how `ld64` does it too.
2023-08-29 06:43:41 +02:00
Jacob Young
c429bb5d2f llvm/cbe: support slice in @prefetch
Closes #16967
2023-08-28 19:04:53 -07:00
Jay Petacat
26b03ca823 std: Move TailQueue alias to correct namespace
This fixes a mistake in PR #16996.
2023-08-28 17:41:37 -07:00
mlugg
b8e6c42688 compiler: provide result type for @memset value
Resolves: #16986
2023-08-28 12:33:36 -07:00
mlugg
8d036d1d78 Sema: allow cast builtins on vectors
The following cast builtins did not previously work on vectors, and have
been made to:

* `@floatCast`
* `@ptrFromInt`
* `@intFromPtr`
* `@floatFromInt`
* `@intFromFloat`
* `@intFromBool`

Resolves: #16267
2023-08-28 12:32:02 -07:00
Jacob Young
c6024691cf Sema: implement reference trace with called from here notes
Closes #15124
2023-08-28 12:28:25 -07:00
Jay Petacat
ff61c42879 std: Rename TailQueue to DoublyLinkedList
`TailQueue` was implemented as a doubly-linked list, but named after an
abstract data type. This was inconsistent with `SinglyLinkedList`, which
can be used to implement an abstract data type, but is still named after
the implementation. Renaming `TailQueue` to `DoublyLinkedList` improves
consistency between the two type names, and should help discoverability.

`TailQueue` is now a deprecated alias of `DoublyLinkedList`.

Related to issues #1629 and #8233.
2023-08-27 20:57:46 -07:00
Jacob Young
750998eef6 Build: fail tests that log errors, like zig test does 2023-08-25 15:36:25 -07:00
xdBronch
4403008cab
fix compile errors introduced by #16953 (#16955) 2023-08-25 21:07:24 +00:00
Andrew Kelley
a31748b29e std.os.uefi: reorganize namespaces
This is a breaking change.

This commit applies the following rules to std.os.uefi:
* avoid redundant names in the namespace such as "protocol.FooProtocol"
* don't initialize struct field to undefined. do that at the
  initialization site if you want that, or create a named constant that
  sets all the fields to undefined.
* avoid the word "data", "info", "context", "state", "details", or
  "config" in the type name, especially if a word from that category is
  already in the type name.
* embrace tree structure

After following these rules, `usingnamespace` disappeared naturally.
This commit eliminates 26/53 (49%) instances of `usingnamespace` in the
standard library. All these uses were due to not understanding how
to properly use namespaces.

I did not test this commit. The standard library UEFI code is
experimental and pull requests have been accepted with minimal vetting.
Users of std.os.uefi will need to submit follow-up pull requests to fix
up whatever regressions this commit introduces, this time without
abusing namespaces (pun intended).
2023-08-24 22:38:47 -07:00
Luuk de Gram
dd6a9caeaf
Merge pull request #16899 from riverbl/wasm-div
Implement `@mod` and fix bugs with `divFloor` for wasm
2023-08-24 11:55:45 +02:00
matu3ba
7a834e2581
std.windows: use atomic rename, if possible (#16717)
Mitigates #14978.

Uses the same strategy as in #16499 suggested by @squeek502
2023-08-23 20:11:01 -04:00
riverbl
87557b37c6 Replace @panic with unreachable, add test
Replace `@panic` with `unreachable` in stage2 wasm `@divFloor` implementation

Add test for division and remainder operations for stage2 wasm
2023-08-23 20:34:59 +01:00
riverbl
383e6ffc7b Implement @mod and fix bugs with divFloor for wasm
Implement lowering code for `@mod` on integers in the stage2 wasm backend

Fix invalid wasm being produced for `@divFloor` on signed integers by the stage2 wasm backend
2023-08-23 16:52:30 +01:00
Andrew Kelley
6780a6bbfa wasm backend: delete dead code in lowerConstant 2023-08-22 19:02:58 -07:00
Andrew Kelley
ada0010471 compiler: move unions into InternPool
There are a couple concepts here worth understanding:

Key.UnionType - This type is available *before* resolving the union's
fields. The enum tag type, number of fields, and field names, field
types, and field alignments are not available with this.

InternPool.UnionType - This one can be obtained from the above type with
`InternPool.loadUnionType` which asserts that the union's enum tag type
has been resolved. This one has all the information available.

Additionally:

* ZIR: Turn an unused bit into `any_aligned_fields` flag to help
  semantic analysis know whether a union has explicit alignment on any
  fields (usually not).
* Sema: delete `resolveTypeRequiresComptime` which had the same type
  signature and near-duplicate logic to `typeRequiresComptime`.
  - Make opaque types not report comptime-only (this was inconsistent
    between the two implementations of this function).
* Implement accepted proposal #12556 which is a breaking change.
2023-08-22 13:54:14 -07:00
mlugg
6a5463951f Sema: disallow C pointer to slice coercion
Resolves: #16719
2023-08-21 11:31:22 -07:00
mlugg
82c8e45a7e Sema: check @memset operand provides length
Resolves: #16698
2023-08-21 11:30:20 -07:00
Carl Åstholm
60fc18bd1c compiler_rt: fix f80 comparisons
This corrects comparisons between negative numbers.
2023-08-21 11:26:25 -07:00
Gregory Mullen
f74e10cd47 Update default stack frames for general_purpose_allocator.zig
Created from a conversation with  @andrewrk on irc: Memory leaks when using ArrayList can be inconvenient to debug when the stack frame size is 4 because the entirety of the printed frame is within zig stdlib, and not in the users calling stack. Increasing this to 6 for Debug builds, gives 2 frames of user code. I increased the frame size for tests as well by the equivalent factor, but I'm unconvinced that's actually desirable.
2023-08-21 11:22:22 -07:00
Jakub Konka
8e96be0088
Merge pull request #16888 from ziglang/macho-frameworks
compiler: resolve framework paths in the frontend
2023-08-21 11:01:11 +02:00