25661 Commits

Author SHA1 Message Date
Jakub Konka
9db472cff6 elf: set output section index of a global when resolving 2023-09-12 17:52:55 +02:00
Jakub Konka
472d326a8c elf: set output section index when parsing objects 2023-09-12 17:35:56 +02:00
Jakub Konka
44e84af874 elf: add simplistic reloc scanning mechanism 2023-09-12 16:32:55 +02:00
Jakub Konka
c654f3b0ee elf: claim unresolved dangling symbols that can be claimed 2023-09-12 15:44:16 +02:00
Jakub Konka
b478a0dd1a elf: mark imports-exports; populate symtab with objects 2023-09-12 15:14:38 +02:00
Jakub Konka
962b46148d elf: add simplistic symbol resolution 2023-09-12 14:36:55 +02:00
Jakub Konka
53c3757c00 elf: start fixing symbol resolution 2023-09-12 14:02:15 +02:00
Jakub Konka
00787885f4 elf: report undefined symbols in objects 2023-09-12 00:10:54 +02:00
Jakub Konka
67d458370d elf: add prelim impl of Object parsing 2023-09-11 22:49:42 +02:00
Jakub Konka
3df58a9583 elf: add basic error reporting for positional parsing 2023-09-11 16:32:58 +02:00
Jakub Konka
65b9597c07 elf: report undefined symbols as errors 2023-09-11 16:02:21 +02:00
Jakub Konka
7a9eba2f85 elf: emit relocation to an extern function 2023-09-11 10:52:30 +02:00
Jakub Konka
d07edfabd6 elf: simplify handling of relocs for atoms 2023-09-11 07:59:54 +02:00
Jakub Konka
4b082d89c9 elf: decouple notion of atom free list from shdrs
Not every section will have the need for such a free list.
2023-09-10 21:58:45 +02:00
Jakub Konka
a3ce011408 elf: allocate linker defined symbols 2023-09-10 11:10:16 +02:00
Jakub Konka
1c3fd16c37 elf: write linker-defined symbols to symtab 2023-09-10 09:10:00 +02:00
Jakub Konka
a455b5692a elf: create required linker-defined symbols 2023-09-10 08:41:13 +02:00
Jakub Konka
a6e9163284 elf: clean up naming and remove unused functions 2023-09-09 16:03:39 +02:00
Jakub Konka
a3372050b1 elf: rename program_headers to phdrs 2023-09-08 23:21:44 +02:00
Jakub Konka
465431807b elf: write $got symbols into the symtab 2023-09-08 22:53:53 +02:00
Jakub Konka
69738a07c2 elf: store Index rather than ?Index in Atom; gen ABS STT_FILE for zig source 2023-09-08 21:09:45 +02:00
Jakub Konka
6ad5db030c elf: store GOT index in symbol extra array; use GotSection for GOT 2023-09-08 18:12:53 +02:00
Jakub Konka
9691d1a30f elf: use zld's update mechanism for symtab for Zig module 2023-09-07 15:45:58 +02:00
Jakub Konka
37e2958f81 elf: write symbtab 2023-09-06 23:43:26 +02:00
Jakub Konka
a2b5a464e6 elf: set atom names 2023-09-06 15:12:43 +02:00
Jakub Konka
93120a81fe elf: lift-off - get it to compile and run until the error! 2023-09-06 14:42:32 +02:00
Jakub Konka
a9df098cd2 elf: make everything upside down - track by Symbol.Index rather than Atom.Index 2023-09-06 13:14:00 +02:00
Jakub Konka
d9fffd431a elf: start porting abstraction of input file 2023-09-05 15:55:00 +02:00
Jakub Konka
02451bdebf elf: atom.index of 0 reserved for null atom 2023-09-04 22:41:50 +02:00
Jakub Konka
7d396110d6 elf: remove dead code 2023-09-04 11:31:48 +02:00
Jakub Konka
bc37c95e56 elf: simplify accessors to symbols, atoms, etc 2023-09-04 11:23:19 +02:00
Jakub Konka
009a349779 elf: add global symbol resolver 2023-09-03 08:32:28 +02:00
Jakub Konka
e265dc61e6
Merge pull request #17057 from ziglang/elf-symtab
elf: write all symbols in bulk in flush
2023-09-03 07:52:17 +02:00
Jakub Konka
baea106b71 elf: mark dirty .symtab shdr after updating sh_info field 2023-09-02 23:00:39 +02:00
Josh Wolfe
8b74eae9c6
std.ArrayHashMap.reIndex also recomputes hashes (#17054) 2023-09-02 17:00:20 -04:00
Jakub Konka
cfc0429bc9 elf: correctly set symtab's sh_info to first global index 2023-09-02 22:12:49 +02:00
Jakub Konka
9bd60bef2a elf: write all symbols in bulk in flush
This avoids leaving undefined bytes in the output file in case
a decl has been garbage collected before it's been committed into
the binary.

This should have minimal impact on performance since we have to
write globals on every iteration anyway.
2023-09-02 21:49:33 +02:00
Jakub Konka
da56727e6a elf: write symbol names into .strtab rather than .shstrtab 2023-09-02 15:17:44 +02:00
Jakub Konka
cf3a6fe0f5 dwarf: fix copy-paste typo in variable lowering code for reg and stack 2023-09-02 09:40:12 +02:00
Michal Ziulek
bb2eb44430 std.coff: Fixed compile error. 2023-09-02 00:18:53 +02:00
Jakub Konka
5dc2db8055
Merge pull request #17029 from squeek502/wasi-statFile-libc
Fix `Dir.statFile` for WASI when linking libc
2023-09-01 10:13:04 +02:00
Jakub Konka
43b27d47c9
Merge pull request #17030 from ziglang/macho-libsystem
macho: improve logic for finding and reporting errors when searching for libSystem and dependencies
2023-09-01 08:00:12 +02:00
Ryan Liptak
01f9cdd21a Temporarily disable Dir.statFile test when linking glibc
See https://github.com/ziglang/zig/issues/17034
2023-08-31 18:01:15 -07:00
Jakub Konka
2187744411 macho: we actually care about stem and not basename for dependencies 2023-09-01 00:43:02 +02:00
Jakub Konka
611ddd426c macho: forgot to include dirname when resolving dependencies 2023-09-01 00:30:26 +02:00
Jakub Konka
21c04b119e macho: report missing libSystem/libc system libraries to the user 2023-08-31 23:47:55 +02:00
Ryan Liptak
f46008c1d8 Fix Dir.statFile for WASI when linking libc
`statFile` now only uses `os.fstatatWasi` when not linking libc, matching the pattern used throughout other `Dir` functions. This fixes the compilation error: `error: struct 'c.wasi.Stat' has no member named 'fromFilestat'` (which the added test would have failed with)
2023-08-31 14:07:15 -07:00
Jakub Konka
43adfd9689 macho: check if fallback libSystem.{d}.tbd exists in Zig's installation 2023-08-31 22:04:24 +02:00
Jakub Konka
f4c9e19bc3
Merge pull request #17020 from ziglang/macho-versions
macho: big-ish refactor and report errors to the user using Zig's API
2023-08-31 07:50:29 +02:00
Jacob Young
e2ff486de5 Sema: cleanup coerceExtra
* remove unreachable code
 * remove already handled cases
 * avoid `InternPool.getCoerced`
 * add some undef checks
 * error when converting undef int to float

Closes #16987
2023-08-30 16:50:30 -04:00