aboutsummaryrefslogtreecommitdiff
path: root/src/link
AgeCommit message (Collapse)Author
2023-12-05elf: re-instate basic error reporting for LD script parserJakub Konka
2023-12-05elf: move basic parse error reporting to SharedObjectJakub Konka
2023-12-05elf: do not write ELF header if there were errorsJakub Konka
2023-12-05elf: report error at the point where it is happeningJakub Konka
2023-12-03Coff: minor fixesJacob Young
* Update the msdos stub to be eight bytes smaller, which moves the machine PE header field into the first 128 bytes of the file, allowing it to be matched by a binfmt_misc magic sequence. This allows the build system to get the correct error during exec. * Fix library name memory leaks in Sema.
2023-11-29Remove all usages of `std.mem.copy` and remove `std.mem.set` (#18143)David Rubin
2023-11-28wasm-linker: support `--no-gc-sections`Luuk de Gram
By default we garbage-collect sections for Wasm to reduce size, as well as finish linking quicker (as we have fewer things to do). However, when the user specifies `--no-gc-sections` we ensure all resolved symbols get marked and therefore do not get garbage collected. This is supported in both incremental-mode and traditional linking.
2023-11-28wasm-linker: support gc for wasm backend codeLuuk de Gram
When using the Wasm backend, we will now also perform garbage collection there, to ensure unreferenced symbols do not get parsed nor emit into the final binary.
2023-11-28wasm-linker: handle debug info during gcLuuk de Gram
When we encounter a debug info symbol, we initially have to parse it into an atom to find its relocations. We then go through its relocations to find out if any of the target symbols are marked alive. When it finds an alive symbol, we also mark the debug symbol as alive to ensure this piece of debug info is emit to the binary. When it does not encounter any alive symbols, the debug symbol remains dead and will be garbage- collected during `allocateAtoms`.
2023-11-28wasm-linker: Only emit name of referenced symbolsLuuk de Gram
2023-11-28wasm-linker: deduplicate aliased functionsLuuk de Gram
When multiple symbols point to the same function, we ensure any other symbol other than the original will be discarded and point to the original instead. This prevents emitting the same function code more than once.
2023-11-28wasm-linker: parse symbols into atoms lazilyLuuk de Gram
Rather than parsing every symbol into an atom, we now only parse them into an atom when such atom is marked. This means garbage-collected symbols will also not be parsed into atoms, and neither are discarded symbols which have been resolved by other symbols. (Such as multiple weak symbols). This also introduces a binary search for finding the start index into the list of relocations. This speeds up finding the corresponding relocations tremendously as they're ordered ascended by address. Lastly, we re-use the memory of atom's data as well as relocations instead of duplicating it. This means we half the memory usage of atom's data and relocations for linked object files. As we are aware of decls and synthetic atoms, we free the memory of those atoms indepedently of the atoms of object files to prevent double-frees.
2023-11-28wasm-linker: do not merge unreferenced symbolsLuuk de Gram
When a symbol is unreferenced and therefore garbage-collected, we do not merge its specific section into the final binary.
2023-11-28wasm-linker: mark symbols and its referencesLuuk de Gram
Symbols which are exported to the host, or contain the `NO_STRIP` flag, will be marked. All symbols which are referenced by this symbol are marked likewise. We achieve this by parsing all relocations of a symbol, and then marking the symbol it points to within the relocation.
2023-11-28wasm-link: ensure TLS global when resolvedLuuk de Gram
When a linked object contains references to the __tls_base symbol, we lazily create this symbol. However, we wouldn't create the corresponding Wasm global. This meant its address wasn't set correctly as well as fail to output it into the `Names` section.
2023-11-26move Module.Decl.Index and Module.Namespace.Index to InternPoolMeghan Denny
2023-11-25convert `toType` and `toValue` to `Type.fromInterned` and `Value.fromInterned`Techatrix
2023-11-22std: remove meta.traitAndrew Kelley
In general, I don't like the idea of std.meta.trait, and so I am providing some guidance by deleting the entire namespace from the standard library and compiler codebase. My main criticism is that it's overcomplicated machinery that bloats compile times and is ultimately unnecessary given the existence of Zig's strong type system and reference traces. Users who want this can create a third party package that provides this functionality. closes #18051
2023-11-19compiler: correct unnecessary uses of 'var'mlugg
2023-11-19link: fix MachO boundary symbol resolutionmlugg
2023-11-17std.macho: fix LoadCommandIterator to work with underaligned dataJakub Konka
2023-11-15elf: fix emitting start/stop synthetic symbolsJakub Konka
2023-11-15elf: create .got.plt unconditionallyJakub Konka
2023-11-15elf: we were writing too many symbols in the symtabJakub Konka
2023-11-15elf: actually write synthetic globals to output symtabJakub Konka
2023-11-14elf: do not pointlessly store zerofill data for TLVsJakub Konka
2023-11-13coff: revert .rdata to be read-only againJakub Konka
2023-11-13coff: mark dirty any reloc target at [addr,..) inclusiveJakub Konka
2023-11-13elf: setting offset to maxInt for non-allocated non-incremental sections is badJakub Konka
2023-11-12elf: set symbol flags such as needs_zig_got in ZigObjectJakub Konka
2023-11-12elf: dump PLT entriesJakub Konka
2023-11-12elf: fix allocating local TLS symbolsJakub Konka
2023-11-12x86_64: get something going for the local exec modelJakub Konka
2023-11-12elf: fix typo in initial section offsetsJakub Konka
2023-11-12elf: check for empty relocs buffers in ZigObject before emitting sectionJakub Konka
2023-11-12elf: lower TLS data into appropriate TLS sectionJakub Konka
2023-11-12Dwarf: improve x86_64 backend debug infoJacob Young
Closes #17811
2023-11-10move libssp into libcompiler_rtAndrew Kelley
closes #7265
2023-11-10macho: check for null Module before creating llvm_objectJakub Konka
2023-11-10macho: resolve special section/segment boundary symbolsJakub Konka
Boundary symbols have a special name prefix: * section$start$segname$sectname * section$stop$segname$sectname * segment$start$segname * segment$stop$segname and will resolve to either start or end of the respective section/segment if found. If not found, we return an error stating we couldn't find the requested section/segment rather than silently failing and resolving the address to 0 which seems to be the case with Apple's ld64.
2023-11-10Merge pull request #17933 from ziglang/elf-r-modeJakub Konka
elf: the dreaded `-r` mode
2023-11-09elf: fix overflowing designated capacity when writing COMDAT groupsJakub Konka
2023-11-09elf: add SHF_INFO_LINK flag to any emitted SHT_RELA sectionJakub Konka
2023-11-09elf: format shdr flags when dumping stateJakub Konka
2023-11-09elf: write out COMDAT groups to fileJakub Konka
2023-11-09elf: init output COMDAT group sectionsJakub Konka
2023-11-09elf: separate logic for reseting shdr indexes into a separate fnJakub Konka
2023-11-09elf: correctly format output .eh_frame when emitting relocatableJakub Konka
2023-11-09elf: emit .rela.eh_frame section contentsJakub Konka
2023-11-09elf: calculate required size for .rela.eh_frameJakub Konka