14975 Commits

Author SHA1 Message Date
Jakub Konka
91c0552cfc macho: add routine for creating stubs in __stubs section 2021-08-24 00:03:51 +02:00
Jakub Konka
876071b50b macho: fix writing stubs (on x86_64 only) and lazy ptrs 2021-08-23 23:23:00 +02:00
Jakub Konka
9e7b2fb894 macho: add routine for creating lazy pointer for stub 2021-08-23 23:01:14 +02:00
Jakub Konka
799c5bb955 macho: add routine for creating a dynamic stub_helper atom
With this routine, we are now able to freely shift stub_helper
section in memory and in file since the VM addressing is now dynamically
dependent on the positioning of `__stub_helper` preamble and other
sections generated by the linker.
2021-08-23 22:12:04 +02:00
Jakub Konka
ea499203fe macho: incrementally write dyld_private and stub_helper atoms
By incrementally I mean using the incremental linker machinery
and concepts. Currently, lots of repetition but already highlighted
a potential problem with resolving relocations for symbols that
weren't seen yet but wanting to write the atom to file (before
seeing the relevant atoms).
2021-08-21 22:26:02 +02:00
Jakub Konka
d61d85abd2 macho: implement aarch64 prong of createStubHelperAtom 2021-08-21 18:55:15 +02:00
Jakub Konka
d63d8ae1c0 macho: create __stub_helper preamble atom
with relocations to `dyld_private` and `__dyld_stub_binder` symbols
making the routine properly dynamic (i.e., making it possible to call
the routine before VM allocation takes place).
2021-08-21 14:21:55 +02:00
Jakub Konka
2d10c52b3c macho: create an explicit symbol and atom for dyld entry in __data
This way, we will be able to refer to that atom dynamically via
relocations rather than requiring hardcoded addressing upfront.
2021-08-21 11:51:50 +02:00
Jakub Konka
792fd9c4a3 macho: extract logic for creating and tracking atoms into fn 2021-08-20 09:49:21 +02:00
Jakub Konka
153e231774 macho: track unresolved externs globally
this way we share state between incremental and traditional paths.
2021-08-20 09:12:26 +02:00
Jakub Konka
30247fbb6a macho: remove redundant writeStubHelperCommon codepath 2021-08-18 11:46:45 +02:00
Jakub Konka
8167456c58 macho: resolve undefs in incremental properly
Instead of assuming that every undef extern symbol comes from libSystem,
actually perform the check!
2021-08-18 00:17:03 +02:00
Jakub Konka
790633a2a0 macho: use common codepath for resolving dyld_stub_binder 2021-08-17 22:10:07 +02:00
Jakub Konka
8b795fe2ac macho: parse input files and libs in incremental
This converges parsing of linker line in incremental; however,
still doesn't save the parsing state between updates.
2021-08-17 19:49:17 +02:00
Jakub Konka
69f4281774 macho: memorize if dyld_stub_binder was already resolved 2021-08-17 18:33:41 +02:00
Jakub Konka
c6ea181e75 macho: dedup setting entry point logic 2021-08-17 10:54:10 +02:00
Jakub Konka
52f9b283a7 macho: fix writeSymbolTable() function
After merging `populateMetadata` with `populateMissingMetadata`,
it is imperative we clear the number of symbols in `writeSymbolTable`.
However, this is hopefully just a temp measure until the convergence
of incremental with traditional is complete.
2021-08-16 19:58:05 +02:00
Jakub Konka
a51edc978f macho: converge populateMetadata with populateMissingMetadata 2021-08-16 19:15:04 +02:00
Jakub Konka
4c90c1ff63 Merge remote-tracking branch 'origin/master' into zld-incr 2021-08-16 15:24:20 +02:00
Jakub Konka
4c9d41730e
Merge pull request #9568 from ziglang/issue-9565
macho: don't embed codesig unless targeting aarch64-macos
2021-08-16 10:17:54 +02:00
Jakub Konka
e2303840de Fix AST and build errors 2021-08-15 23:50:39 +02:00
Jakub Konka
d5f7963331 macho: adhoc code sign binaries targeting aarch64-xxx-simulator 2021-08-15 18:29:19 +02:00
Jakub Konka
f82c26eb04 macho: don't embed codesig unless targeting aarch64-macos
When developing an iOS app for example, the developer is required
to use Apple's codesign utility to generate a valid signature
as done by Xcode.
2021-08-15 18:07:30 +02:00
Jakub Konka
b20b6d7da9 macho: move bit adding rpaths to common codepath 2021-08-14 22:18:18 +02:00
Jakub Konka
819ef52104 macho: merge linkWithZld with flush 2021-08-14 21:56:41 +02:00
Veikka Tuominen
e9bf8014bd
Merge pull request #9559 from squeek502/walker-basename
fs.Dir.Walker: Fix basename missing its first character for direct children of the initial directory
2021-08-14 11:08:10 +03:00
Meghan
fcf2ce0ffe std.fmt: add name of type in unsupport format string compile error 2021-08-14 11:07:01 +03:00
Thom Chiovoloni
c2635f9b02
Fix darwin ulock usage on macOS (#9545)
* Fix darwin ulock usage on macOS

* Fix review comments, and correctly handle timeout overflow on darwin

* Apply more review suggestions
2021-08-13 22:43:42 -05:00
Ayende Rahien
65208a7fa2
Expose register_eventfd, register_eventfd_async, unregister_eventfd i… (#9449)
* Expose register_eventfd, register_eventfd_async, unregister_eventfd in the IO URing API

* Fixing formatting

* Fixing typo

* Removing unnecessary casts and adding better comments for a single registration of eventfd

* Update lib/std/os/linux/io_uring.zig

Co-authored-by: Joran Dirk Greef <joran@coil.com>

* Update lib/std/os/linux/io_uring.zig

Co-authored-by: Joran Dirk Greef <joran@coil.com>

* Updating util function name

Co-authored-by: Joran Dirk Greef <joran@coil.com>
2021-08-13 22:41:18 -05:00
Ryan Liptak
f6bb56f8c7 Improve fs.Walker test
- Take into account that iteration order is undefined by checking against a map instead of relying on numerically sorted iteration order
- Check both path and basename for each entry instead of just path
2021-08-13 16:43:52 -07:00
Ryan Liptak
7e07df06a4 ComptimeStringMap: expose kvs array in returned struct
Allows for iterating over the kvs when constructing with a list literal instead of having to create a separate array to pass into ComptimeStringMap in order to maintain access to the values.

For example when making a set, before in order to loop over the kvs you'd have to do something like:

    const MyKV = struct { @"0": []const u8 };
    const kvs: []const MyKV = &[_]MyKV{ .{ @"0" = "foo"}, .{ @"0" = "bar" } };
    const map = ComptimeStringMap(void, kvs);
    for (kvs) |kv| {}

whereas now it's possible to do:

    const map = ComptimeStringMap(void, .{ .{"foo"}, .{"bar"} });
    for (map.kvs) |kv| {}
2021-08-13 16:22:56 -07:00
Ryan Liptak
8ff49966bc fs.Walker: Fix basename missing its first character for direct children of the initial directory
Closes #9557
2021-08-13 16:22:56 -07:00
Jakub Konka
1373df4c34
Merge pull request #9227 from mathetake/libc-wasi-test
WASI,libc: fix libstd with wasi-libc linkage, and enable tests.
2021-08-13 21:56:32 +02:00
Takeshi Yoneda
68617c9fb0 Add comment about compiletime check.
Signed-off-by: Takeshi Yoneda <takeshi@tetrate.io>
2021-08-13 21:54:18 +09:00
Takeshi Yoneda
ca4898c0f3 Use std.buuiltin instead of importing builtin
Signed-off-by: Takeshi Yoneda <takeshi@tetrate.io>
2021-08-13 21:49:52 +09:00
Jakub Konka
c53423f8aa macho: don't cache unused link options
This will change incrementally once we support more linker options.
2021-08-13 10:46:53 +02:00
Andrew Kelley
0961c1975a update_cpu_features tool: work around stage1 bug
This works around a stage1 compiler bug resulting in a segfault when
trying to use the tool.
2021-08-12 11:30:55 -07:00
Andrew Kelley
55c6a784a5 stage2 frontend improvements - @ptrCast and optionals
* AstGen: use coerced_ty ResultLoc on array types and rely on Sema
   doing type coercion, to reduce the size of the ZIR for these
   instructions.

 * Sema: implement `@ptrCast`.

 * Sema: implement coercion from `T` to `?T` with an intermediate
   coercion rather than equality check.
2021-08-12 10:48:54 -07:00
Andrew Kelley
fc55814faa compiler-rt: do not depend on usingnamespace
The idea is to depend on this language feature as little as possible
with the hopes that it can be adjusted to be less of an anti-pattern.
This also helps self-hosted, which does not yet implement
`usingnamespace`, get closer to being able to build compiler-rt.
2021-08-12 10:48:54 -07:00
Andrew Kelley
6eecc4af99 stage2 llvm backend: implement const inttoptr 2021-08-12 10:48:54 -07:00
Andrew Kelley
a0670e748e
Merge pull request #9166 from joachimschmidt557/stage2
stage2 Sema: Add error notes to unresolvable peer types
2021-08-12 13:22:27 -04:00
Jakub Konka
394d287778
Merge pull request #9535 from FnControlOption/128-bit-cmpxchg-test
Re-enable 128-bit cmpxchg test
2021-08-12 16:42:37 +02:00
Jakub Konka
f49aa960a9 macho: use ArrayHashMap.popOrNull where applicable 2021-08-12 10:20:57 +02:00
Jakub Konka
f01366e8b3 macho: exclude tentative def before checking for collision
when resolving global symbols.
2021-08-12 10:20:57 +02:00
Jakub Konka
35403d41ce macho: use array hashmaps for quick lookups
as containers for unresolved and tentative definitions when resolving
symbols.
2021-08-12 10:20:57 +02:00
Jakub Konka
da57d6df32 macho: simplify symbol management and resolution
instead of globally storing unresolved and tentative defs,
store indices to actual symbols in the functions that are responsible
for symbol resolution.
2021-08-12 10:20:57 +02:00
Ryan Liptak
493822ac3b Update mem.split/mem.tokenize doc comments
Follow up to #9531
2021-08-11 21:19:03 -04:00
Jakub Konka
0686954802
Merge pull request #9549 from ziglang/tapi-v3
macho: handle TAPI v3 and simplify handling of dependent dynamic libraries
2021-08-11 22:48:03 +02:00
Jakub Konka
5d548cc651 macho: move parsing logic for Object, Archive and Dylib into MachO
This way, the functionality is better segregated, and we finally do
not unnecessarily reparse dynamic libraries that were already visited
and parsed.
2021-08-11 19:38:00 +02:00
Jakub Konka
16bb5c05f1 macho: refactor stub parsing in Dylib 2021-08-11 19:38:00 +02:00