aboutsummaryrefslogtreecommitdiff
path: root/src/link/Coff.zig
AgeCommit message (Collapse)Author
2022-09-10x86_64: combine got_load, direct_load and imports_load into linker_load MCVJakub Konka
2022-09-09macho+coff: return index into global table from getGlobalSymbolJakub Konka
2022-09-09coff: use global accessor abstractions from MachOJakub Konka
2022-09-07coff: fix tracking of got and import entries; free relocs in update* fnsJakub Konka
2022-09-07coff: track globals in contiguous array to allow for tombstonesJakub Konka
2022-09-07coff: fix memory leak in incorrectly disposing of globals tableJakub Konka
2022-09-07coff: use more generous initial memory sizes for sectionsJakub Konka
2022-09-07coff: remove redundant bits and clean upJakub Konka
2022-09-07coff: grow section in virtual address space when requiredJakub Konka
2022-09-07coff: find new file space for a section (file offsets)Jakub Konka
2022-09-07coff: differentiate between file space and VM space for allocJakub Konka
2022-09-07coff: create a helper for allocating sectionsJakub Konka
2022-09-07coff: fix writing strtab to PE image fileJakub Konka
2022-09-07coff: mark relocations dirty when target atoms changeJakub Konka
2022-09-07coff: fix bug in lowerUnnamedConstJakub Konka
2022-09-07coff: fix runtime trapsJakub Konka
2022-09-07coff: implement lowering unnamed constsJakub Konka
2022-09-07coff: fix contents of IAT, and ensure codegen loads addr into regJakub Konka
As far as I can see, unlike with MachO, we don't have any stubs helper routines available and need to load a bound pointer into a register to then call it.
2022-09-07coff: populate import address table dirJakub Konka
2022-09-07coff: create import atoms and matching bindingsJakub Konka
2022-09-07coff: re-enable default entrypoint for WindowsJakub 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: add basic handling of GOT PC relative indirectionJakub Konka
2022-08-30coff: fallback to _start as default entry point for nowJakub Konka
This is not technically correct, but given that we are not yet able to link against the CRT, it's a good default until then. Add basic logging of generated symbol table in the linker.
2022-08-30coff: ...and lift-off!Jakub Konka
2022-08-30coff: add missing bits required for minimal PE exampleJakub Konka
2022-08-30coff: allocate and write atoms to fileJakub Konka
2022-08-30coff: populate missing section metadataJakub Konka
2022-08-30coff: add helpers for setting section/symbol namesJakub Konka
2022-08-30coff: allow for strtab in final PE imageJakub Konka
I believe this is going to be vital for section headers having names that require the use of a string table.
2022-08-30coff: initial implementation of incremental file allocsJakub Konka
2022-08-30coff: always write all data directory headers to fileJakub Konka
Maximum number is always 16, and this also unbreaks `dumpbin.exe` run on a simple section-less PE image created with our linker.
2022-08-30coff: write data directory and section headers to fileJakub Konka
2022-08-30coff: set some defaults for PE headersJakub Konka
2022-08-30coff: write headers to fileJakub Konka
2022-08-30coff: reorganize the linkerJakub Konka
2022-08-30coff: fix after rebaseJakub Konka
2022-08-30coff: move header writing logic into flushJakub Konka
2022-08-29link: add force_undefined_symbols to cache hashAndrew Kelley
Follow-up for d5233ee85ce13cba3dd03e4c0c938cee193b9b19.
2022-08-25add ability to pass force undefined symbols to the linkerJakub Konka
This commit enables `-u <symbol>` for ELF and `-include:<symbol>` for COFF linkers for use internally. This means we do not expose these flags to the users just yet, however, we make use of them internally whenever required. One such use case is forcing inclusion of `_tls_index` when linking for Windows with mingw and LTO and dead code stripping enabled. This ensures we add `_tls_index` to the symbol resolver as an undefined symbol and force the linker to include an atom that provides it marking it a dead-code-stripping root - meaning it will not be garbage collected by the linker no matter what.
2022-08-23coff: improve default COFF/PE object parserJakub Konka
We now do not allocate memory for headers and other metadata unless requested by the caller. Instead, we read-in the entire contents of the image into memory and operate on pointers and casts wherever possible. I have a left a TODO to hook up Windows' memory-mapped API here in-place of standard `readToEndAlloc` which should be more memory proof on memory constrained hosts. This commit also supplements our `std.coff` with a lot missing basic extern structs required to make our COFF linker.
2022-08-19make self-hosted the default compilerAndrew Kelley
stage1 is available behind the -fstage1 flag. closes #89
2022-08-18std.Target gains ObjectFormat fieldAndrew Kelley
2022-07-04link.Coff: notice special windows symbolsAndrew Kelley
in order to have a better default for subsystem. This brings stage2 behavior on par with stage1.
2022-06-27macho: implement -dead_strip_dylibs linker flagJakub Konka
2022-06-25macho: implement -headerpad_max_install_namesJakub Konka
2022-06-25cache setting macho search strategy flagsJakub Konka
2022-06-20[MachO] add -pagezero_sizeMotiejus Jakštys
Pass `-pagezero_size` to the MachO linker. This is the final "unsupported linker arg" that I could chase that CGo uses. After this and #11874 we may be able to fail on an "unsupported linker arg" instead of emiting a warning. Test case: zig=/code/zig/build/zig CGO_ENABLED=1 GOOS=darwin GOARCH=amd64 CC="$zig cc -target x86_64-macos" CXX="$zig c++ -target x86_64-macos" go build -a -ldflags "-s -w" cgo.go I compiled a trivial CGo program and executed it on an amd64 Darwin host. To be honest, I am not entirely sure what this is doing. This feels right after reading what this argument does in LLVM sources, but I am by no means qualified to make MachO pull requests. Will take feedback.
2022-06-17compiler_rt: use single cache for libcompiler_rt.a static libJakub Konka