1336 Commits

Author SHA1 Message Date
Jacob G-W
5aef54cbc8 additional fixes for Plan9
with this, the tests should pass
2022-10-24 17:01:26 -04:00
Jacob G-W
6cba18fe60 Add relocations to the plan9 backend 2022-10-24 16:53:12 -04:00
Jacob G-W
5cf3d10e35 Plan9: deal with unnamed decls
Hello World works again!
2022-10-24 16:53:12 -04:00
Jakub Konka
828735ac03 macho: handle majority of DW_FORM_ values for DWARF4 in the linker 2022-10-23 21:53:36 +02:00
Jakub Konka
2f37278540 macho: temp hash buffer has to live as long as pread error resolution 2022-10-23 10:15:42 +02:00
Jakub Konka
1bbafbc65f macho: increment temp buffer when calculating hashes 2022-10-23 09:58:47 +02:00
Andrew Kelley
4a2f1e748e link.MachO: multi-thread first round of sha256 hashing
when computing the adhoc code signature
2022-10-22 16:03:59 -07:00
Jakub Konka
593b75b109 macho: some docs 2022-10-22 14:53:53 +02:00
Jakub Konka
086cee844a macho: refactor dead code stripping conditions
1. If an object file was not compiled with `MH_SUBSECTIONS_VIA_SYMBOLS`
   such a hand-written ASM on x86_64, treat the entire object file as
   not suitable for dead code stripping aka a GC root.
2. If there are non-extern relocs within a section, treat the entire
   section as a root, at least temporarily until we work out the exact
   conditions for marking the atoms live.
2022-10-22 07:59:24 +02:00
Jakub Konka
0cc4d54781 macho: do not skip over SUBTRACTOR reloc when dead stripping 2022-10-22 07:59:24 +02:00
Jakub Konka
f8cbe29a17 macho: fix incorrect lookup of symbols when calculating subtractors 2022-10-22 07:59:24 +02:00
Jakub Konka
93cc5496e1 macho: rewrite movq to leaq when TLV is not external pointer 2022-10-22 07:59:24 +02:00
Jakub Konka
5823f19c5e macho: gracefully handle uninitialized symtabs in objects 2022-10-22 07:59:24 +02:00
Jakub Konka
2c2ff4558f macho: fix handling of lack of subsections and tracking of inner symbols 2022-10-22 07:59:24 +02:00
Jakub Konka
5edb8e0b8f macho: relax SUBTRACTOR assumption it not being a defined global 2022-10-22 07:59:23 +02:00
Jakub Konka
bc1e714de6 macho: revert changes to file descriptors mgmt 2022-10-22 07:59:23 +02:00
Jakub Konka
15f1e6a60c macho: fix silly error where we would incorrectly skip a valid binding 2022-10-22 07:59:23 +02:00
Jakub Konka
c15e03ac79 macho: fix bug in incorrectly splicing nodes in trie 2022-10-22 07:59:23 +02:00
Jakub Konka
5b9eaf2938 macho: do not assume __la_symbol_ptr was created 2022-10-22 07:59:23 +02:00
Jakub Konka
33d1942f27 macho: always create __TEXT segment 2022-10-22 07:59:23 +02:00
Jakub Konka
e70adc7f1a macho: skip parsing __eh_frame until we know how to handle it 2022-10-22 07:59:23 +02:00
Jakub Konka
baceaf65f2 macho: fix incorrectly erroring out with multiple sym definition 2022-10-22 07:59:23 +02:00
Jakub Konka
a32bc0e39c macho: fix 32bit build 2022-10-22 07:59:23 +02:00
Jakub Konka
04a590a171 macho: remove unused nlist flags 2022-10-22 07:59:23 +02:00
Jakub Konka
d57639a308 macho: upstream rewritten traditional linker, zld
kubkon/zld gitrev 5733ed87abe2f07e1330c3232a252e9defec638a
2022-10-22 07:59:23 +02:00
Andrew Kelley
a4eb221b9e link/MachO: avoid depending on host PATH_MAX
closes #13229

Restores ability to compile zig for WASI
2022-10-19 12:20:42 -07:00
Andrew Kelley
caddbbc315 build: avoid compiling self-hosted twice
build.zig: add a 'compile' step to compile the self-hosted compiler
without installing it.
Compilation: set cache mode to whole when using the LLVM backend and
--enable-cache is passed.

