aboutsummaryrefslogtreecommitdiff
path: root/src/link/Coff
AgeCommit message (Collapse)Author
2023-05-26std.Target adjustmentsVeikka Tuominen
* move `ptrBitWidth` from Arch to Target since it needs to know about the abi * double isn't always 8 bits * AVR uses 1-byte alignment for everything in GCC
2023-04-26coff: invalidate GOT relocs after segment shift in memoryJakub Konka
2023-04-21coff: treat vmaddr of 0 as unallocated when checking if resolvableJakub Konka
2023-04-21coff: use TableSection for GOTJakub Konka
2023-04-18coff: support allow_shlib_undefinedkcbanner
2023-04-03macho+coff: remove alignment from Atom as it is unusedJakub Konka
2023-04-01link: handle -u flag in all linkersJakub Konka
Also clean up parsing of linker args - reuse `ArgsIterator`. In MachO, ensure we add every symbol marked with `-u` as undefined before proceeding with symbol resolution. Additionally, ensure those symbols are never garbage collected. MachO entry_in_dylib test: pass `-u _my_main` when linking executable so that it is not incorrectly garbage collected by the linker.
2023-03-30coff: due to ASLR we need to dupe the code for relocatingJakub Konka
In addition, we need to be careful not to mark the relocations as resolved prematurely as then we are risking malforming the binary as we need to resolve the relocs twice: once for in-memory writes, and once for in-file updates.
2023-03-30coff: use std.os.windows wrappers; fix relocating in-fileJakub Konka
2023-03-30coff: make sure we correctly slide relocation target when resolvingJakub Konka
2023-03-29Merge pull request #15105 from ziglang/hcs-win-pocJakub Konka
coff: improve handling of relocs and general linker fixes
2023-03-28coff: put section growing in helper; only mark section if actually resolvedJakub Konka
2023-03-28Merge pull request #14771 from kcbanner/coff_dynamicbaseJakub Konka
Allow dynamicbase to be disabled by CompileStep
2023-03-28coff: use ArrayHashMap if we are iterating over keysJakub Konka
2023-03-28coff: resolve relocs on bytes buffer directlyJakub Konka
2023-03-28coff: move import table definition into a separate ImportTable.zig moduleJakub Konka
2023-03-28coff: do not use atoms for synthetic import address tableJakub Konka
Instead, introduce a custom ImportTable structure which will act as a thunk in the MachO linker, and we will use that to calculate the address of a pointer on-the-fly. Additionally, fix logic in writeImportTables to allow for multiple DLLs.
2023-03-25coff: change dynamicbase to default to true (to match lld), change it to ↵kcbanner
pass the negation to lld, and add --no-dynamicbase build: expose linker_dynamicbase on CompileStep and map it to emit --no-dynamicbase
2023-02-13move the cache system from compiler to std libAndrew Kelley
2023-02-01link: clean up type resolution in Elf.Atom and MachO.AtomJakub Konka
2023-01-31link: make Coff atoms fully owned by the linkerJakub Konka
2023-01-26coff: migrate to new non-allocateDeclIndexes APIJakub Konka
2023-01-05coff: fixup module_definition_file hashingkcbanner
2023-01-04coff: include version and module_definition_file in the hashkcbanner
2023-01-04windows: revert changes made to lld.zig to support the way CMake calls zig ↵kcbanner
cc on Windows-Clang
2023-01-04windows: fixes to support using zig cc/c++ with CMake on Windowskcbanner
Using zig cc with CMake on Windows was failing during compiler detection. -nostdinc was causing the crt not to be linked, and Coff/lld.zig assumed that wWinMainCRTStartup would be present in this case. -nostdlib did not prevent the default behaviour of linking libc++ when zig c++ was used. This caused libc++ to be built when CMake ran ABI detection using zig c++, which fails as libcxxabi cannot compile under MSVC. - Change the behaviour of COFF -nostdinc to set /entry to the function that the default CRT method for the specified subsystem would have called. - Fix -ENTRY being passed twice if it was specified explicitly and -nostdlib was present. - Add support for /pdb, /version, /implib, and /subsystem as linker args (passed by CMake) - Remove -Ddisable-zstd, no longer needed - Add -Ddisable-libcpp for use when bootstrapping on msvc
2023-01-04fixup formattingkcbanner
2023-01-04fixup: remove leftover logkcbanner
2023-01-04windows: supporting changes for boostrapping via msvckcbanner
- add support for passing through .def files to the linker, required for building libLTO.dll in LLVM - fixup libcpp linking conditionals - add option to skip linking zstd for use in bootstrapping (when building against an LLVM with LLVM_ENABLE_ZSTD=OFF)
2023-01-04build: first pass on geting stage3 building under x64_64-windows-msvckcbanner
2022-12-09Revert "coff: specify default base path for relative source paths in pdb"Jakub Konka
2022-12-06remove `-fstage1` optionAndrew Kelley
After this commit, the self-hosted compiler does not offer the option to use stage1 as a backend anymore.
2022-11-20uefi: Delete unneeded alignment and use default 4KDavid Gonzalez Martin
Closes #7484. Right now for UEFI targets an alignment of 32 is being used for no reason other than support a rare bytecode. As this is far from the standard case, removing this alignment and using the default one, as most toolchains do, should be the desired behavior.
2022-11-19linker: fail the compilation if there were linker errorsCasey Banner
There was no check for linker errors after flushing, which meant that if the link failed the build would continue and try to copy the non-existant exe, and also write the manifest as if it had succeeded. Also adds parsing of lld output, which is surfaced at the end of the compilation with the other errors instead of via stderr
2022-11-18run zig fmt on everything checked by CIStevie Hryciw
2022-11-10win: combine PDB fixes into one changesetJakub Konka
2022-11-10Windows: Explicitly pass PDB paths to lld-linkJ.C. Moyer
On Windows, lld-link resolves PDB output paths using `/` and embeds the result in the final executable, which breaks some native tooling like WPR/WPA. This commit overrides the default behavior of lld-link by explicitly setting the output PDB filename and binary-embedded path.
2022-11-06coff: move relocation in its own moduleJakub Konka
2022-11-04all: rename i386 to x86Ali Chraghi
2022-09-10coff: remove unused functionJakub Konka
2022-09-07coff: remove redundant bits and clean upJakub Konka
2022-09-07coff: create import atoms and matching bindingsJakub Konka
2022-08-31coff: write base relocations for the dynamic linkerJakub Konka
This means we can request ASLR on by default as other COFF linkers do. Currently, we write the base relocations in bulk, however, given that there is a mechanism for padding in place in PE/COFF I believe there might be room for making it an incremental operation (write base relocation whenever we add/update a pointer that would require it).
2022-08-30coff: cleanup relocations; remove COFF support from other backendsJakub Konka
Given that COFF will want to support PIC from ground-up, there is no point in leaving outdated code for COFF in other backends such as arm or aarch64. Instead, when we are ready to look into those, we can start figuring out what to add and where.
2022-08-30coff: commit missing Object.zig placeholderJakub Konka
2022-08-30coff: add basic handling of GOT PC relative indirectionJakub Konka
2022-08-30coff: allocate and write atoms to fileJakub Konka
2022-08-30coff: reorganize the linkerJakub Konka