Commit Graph

23304 Commits

Author SHA1 Message Date
Jakub Konka f372995e1e macho: refactor adding GOT and stub entries
Don't special-case resolving of `dyld_stub_binder`.
2023-04-05 05:57:09 +02:00
Jakub Konka 5ea6e78943 Merge pull request #15162 from jacobly0/x86_64-start
x86_64: get enough things working to enable full `start.zig` logic
2023-04-05 03:02:42 +02:00
Jacob Young 83b7dbe52f cases: disable failing incremental tests
Enabling start.zig logic breaks incremental compilation
See #15174
2023-04-04 12:48:21 -04:00
Jakub Konka 3a8362e751 macho+zld: refactor how we resolve dyld_stub_binder symbol 2023-04-04 15:44:01 +02:00
Ganesan Rajagopal 49b56f88b9 GPA: Catch invalid frees
* GPA: Catch invalid frees

Fix #14791: Catch cases where an invalid slice is passed to free().
This was silently ignored before but now logs an error. This change
uses a AutoHashMap to keep track of the sizes which seems to be an
overkill but seems like the easiest way to catch these errors.

* GPA: Add wrong alignment checks to free/resize

Implement @Inkryption's suggestion to catch free/resize with the wrong
alignment. I also changed the naming to match large allocations.
2023-04-04 13:11:25 +03:00
David CARLIER 771d07268f std: freebsd MAP* constants update, MAP_ALIGNED_SUPER and the MAP_ALIGNED macro. 2023-04-04 12:57:16 +03:00
Jacob Young c91929090d start: disable extra start logic on various x86_64 subtargets 2023-04-03 15:19:07 -04:00
Jacob Young 821eb595f4 x86_64: implement cmp_lt_errors_len 2023-04-03 15:19:07 -04:00
Jacob Young 9fd460821f elf: cleanup phdr tracking
Since one of the program header entries is now the program header table
itself, we can avoid tracking it explicitly and just track it as yet
another program segment.
2023-04-03 14:17:43 -04:00
Jakub Konka c0e9b84997 elf: preallocate offsets for PT_PHDR and PT_LOAD (empty) segment
Otherwise, we will be using `undefined` as the offset to allocate
remaining phdrs and shdrs.
2023-04-03 18:30:55 +02:00
Jacob Young 5900dc0580 x86_64: fix typos 2023-04-03 18:02:55 +02:00
Jacob Young 562170681a link: cleanup lazy symbols
We now only update one lazy symbol in flushModule.
Updating the rest from updateDecl is TBD.
2023-04-03 18:02:53 +02:00
Jacob Young f0d13489f8 Elf: add program headers for the program header table 2023-04-03 17:45:17 +02:00
Jacob Young cd24ab7f6e x86_64: canonicalise loops 2023-04-03 17:45:16 +02:00
Jacob Young fde1ec5d0e x86_64: remove returns from naked functions 2023-04-03 17:45:16 +02:00
Jacob Young 1980f5479b x86_64: implement store to immediate address 2023-04-03 17:45:16 +02:00
Jacob Young 272acb7ee5 x86_64: implement storing large immediates 2023-04-03 17:45:16 +02:00
Jacob Young f5f0d95f0e x86_64: implement a more generic assembler for inline assembly 2023-04-03 17:45:16 +02:00
Jakub Konka a329450aa4 Merge pull request #15160 from ziglang/link-cleanup
link: misc clean ups
2023-04-03 12:53:39 +02:00
Jakub Konka 72137824e5 macho: clean up code responsible for growing sections in file 2023-04-03 10:07:49 +02:00
Jakub Konka ad8dfd3673 macho+coff: remove alignment from Atom as it is unused 2023-04-03 09:14:36 +02:00
Veikka Tuominen a31450375e Merge pull request #15134 from castholm/reverse-iterator
std.mem.reverseIterator: misc improvements
2023-04-02 18:06:55 +03:00
Jacob Young f4b411314c Sema: defer stores to inferred allocs
This lets us generate the store with knowledge of the type to be stored.
Therefore, we can avoid generating garbage Air with stores through
pointers to comptime-only types which backends cannot lower.

