summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* rts/linker: Split up object resolution and initializationwip/T21253Ben Gamari2022-03-182-15/+61
| | | | | | | | | | | | | | | | | | | | | | | | | Previously the RTS linker would call initializers during the "resolve" phase of linking. However, this is problematic in the case of cyclic dependencies between objects. In particular, consider the case where we have a situation where a static library contains a set of recursive objects: * object A has depends upon symbols in object B * object B has an initializer that depends upon object A * we try to load object A The linker would previously: 1. start resolving object A 2. encounter the reference to object B, loading it resolve object B 3. run object B's initializer 4. the initializer will attempt to call into object A, which hasn't been fully resolved (and therefore protected) Fix this by moving constructor execution to a new linking phase, which follows resolution. Fix #21253.
* rts/linker: Report archive member indexBen Gamari2022-03-171-5/+10
|
* rts/linker: More descriptive debug outputBen Gamari2022-03-172-12/+21
|
* HACK: hadrian: Disable ghci librariesBen Gamari2022-03-162-2/+2
|
* Ensure thatBen Gamari2022-03-161-1/+6
|
* Revert "Ensure that objects are unique named when joining"Ben Gamari2022-03-161-32/+3
| | | | This reverts commit eebec97aa7a54754d86a0456d4b0e84c0ec48e64.
* hadrian: Produce ar archives with L modifierBen Gamari2022-03-151-1/+1
|
* Ensure that objects are unique named when joiningBen Gamari2022-03-151-3/+32
|
* Refine tcSemigroupWarnings to work in ghc-primMatthew Pickering2022-02-101-4/+7
| | | | | | | | | | | | | ghc-prim doesn't depend on base so can't have any Monoid or Semigroup instances. However, attempting to load these definitions ran into issues when the interface for `GHC.Base` did exist as that would try and load the interface for `GHC.Types` (which is the module we are trying to compile and has no interface). The fix is to just not do this check when we are compiling a module in ghc-prim. Fixes #21069
*-----. Merge branches 'wip/windows-high-linker', 'wip/windows-high-codegen', ↵Ben Gamari2022-02-0933-357/+481
|\ \ \ \ | | | | | | | | | | | | | | | 'wip/windows-clang-2', 'wip/T21059' and 'wip/no-c-stubs' into wip/windows-clang-join
| | | | * Refactor handling of global initializersBen Gamari2022-02-0912-88/+245
| | | | |
| | | * | linker/PEi386: Make addLibrarySearchPath long-path awarewip/T21059Ben Gamari2022-02-091-15/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously `addLibrarySearchPath` failed to normalise the added path to UNC form before passing it to `AddDllDirectory`. Consequently, the call was subject to the MAX_PATH restriction, leading to the failure of `test-defaulting-plugin-fail`, among others. Happily, this also nicely simplifies the implementation. Closes #21059.
| | | * | PEi386: Drop Windows Vista fallback in addLibrarySearchPathBen Gamari2022-02-091-52/+3
| | | | | | | | | | | | | | | | | | | | We no longer support Windows Vista.
| | * | | Bump Cabal submoduleBen Gamari2022-02-091-0/+0
| | | | |
| | * | | testsuite: Mark FloatFnInverses as fixedBen Gamari2022-02-091-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The new toolchain has fixed it. Closes #15670.
| | * | | testsuite: Mark T9405 as fixed on WindowsBen Gamari2022-02-091-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I have not seen it fail since moving to clang. Closes #12714.
| | * | | testsuite: Mark Windows as a libc++ platformBen Gamari2022-02-091-0/+2
| | | | |
| | * | | Use static archives as an alternative to object mergingBen Gamari2022-02-093-8/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Unfortunately, `lld`'s COFF backend does not currently support object merging. With ld.bfd having broken support for high image-load base addresses, it's necessary to find an alternative. Here I introduce support in the driver for generating static archives, which we use on Windows instead of object merging.
| | * | | Rename -merge-objs flag to --merge-objsBen Gamari2022-02-093-3/+3
| | | | | | | | | | | | | | | | | | | | For consistency with --make and friends.
| | * | | testsuite: Port T16514 to CBen Gamari2022-02-093-46/+32
| | | | | | | | | | | | | | | | | | | | | | | | | Previously this test was C++ which made it a bit of a portability problem.
| | * | | configure: Declare compatibility with LLVM 13Ben Gamari2022-02-091-1/+1
| | | | | | | | | | | | | | | | | | | | The testing that I have done on Windows thusfar suggests that it works.
| | * | | configure: fixesBen Gamari2022-02-091-2/+7
| | | | |
| | * | | fp_settings: fixesBen Gamari2022-02-091-2/+5
| | | | |
| | * | | Drop -static-libgccBen Gamari2022-02-091-28/+2
| | | | |
| | * | | testsuite: Test that we can build bigobj PE objectsBen Gamari2022-02-092-0/+12
| | | | |
| | * | | Drop --oformat=pe-bigobj-x86-64 arguments from ld flagsBen Gamari2022-02-093-3/+6
| | | | | | | | | | | | | | | | | | | | It appears that LLD detects that the output is large on its own.
| | * | | driver: Drop hacks surrounding windres invocationBen Gamari2022-02-092-16/+2
| | | | | | | | | | | | | | | | | | | | | | | | | Drop hack for #1828, among others as they appear to be unnecessary when using `llvm-windres`.
| | * | | Build system changesBen Gamari2022-02-093-25/+17
| | | | |
| | * | | Bump text submodule (is this necessary?)GHC GitLab CI2022-02-091-0/+0
| | | | |
| | * | | rts: Eliminate use of nested functionsGHC GitLab CI2022-02-091-9/+11
| | | | | | | | | | | | | | | | | | | | This is a gcc-specific extension.
| | * | | Drop ld.bfd-specific linker flagsGHC GitLab CI2022-02-091-11/+4
| | | | |
| | * | | Bump win32-tarballs to 0.5Ben Gamari2022-02-092-2/+2
| | | |/ | | |/|
| * | | nativeGen: Note signed-extended nature of MOVBen Gamari2022-02-091-0/+4
| | | |
| * | | Don't assume that labels are 32-bit on WindowsBen Gamari2022-02-091-10/+17
| | | |
| * | | Refactor is32BitLit to take Platform rather than BoolBen Gamari2022-02-091-37/+33
| | | |
| * | | Generate LEA for label expressionsBen Gamari2022-02-091-0/+16
| | | |
| * | | nativeGen/x86: Use %rip-relative addressingBen Gamari2022-02-091-8/+49
| |/ / | | | | | | | | | | | | | | | | | | On Windows with high-entropy ASLR we must use %rip-relative addressing to avoid overflowing the signed 32-bit immediate size of x86-64. Since %rip-relative addressing comes essentially for free and can make linking significantly easier, we use it on all platforms.
* | | rts/linker: Catch archives masquerading as object filesBen Gamari2022-02-093-2/+33
| | |
* | | Move msvcrt dep out of baseBen Gamari2022-02-091-3/+1
| | |
* | | rts/PEi386: Avoid accidentally-quadratic allocation costBen Gamari2022-02-091-19/+45
| | | | | | | | | | | | | | | | | | We now preserve the address that we last mapped, allowing us to resume our search and avoiding quadratic allocation costs. This fixes the runtime of T10296a, which allocates many adjustors.
* | | rts/PEi386: Move allocateBytes to MMap.cBen Gamari2022-02-093-110/+92
| | |
* | | rts/PEi386: Rework linkerBen Gamari2022-02-098-374/+493
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a significant rework of the PEi386 linker, making the linker compatible with high image base addresses. Specifically, we now use the m32 allocator instead of `HeapAllocate`. In addition I found a number of latent bugs in our handling of import libraries and relocations. I've added quite a few comments describing what I've learned about Windows import libraries while fixing these. Thanks to Tamar Christina (@Phyx) for providing the address space search logic, countless hours of help while debugging, and his boundless Windows knowledge. Co-Authored-By: Tamar Christina <tamar@zhox.com>
* | | rts: Mark anything that might have an info table as dataGHC GitLab CI2022-02-091-265/+269
| | |
* | | rts/PEi386: Fix relocation overflow behaviorBen Gamari2022-02-093-16/+27
| | | | | | | | | | | | | | | | | | | | | | | | This fixes handling of overflowed relocations on PEi386 targets: * Refuse to create jump islands for relocations of data symbols * Correctly handle the `__imp___acrt_iob_func` symbol, which is an new type of symbol: `SYM_TYPE_INDIRECT_DATA`
* | | rts/linker: Preserve information about symbol typesBen Gamari2022-02-0910-41/+126
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As noted in #20978, the linker would previously handle overflowed relocations by creating a jump island. While this is fine in the case of code symbols, it's very much not okay in the case of data symbols. To fix this we must keep track of whether each symbol is code or data and relocate them appropriately. This patch takes the first step in this direction, adding a symbol type field to the linker's symbol table. It doesn't yet change relocation behavior to take advantage of this knowledge. Fixes #20978.
* | | rts/PEi386: Fix memory leakGHC GitLab CI2022-02-091-1/+3
| | |
* | | rts/PEi386: Move some debugging output to -DLGHC GitLab CI2022-02-091-0/+4
| | |
* | | rts: Don't mark object code in markCAFs unless necessaryGHC GitLab CI2022-02-091-2/+2
| | |
* | | rts/mmap: Refactor mmapForLinkerBen Gamari2022-02-092-113/+124
| | | | | | | | | | | | | | | | | | Here we try to separate the policy decisions of where to place mappings from the mechanism of creating the mappings. This makes things significantly easier to follow.
* | | linker: Don't use MAP_FIXEDBen Gamari2022-02-091-7/+4
| | | | | | | | | | | | | | | | | | | | | | | | As noted in #21057, we really shouldn't be using MAP_FIXED. I would much rather have the process crash with a "failed to map" error than randomly overwrite existing mappings. Closes #21057.