aboutsummaryrefslogtreecommitdiff
path: root/src/link/Dwarf.zig
AgeCommit message (Collapse)Author
2022-12-04dsym+dwarf: remove copyRangeAllOverlappingAllocJakub Konka
2022-12-04dsym: refactor API - do not store ptr to MachOJakub Konka
2022-12-03Merge pull request #13744 from Vexu/stage2-fixesAndrew Kelley
Improve error messages, fix dependency loops
2022-12-03Sema: fix comparisons between lazy and runtime valuesVeikka Tuominen
Closes #12498
2022-12-02dwarf: pass linker Tag and owner Decl.Index instead of *AtomJakub Konka
2022-12-02dwarf: use common DI union object for arg and var genJakub Konka
2022-12-01dwarf: move Wasm specific dwarf gen out of codegenJakub Konka
2022-12-01dwarf: fix typos after refactoring dbi genJakub Konka
2022-12-01codegen: make LinkerLoad a common struct shared by backendsJakub Konka
2022-12-01dwarf: extract common logic for generating func var dbg infoJakub Konka
2022-12-01dwarf: extract common logic for generating func arg dbg infoJakub Konka
2022-11-18run zig fmt on everything checked by CIStevie Hryciw
2022-11-10dwarf: do not assume unsigned 64bit integer for the enum valueJakub Konka
2022-10-18all: rename `@maximum` to `@max` and `@minimum` to `@min`Ali Chraghi
2022-09-18macho: rewrite how we allocate space in incremental contextJakub Konka
2022-09-07wasm-linker: support incremental debug infoLuuk de Gram
Although the wasm-linker previously already supported debug information in incremental-mode, this was no longer working as-is with the addition of supporting object-file-parsed debug information. This commit implements the Zig-created debug information structure from scratch which is a lot more robust and also allows being linked with debug information from other object files.
2022-09-07wasm-linker: Mix Zig -and Object debug atomsLuuk de Gram
When linking a Zig-compilation with an object file, we allow mixing the debug atoms to make sure debug information is preserved from object files. By default, we now always initialize all debug sections if the `strip` flag is unset. This also fixes relocations for debug information as previously the offset of an atom wasn't calculated, and neither was the code size itself which meant that debug lines were off and file names from other object files were missing.
2022-09-07wasm-linker: use Atoms for zig debug infoLuuk de Gram
Previously we used single arraylists for each debug section for debug information that was generated from Zig code. (e.i. `Module` is available). This information is now stored in Atoms, similarly to debug information from object files. This will allow us to link them together and resolve debug relocations.
2022-08-12x86: fix generating debug info for variablesJakub Konka
Add handling for these additional `MCValue`s: * `.immediate` - lower to `DW.OP.consts` or `DW.OP.constu` depending on signedness followed by popping off the DWARF stack with `DW.OP.stack_value` * `.undef` - lower to `DW.OP.implicit_value` * `.none` - lower to `DW.OP.lit0` followed by popping off the DWARF stack with `DW.OP.stack_value` For any remaining unhandled case, we generate `DW.OP.nop` in order not to mess up remaining DWARF info.
2022-08-12macho: update __DWARF sections before and after writing out __LINKEDITJakub Konka
2022-08-06stage2 DWARF: fix size and offset in slicesjoachimschmidt557
Previously, `@sizeOf(usize)` was used, however, the pointer size of the host may differ from the target when cross-compiling.
2022-08-03macho: sync with zldJakub Konka
gitrev a2c32e972f8c5adfcda8ed2d99379ae868f59c24 https://github.com/kubkon/zld/commit/a2c32e972f8c5adfcda8ed2d99379ae868f59c24
2022-07-26link: avoid passing bad ptrs to pwritevAndrew Kelley
At least on Linux, the pwritev syscall checks the pointer and returns EFAULT before it checks if the length is nonzero. Perhaps this should be fixed in the standard library, however, these are still improvements since they make the kernel do less work within the syscall.
2022-06-10link/wasm: fix writing past the end of debug info bufferAndrew Kelley
The function `writeDbgInfoNopsBuffered` was based on the function `pwriteDbgInfoNops`, originally written by me, and then modified to write to a memory buffer instead of an open file. When writing to a file, any extra bytes beyond the end of the file extend the size of the file, and the function body of `pwriteDbgInfoNops` takes advantage of this when `next_padding_bytes` causes the write to go beyond the end of the file. However, when writing to a memory buffer, the underlying array list must be expanded if the write would cause the buffer to expand.
2022-06-06dwarf: fix incorrect type reloc for unionsJakub Konka
Split type relocs into two kinds: local and global. Global relocs use a global type resolver and calculate offset to the existing definition of a type abbreviation. Local relocs use offset in the abbrev section of the containing atom plus addend to generate a local relocation.
2022-05-24dwarf: update abbrev info generation for new error union layoutJakub Konka
2022-05-09wasm: Write nops for padding debug infoLuuk de Gram
2022-05-09wasm: Emit debug sectionsLuuk de Gram
This commit adds the ability to emit the following debug sections: .debug_info .debug_abbrev .debug_line .debug_str Line information and files are now being loaded correctly by browser debuggers.
2022-05-09wasm: Flush debug information + commit declLuuk de Gram
This implements parts to commit a decl's debug information into a linear memory buffer. The goal is to write this buffer at once after we finished linking.
2022-05-09wasm: Add basic debug info referencesLuuk de Gram
2022-04-20stage2: use indexes for Decl objectsAndrew Kelley
Rather than allocating Decl objects with an Allocator, we instead allocate them with a SegmentedList. This provides four advantages: * Stable memory so that one thread can access a Decl object while another thread allocates additional Decl objects from this list. * It allows us to use u32 indexes to reference Decl objects rather than pointers, saving memory in Type, Value, and dependency sets. * Using integers to reference Decl objects rather than pointers makes serialization trivial. * It provides a unique integer to be used for anonymous symbol names, avoiding multi-threaded contention on an atomic counter.
2022-04-13macho,x64: resolve debug info relocs for RIP-based addressingJakub Konka
Sometimes we will want to generate debug info for a constant that has been lowered to memory and not copied anywhere else. For this we will need to defer resolution on PIE platforms until all locals (including GOT entries) have been allocated.
2022-04-13dwarf: gen debug info for arraysJakub Konka
2022-04-06stage2: rename InternArena to InternPoolAndrew Kelley
2022-04-04dwarf: emit debug info for local variables on x86_64Jakub Konka
Add support for emitting debug info for local variables within a subprogram. This required moving bits responsible for populating the debug info back to `CodeGen` from `Emit` as we require the operand to be resolved at callsite plus we need to know its type. Without enforcing this, we could end up with a `dead` mcv.
2022-03-30dwarf: pass DeclState around instead of storing a temp global in DwarfJakub Konka
Avoids many pitfalls connected with premature/early return in case there are errors with Decl, etc. This is effectively bringing back the old design however in a much nicer packaging, where every mechanism related to tracking Decl's debug info is now nicely wrapped in a single struct (aka the `DeclState`). This includes relocation table, type arena, etc. It is now the caller's responsibility to deinit the state (so that no memory is leaked) after `Decl` has been analysed (or errored out). The caller here is typically a linker such as `Elf` or `MachO`.
2022-03-29link: half-hearted bug fix for decl_state fieldAndrew Kelley
The init()/commit() API of this field leads to the type of bug that this commit fixes by defering an uncomfortably complex expression. I didn't bother doing the equivalent fix in link/MachO.zig because instead I think the `decl_state` field should be entirely removed from Dwarf.
2022-03-27dwarf: track type relocation state in Dwarf moduleJakub Konka
2022-03-27dwarf: move DbgInfoTypeRelocsTable into Dwarf moduleJakub Konka
2022-03-27dwarf: rename DebugInfoAtom into Atom; free all allocated memoryJakub Konka
2022-03-27dwarf: draft poc of deferred resolution of error sets debug infoJakub Konka
2022-03-27dwarf: do not use `Type.errorSetNames()` for inferred error setsJakub Konka
Otherwise, we risk tripping an assertion in `Type.errorSetNames()` in case the inferred error set was not yet fully resolved. This so far only surfaced when Dwarf triggers recursive analysis of an error set as part of emitting debug info for an error union.
2022-03-27dwarf: add debug info for error unionsJakub Konka
2022-03-27dwarf: add debug info for error setsJakub Konka
2022-03-25dwarf: add debug info for unionsJakub Konka
2022-03-24dwarf: add debug info for tuples and anon structsJakub Konka
2022-03-22dwarf: lower enumsJakub Konka
2022-03-22stage2: lazy `@alignOf`Andrew Kelley
Add a `target` parameter to every function that deals with Type and Value.
2022-03-08LLVM: fix memory leak of debug type namesAndrew Kelley
This required adjusting `Type.nameAlloc` to be used with a general-purpose allocator and added `Type.nameAllocArena` for the arena use case (avoids allocation sometimes).
2022-03-08dwarf: move all dwarf into standalone moduleJakub Konka
Hook up Elf and MachO linkers to the new solution.