Jacob Young
6e0de1d116
InternPool: port most of value tags
2023-06-10 20:47:54 -07:00
Andrew Kelley
88dbd62bcb
stage2: move enum tag values into the InternPool
...
I'm seeing a new assertion trip: the call to `enumTagFieldIndex` in the
implementation of `@Type` is attempting to query the field index of an
union's enum tag, but the type of the enum tag value provided is not the
same as the union's tag type. Most likely this is a problem with type
coercion, since values are now typed.
Another problem is that I added some hacks in std.builtin because I
didn't see any convenient way to access them from Sema. That should
definitely be cleaned up before merging this branch.
2023-06-10 20:46:17 -07:00
Andrew Kelley
275652f620
stage2: move opaque types to InternPool
2023-06-10 20:42:30 -07:00
Andrew Kelley
9aec2758cc
stage2: start the InternPool transition
...
Instead of doing everything at once which is a hopelessly large task,
this introduces a piecemeal transition that can be done in small
increments at a time.
This is a minimal changeset that keeps the compiler compiling. It only
uses the InternPool for a small set of types.
Behavior tests are not passing.
Air.Inst.Ref and Zir.Inst.Ref are separated into different enums but
compile-time verified to have the same fields in the same order.
The large set of changes is mainly to deal with the fact that most Type
and Value methods now require a Module to be passed in, so that the
InternPool object can be accessed.
2023-06-10 20:40:03 -07:00
Jacob Young
3b1ea390a3
x86_64: cleanup lazy symbols
...
In theory fixes updating lazy symbols during incremental compilation.
2023-05-01 19:22:53 -04:00
Jakub Konka
565f8979cc
link: fix accessing source atom's symbol index in codegen
...
Since the owner can either be a `Decl` or a `LazySymbol` we need
to preserve this information at the codegen generate function level
so that we can then correctly work out the corresponding `Atom`
in the linker.
2023-05-01 19:22:52 -04:00
Jacob Young
47a34d038d
x86_64: implement tagName
2023-05-01 19:22:52 -04:00
Jacob Young
372bc960b8
link: update decl-specific lazy symbols
2023-05-01 19:22:52 -04:00
Jacob Young
f37ca3fa73
link: cleanup lazy alignment
...
This gets the alignment from the code that creates a lazy symbol instead
of guessing it at every use.
2023-05-01 19:22:52 -04:00
Andrew Kelley
42973d73e6
compiler: use @memcpy instead of std.mem.copy
2023-04-28 13:24:43 -07:00
Andrew Kelley
6261c13731
update codebase to use @memset and @memcpy
2023-04-28 13:24:43 -07:00
Jakub Konka
bc69d5a00f
macho: invalidate GOT/stub relocs after segment shift in memory
2023-04-26 19:08:38 -04:00
Jakub Konka
14dfbbc213
macho: rebase lazy pointers and apply corrected base offset
2023-04-21 22:44:28 +02:00
Jakub Konka
9a181f367d
macho: mark relocs dirty by target when updating GOT/stubs
2023-04-21 22:44:28 +02:00
Jakub Konka
d6e66cff12
macho: fix dirtying of GOT entries
2023-04-21 22:44:28 +02:00
Jakub Konka
f9e9974c8f
macho: skip GOT for TLVs; handle them separately when lowering
2023-04-21 22:44:27 +02:00
Jakub Konka
9530b95afe
macho: refactor common codepath for collecting bindings from TableSection
2023-04-21 22:44:27 +02:00
Jakub Konka
cec4755310
macho: do not allocate atom for __stub_helper preamble
2023-04-21 22:44:27 +02:00
Jakub Konka
fa40267b04
macho: do not allocate atoms for stub entries
2023-04-21 22:44:27 +02:00
Jakub Konka
c55e821df6
macho: resolve relocs before writing to memory (fixes HCS)
2023-04-21 22:44:27 +02:00
Jakub Konka
91bb9302e5
macho: correctly dirty the GOT table after memory realloc
2023-04-21 22:44:27 +02:00
Jakub Konka
c6e916d7fe
macho: fix runtime panics
2023-04-21 22:44:27 +02:00
Jakub Konka
711bc2cf39
macho: use generic TableSection for GOT mgmt
2023-04-21 22:44:27 +02:00
Jakub Konka
1f6165f621
macho: reference TLV thunks via GOT table
2023-04-13 11:47:51 +02:00
Jakub Konka
094ff60252
macho: emit TLV pointers and variables
2023-04-13 11:47:51 +02:00
Jakub Konka
09b6bd86de
macho: cleanup dirtying and writing GOT atoms
2023-04-13 11:47:51 +02:00
Jakub Konka
57f9304275
macho: improve reporting of missing symbols
...
Fix a typo in TLV bootstrap symbol: __tlv_bootstrap.
2023-04-13 11:47:51 +02:00
Jakub Konka
ef645ab175
macho: refactor common logic between synthetic tables
2023-04-13 11:47:51 +02:00
Jakub Konka
38ecaf3ab6
macho: add machinery for emitting TLV refs
2023-04-13 11:47:51 +02:00
Jakub Konka
eba280ce20
macho: refactor relocation type in incremental linker
2023-04-13 11:47:51 +02:00
Jakub Konka
1795b8eb4e
macho: emit TLS sections
2023-04-13 11:47:51 +02:00
Jakub Konka
5154ece8b9
macho: fix incorrect DWARF subprogram generation
2023-04-13 11:47:50 +02:00
Jakub Konka
a503724801
macho: reapply relocation dirtying logic from coff linker
2023-04-05 05:57:09 +02:00
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
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
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
Jacob Young
677427bc3a
x86_64: implement error name
2023-04-02 04:49:53 -04:00
Jakub Konka
f2587de4e9
macho: look for entry in archives/dylibs too
2023-04-01 14:22:44 +02:00
Jakub Konka
17ec2cea64
macho: remove error_union return from resolveRelocations()
2023-03-28 21:52:44 +02:00
Jakub Konka
0dc210f950
link: pass expected lib name as hint in getGlobalSymbol()
2023-03-28 12:28:48 +02:00
Jakub Konka
8bffe87e9e
macho: collect all exports into the export trie
2023-03-21 21:31:24 +01:00
Jakub Konka
6874b29308
macho: fix 32bit build
2023-03-19 17:13:38 +01:00
Jakub Konka
f026939a40
macho: enable hot update state only when on compatible host
2023-03-19 09:45:05 +01:00
Jakub Konka
0aab3bda12
macho: add wrappers for attaching/detaching from HCS process
2023-03-18 21:53:46 +01:00
Jakub Konka
37192bcdcb
macos: HCS PoC working
2023-03-18 21:53:36 +01:00
Jakub Konka
f1e25cf43e
macho: add hot-code swapping poc
2023-03-18 21:53:26 +01:00
Jakub Konka
46171bf6c8
macho+zld: clean up how to interface with link.zig and openPath()
2023-03-18 19:05:06 +01:00
Jakub Konka
76afdd0586
link: move macOS kernel inode cache invalidation to MachO linker
2023-03-16 17:30:25 +01:00
Jakub Konka
c746cbc686
codegen: move gen logic for typed values, consts and decl ref to common codegen
2023-03-03 18:06:25 +01:00