Closes #13410
Closes #15122
2023-04-02 18:05:44 +03:00
Jakub Konka 878163e588 Merge pull request #15140 from jacobly0/x86_64
x86_64: implement more stuff
2023-04-02 14:34:12 +02:00
Jacob Young f4359531b1 x86_64: implement shl with overflow 2023-04-02 06:11:12 -04:00
Jacob Young 0e289cc826 x86_64: implement large add/sub with overflow 2023-04-02 05:16:46 -04:00
Jacob Young c713c86389 x86_64: implement wide multiply 2023-04-02 04:49:53 -04:00
Jacob Young b80cdde4f0 x86_64: implement struct_field_val for large packed structs 2023-04-02 04:49:53 -04:00
Jacob Young 83a208c355 x86_64: implement large cmp 2023-04-02 04:49:53 -04:00
Jacob Young 677427bc3a x86_64: implement error name 2023-04-02 04:49:53 -04:00
Jacob Young ccefa9dbf5 x86_64: implement calling var args functions 2023-04-02 04:49:53 -04:00
Jacob Young ac68d72d24 x86_64: implement aggregate init of a packed struct 2023-04-02 04:49:53 -04:00
Jakub Konka 43a6384e9c link-test: adjust test/link/bugs/macho/13056 to latest changes on macOS 13.3
Latest macOS 13.3 rolled out LLVM 15 and thus the way `nullptr_t` is
defined within the `libc++`:

https://github.com/llvm/llvm-project/commit/157bbe6aea22e87c822f6cda3cd404b8f657dce4

This seems to require including `/usr/include` with `-isystem` directive
rather than `-I`. Otherwise we get clang miscompilation issues due to
missing `nullptr_t` declaration.
2023-04-02 10:18:43 +02:00
Jakub Konka ab44b454d0 Merge pull request #15135 from ziglang/fix-15103
macho: handle cases where entrypoint is in an archive or dylib
2023-04-01 22:30:22 +02:00
Jakub Konka e0bf7b6424 link-test: skip foreign checks in entry_in_archive MachO test 2023-04-01 20:02:33 +02:00
Jakub Konka a88c0b4d08 link: handle -u flag in all linkers
Also clean up parsing of linker args - reuse `ArgsIterator`.

In MachO, ensure we add every symbol marked with `-u` as undefined
before proceeding with symbol resolution. Additionally, ensure those
symbols are never garbage collected.

MachO entry_in_dylib test: pass `-u _my_main` when linking executable
so that it is not incorrectly garbage collected by the linker.
2023-04-01 14:22:44 +02:00
Jakub Konka 2dd178443a macho: do not assume entrypoint is defined 2023-04-01 14:22:44 +02:00
Jakub Konka 5d0bb50e3d link-test: add test for entry in a dynamic library for MachO 2023-04-01 14:22:44 +02:00
Jakub Konka 3874df839d link-test: add test for entry in a static archive for MachO 2023-04-01 14:22:44 +02:00
Jakub Konka 6f83a741d8 macho: handle weird case of entrypoint being a stub 2023-04-01 14:22:44 +02:00
Jakub Konka f2587de4e9 macho: look for entry in archives/dylibs too 2023-04-01 14:22:44 +02:00
Jakub Konka 381dc2d950 Merge pull request #15139 from ziglang/macos-13-fixes
Fixes for latest macOS 13.3 SDK release
2023-04-01 14:22:29 +02:00
Jakub Konka a0a854b1fc libc: update macOS libSystem.13.tbd 2023-04-01 08:33:13 +02:00
Jakub Konka ab2b70f6c1 tapi: update to latest Apple changes 2023-04-01 08:31:27 +02:00
Jakub Konka 9ea04f4f1c tapi: update yaml parser
https://github.com/kubkon/zig-yaml/commit/5de8b0b3a2cdb86f9a173118efa7e5e0747cca14
2023-04-01 08:31:16 +02:00
Jakub Konka 575a98a081 Merge pull request #15130 from ziglang/macos-13.3
macos: update to latest libc headers macOS SDK 13.3
2023-04-01 08:23:13 +02:00
Carl Åstholm 3cd72951c0 std.mem.reverseIterator: add nextPtr() 2023-03-31 22:50:31 +02:00
Carl Åstholm 0bbc1ec206 std.mem.reverseIterator: accept pointer to array 2023-03-31 22:48:32 +02:00
Jakub Konka f6845bbbc6 std: bump max macOS version to 13.3 2023-03-31 21:22:30 +02:00
Jakub Konka 26c88e4f45 libc: update macOS libc headers to latest SDK 13.3 2023-03-31 21:20:47 +02:00