This makes `zig build` act the same as it does with stage1. Upside is
that a second invocation of `zig build` on an unmodified source tree
will avoid redoing the compilation again. Downside is that it will
proliferate more garbage in the project-local cache (same as stage1).

This can eventually be fixed when Zig's incremental compilation is more
robust; we can go back to having LLVM use CacheMode.incremental and rely
on it detecting no changes and avoiding doing the flush() step.
2022-10-18 16:52:43 -07:00
Ali Chraghi
ca27055cda all: rename @maximum to @max and @minimum to @min 2022-10-18 14:15:16 +03:00
Guillaume Wenzek
aad983cf40 sanitize qualified name for nvptx backend 2022-10-15 10:39:19 -07:00
Guillaume Wenzek
92a857b76c debug 2022-10-15 10:39:19 -07:00
Guillaume Wenzek
004fca2c64 restore comp when leaving flushModule 2022-10-15 10:39:19 -07:00
Luuk de Gram
7f508480f4 wasm-linker: convert relocation addend to i32
Addends in relocations are signed integers as theoretically it could
be a negative number. As Atom's offsets are relative to their parent
section, the relocation value should still result in a postive number.
For this reason, the final result is stored as an unsigned integer.

Also, rather than using `null` for relocations that do not support
addends. We set the value to 0 for those that do not support addends,
and have to call `addendIsPresent` to determine if an addend exists
or not. This means each Relocation costs 4 bytes less than before,
saving memory while linking.
2022-10-08 17:23:13 +02:00
Luuk de Gram
3beef5a94f
CheckObjectStep: parsing and dumping producers 2022-10-08 09:43:40 +02:00
Luuk de Gram
43b55ea9f4
wasm-linker: generate 'producers' section
The `producers` section contains meta data of the binary and/or
object file. It *can* contain the source language, the tool it
was processed by, and/or the SDK that was used to produce the file.

For now, we always set the language and processed-by fields to Zig.
In the future we will parse linked object files to detect their
producers sections and append (if different) their language, SDK
and processed-by fields.
2022-10-08 09:43:35 +02:00
Jakub Konka
4474f8dd6e macho: cleanup how we collect dyld data in incremental linker 2022-09-18 15:13:45 +02:00
Jakub Konka
f4706c23e9 macho: fix after sync with master 2022-09-18 11:01:29 +02:00
Jakub Konka
372acb8350 macho: ensure we extend section size when updating last atom 2022-09-18 10:00:04 +02:00
Jakub Konka
275abf7c57 macho: fix overlapping segments in file offset 2022-09-18 10:00:04 +02:00
Jakub Konka
66942cbc1a macho: make sure both vmsize and filesize for segments match always 2022-09-18 10:00:04 +02:00
Jakub Konka
e35a16c7e0 macho: make sure both vmsize and filesize for segments match 2022-09-18 10:00:04 +02:00
Jakub Konka
7f7669a09e macho: fix building on 32bit targets 2022-09-18 10:00:04 +02:00
Jakub Konka
dc6480dba5 macho: allow for add and ldr when resolving GOT_LOAD_* relocs 2022-09-18 10:00:04 +02:00
Jakub Konka
618c7a3546 macho: add logic for expanding segments in memory 2022-09-18 10:00:04 +02:00
Jakub Konka
e601969244 macho: rewrite how we allocate space in incremental context 2022-09-18 10:00:04 +02:00
Jakub Konka
79ab46ec91 macho: start separating linking contexts 2022-09-18 10:00:04 +02:00
Jakub Konka
53bd7bd044 macho: move to incremental writes and global relocs for incremental 2022-09-18 10:00:04 +02:00
Jakub Konka
34f9360ea2 macho: do not call populateMissingMetadata in full link mode 2022-09-18 10:00:04 +02:00
Jakub Konka
e5da251635 macho: clean up use of section ids 2022-09-18 10:00:04 +02:00
Jakub Konka
05d0c42894 macho: move main driver loop for one-shot into standalone zld module 2022-09-18 10:00:03 +02:00
Jakub Konka
26af8d254a macho: separate in structure and logic incremental relocs and file relocs 2022-09-18 10:00:03 +02:00