| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch implements the idea floated in Trac #9858, namely that we
should generate type-representation information at the data type
declaration site, rather than when solving a Typeable constraint.
However, this turned out quite a bit harder than I expected. I still
think it's the right thing to do, and it's done now, but it was quite
a struggle.
See particularly
* Note [Grand plan for Typeable] in TcTypeable (which is a new module)
* Note [The overall promotion story] in DataCon (clarifies existing stuff)
The most painful bit was that to generate Typeable instances (ie
TyConRepName bindings) for every TyCon is tricky for types in ghc-prim
etc:
* We need to have enough data types around to *define* a TyCon
* Many of these types are wired-in
Also, to minimise the code generated for each data type, I wanted to
generate pure data, not CAFs with unpackCString# stuff floating about.
Performance
~~~~~~~~~~~
Three perf/compiler tests start to allocate quite a bit more. This isn't
surprising, because they all allocate zillions of data types, with
practically no other code, esp. T1969
* T3294: GHC allocates 110% more (filed #11030 to track this)
* T1969: GHC allocates 30% more
* T4801: GHC allocates 14% more
* T5321FD: GHC allocates 13% more
* T783: GHC allocates 12% more
* T9675: GHC allocates 12% more
* T5642: GHC allocates 10% more
* T9961: GHC allocates 6% more
* T9203: Program allocates 54% less
I'm treating this as acceptable. The payoff comes in Typeable-heavy
code.
Remaining to do
~~~~~~~~~~~~~~~
* I think that "TyCon" and "Module" are over-generic names to use for
the runtime type representations used in GHC.Typeable. Better might be
"TrTyCon" and "TrModule". But I have not yet done this
* Add more info the the "TyCon" e.g. source location where it was
defined
* Use the new "Module" type to help with Trac Trac #10068
* It would be possible to generate TyConRepName (ie Typeable
instances) selectively rather than all the time. We'd need to persist
the information in interface files. Lacking a motivating reason I have
not done this, but it would not be difficult.
Refactoring
~~~~~~~~~~~
As is so often the case, I ended up refactoring more than I intended.
In particular
* In TyCon, a type *family* (whether type or data) is repesented by a
FamilyTyCon
* a algebraic data type (including data/newtype instances) is
represented by AlgTyCon This wasn't true before; a data family
was represented as an AlgTyCon. There are some corresponding
changes in IfaceSyn.
* Also get rid of the (unhelpfully named) tyConParent.
* In TyCon define 'Promoted', isomorphic to Maybe, used when things are
optionally promoted; and use it elsewhere in GHC.
* Cleanup handling of knownKeyNames
* Each TyCon, including promoted TyCons, contains its TyConRepName, if
it has one. This is, in effect, the name of its Typeable instance.
Requires update of the haddock submodule.
Differential Revision: https://phabricator.haskell.org/D757
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch implements an extension to pattern synonyms which allows user
to specify pattern synonyms using record syntax. Doing so generates
appropriate selectors and update functions.
=== Interaction with Duplicate Record Fields ===
The implementation given here isn't quite as general as it could be with
respect to the recently-introduced `DuplicateRecordFields` extension.
Consider the following module:
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE PatternSynonyms #-}
module Main where
pattern S{a, b} = (a, b)
pattern T{a} = Just a
main = do
print S{ a = "fst", b = "snd" }
print T{ a = "a" }
In principle, this ought to work, because there is no ambiguity. But at
the moment it leads to a "multiple declarations of a" error. The problem
is that pattern synonym record selectors don't do the same name mangling
as normal datatypes when DuplicateRecordFields is enabled. They could,
but this would require some work to track the field label and selector
name separately.
In particular, we currently represent datatype selectors in the third
component of AvailTC, but pattern synonym selectors are just represented
as Avails (because they don't have a corresponding type constructor).
Moreover, the GlobalRdrElt for a selector currently requires it to have
a parent tycon.
(example due to Adam Gundry)
=== Updating Explicitly Bidirectional Pattern Synonyms ===
Consider the following
```
pattern Silly{a} <- [a] where
Silly a = [a, a]
f1 = a [5] -- 5
f2 = [5] {a = 6} -- currently [6,6]
```
=== Fixing Polymorphic Updates ===
They were fixed by adding these two lines in `dsExpr`. This might break
record updates but will be easy to fix.
```
+ ; let req_wrap = mkWpTyApps (mkTyVarTys univ_tvs)
- , pat_wrap = idHsWrapper }
+, pat_wrap = req_wrap }
```
=== Mixed selectors error ===
Note [Mixed Record Field Updates]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Consider the following pattern synonym.
data MyRec = MyRec { foo :: Int, qux :: String }
pattern HisRec{f1, f2} = MyRec{foo = f1, qux=f2}
This allows updates such as the following
updater :: MyRec -> MyRec
updater a = a {f1 = 1 }
It would also make sense to allow the following update (which we
reject).
updater a = a {f1 = 1, qux = "two" } ==? MyRec 1 "two"
This leads to confusing behaviour when the selectors in fact refer the
same field.
updater a = a {f1 = 1, foo = 2} ==? ???
For this reason, we reject a mixture of pattern synonym and normal
record selectors in the same update block. Although of course we still
allow the following.
updater a = (a {f1 = 1}) {foo = 2}
> updater (MyRec 0 "str")
MyRec 2 "str"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Users are sometimes confused why their test doesn't run. It is usually
because of a misspelled testname, for example using 'TEST=1234' instead
of 'TEST=T1234'. After this patch it is hopefully more clear what the
problem is, showing:
ERROR: tests not found: ['1234']
Instead of:
0 total tests, which gave rise to
0 test cases, of which
0 were skipped
Reviewed by: austin, bgamari
Differential Revision: https://phabricator.haskell.org/D1388
|
|
|
|
|
|
|
|
|
|
|
| |
Sed on OS X does not understand 's/[0-9]\+ bytes/NUM bytes/g' but
sed on Linux and OS X do understand 's/[0-9]* bytes/NUM bytes/g'.
Test Plan: Run all rts/T9579 tests on Linux and Mac
Reviewers: thomie, austin, bgamari
Differential Revision: https://phabricator.haskell.org/D1394
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch swaps the order of provided and required constraints in
a pattern signature, so it now goes
pattern P :: req => prov => t1 -> ... tn -> res_ty
See the long discussion in Trac #10928.
I think I have found all the places, but I could have missed something
particularly in comments.
There is a Haddock changes; so a submodule update.
|
| |
|
|
|
|
| |
Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
`fsEnvElts :: FastStringEnv a -> [a]` returns a list of `[a]` in the order of
`Unique`s which is arbitrary. In this case it gives a list of record fields in
arbitrary order, from which we then extract the field labels to contribute to
the record fingerprint. The arbitrary ordering of field labels introduces
unnecessary nondeterminism in interface files as demonstrated by the test case.
We sort `FastString` here. It's safe, because the only way that the `Unique`
associated with the `FastString` is used in comparison is for equality. If the
`Unique`s are different it fallbacks to comparing the actual `ByteString`.
Reviewed By: ezyang, thomie, bgamari, austin
Differential Revision: https://phabricator.haskell.org/D1373
GHC Trac Issues: #4012
|
|
|
|
|
|
| |
Fixes Trac #10997
Merge to stable branch
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Test Plan: validate
Reviewers: austin, thomie, bgamari
Reviewed By: thomie
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D1349
GHC Trac Issues: #10970
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Build system support for Cygwin was removed in b6be81b841.
Test Plan:
- Validate on x86_64/linux
- Cross-compile rts/RtsSymbols.c and rts/Linker.c to Windows using the
i686-w64-mingw32-gcc and x86_64-w64-mingw32-gcc cross compilers.
Reviewers: hvr, austin, bgamari
Reviewed By: bgamari
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D1371
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Test Plan: Validate.
Reviewers: austin
Reviewed By: austin
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D1352
GHC Trac Issues: #10370
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
It is difficult for GHC developers to know if they have broken the API
Annotations.
This patch provides a utility that can be used as a test to show up
errors in the API Annotations.
It is based on the current tests for ghc-api/annotations which can parse
a file using the just-built GHC API, and check that no annotations are
disconnected from the ParsedSource in the output.
In addition, it should be able to dump the annotations to a file, so a
new feature developer can check that all changes to the parser do
provide annotations.
Trac ticket: #10917
Test Plan: ./validate
Reviewers: hvr, thomie, austin, bgamari
Reviewed By: bgamari
Differential Revision: https://phabricator.haskell.org/D1368
GHC Trac Issues: #10917
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This makes it so the result of computing SCC's depends on the order
the nodes were passed to it, but not on the order on the user provided
key type.
The key type is usually `Unique` which is known to be nondeterministic.
Test Plan:
`text` and `aeson` become deterministic after this
./validate
Compare compile time for `text`:
```
$ cabal get text && cd text* && cabal sandbox init && cabal install
--dependencies-only && time cabal build
real 0m59.459s
user 0m57.862s
sys 0m1.185s
$ cabal clean && time cabal build
real 1m0.037s
user 0m58.350s
sys 0m1.199s
$ cabal clean && time cabal build
real 0m57.634s
user 0m56.118s
sys 0m1.202s
$ cabal get text && cd text* && cabal sandbox init && cabal install
--dependencies-only && time cabal build
real 0m59.867s
user 0m58.176s
sys 0m1.188s
$ cabal clean && time cabal build
real 1m0.157s
user 0m58.622s
sys 0m1.177s
$ cabal clean && time cabal build
real 1m0.950s
user 0m59.397s
sys 0m1.083s
```
Reviewers: ezyang, simonmar, austin, bgamari
Reviewed By: simonmar, bgamari
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D1268
GHC Trac Issues: #4012
|
| |
|
|
|
|
|
|
|
|
|
| |
Suggest enabling PatternSynonyms if we find an invalid
signature that looks like a pattern synonym.
Reviewed By: austin, thomie
Differential Revision: https://phabricator.haskell.org/D1347
|
| |
|
| |
|
|
|
|
|
|
|
|
| |
Default rules deliberately accept any kind.
Reviewed By: simonpj, thomie, goldfire
Differential Revision: https://phabricator.haskell.org/D1329
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When TemplateHaskell language extension is enabled it is valid to have
top-level expressions. Each such expression is treated as a contents
of a splice. The problem arises with typed splices. They are not valid
at the top level and therefore we should interpret them not as a splice
but as a top-level expression (aka. implicit splice). So saying:
$$foo
is equivalent of:
$( $$foo )
This patch makes sure that this is indeed the case. Until now we
incorrectly treated typed splices as explicit splices.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Changing backwards slashes to forward slashes apparently confuses
msys2/mingw magic path handling. I don't quite understand why, but this
fixes it.
Test Plan: on Windows, make sure PATH does not contain
'inplace/mingw/bin' (let the testsuite driver add it), then run: make
TEST='ghcilink003 ghcilink006'. Before this patch, it would fail.
Reviewed by: Phyx, bgamari, austin
Differential Revision: https://phabricator.haskell.org/D1343
|
|
|
|
|
|
|
|
| |
Patch by lukyanov.
Reviewed by: bgamari
Differential Revision: https://phabricator.haskell.org/D1337
|
|
|
|
|
| |
Fixes #10267. Typed holes in typed Template Haskell currently don't work.
See #10945 and #10946.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This implements DuplicateRecordFields, the first part of the
OverloadedRecordFields extension, as described at
https://ghc.haskell.org/trac/ghc/wiki/Records/OverloadedRecordFields/DuplicateRecordFields
This includes fairly wide-ranging changes in order to allow multiple
records within the same module to use the same field names. Note that
it does *not* allow record selector functions to be used if they are
ambiguous, and it does not have any form of type-based disambiguation
for selectors (but it does for updates). Subsequent parts will make
overloading selectors possible using orthogonal extensions, as
described on the wiki pages. This part touches quite a lot of the
codebase, and requires changes to several GHC API datatypes in order
to distinguish between field labels (which may be overloaded) and
selector function names (which are always unique).
The Haddock submodule has been adapted to compile with the GHC API
changes, but it will need further work to properly support modules
that use the DuplicateRecordFields extension.
Test Plan: New tests added in testsuite/tests/overloadedrecflds; these
will be extended once the other parts are implemented.
Reviewers: goldfire, bgamari, simonpj, austin
Subscribers: sjcjoosten, haggholm, mpickering, bgamari, tibbe, thomie,
goldfire
Differential Revision: https://phabricator.haskell.org/D761
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
On 64-bit ELF we need to link object files into the low 2GB due to the
small memory model. Previously we would map the entire object file
using MAP_32BIT, but the object file can consist of 75% or more
symbols, which only need to be present during linking, so this is
wasteful. In our particular application, we're already running out of
space here.
This patch changes the way we load object files on ELF platforms so
that the object is first mapped above the 2GB boundary, parsed, and
then the important sections are re-mapped into the low 2GB area.
Test Plan:
validate
(also needs testing on OS X & Windows, preferably 32 & 64 bit)
Reviewers: Phyx, trommler, bgamari, austin
Subscribers: hsyl20, thomie, bgamari
Differential Revision: https://phabricator.haskell.org/D975
|
|
|
|
|
|
| |
Comes with Haddock submodule update.
Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This commit contains a Cabal submodule update which unifies installed
package IDs and package keys under a single notion, a Component ID.
We update GHC to keep follow this unification. However, this commit
does NOT rename installed package ID to component ID and package key to
unit ID; the plan is to do that in a companion commit.
- Compiler info now has "Requires unified installed package IDs"
- 'exposed' is now expected to contain unit keys, not IPIDs.
- Shadowing is no more. We now just have a very simple strategy
to deal with duplicate unit keys in combined package databases:
if their ABIs are the same, use the latest one; otherwise error.
Package databases maintain the invariant that there can only
be one entry of a unit ID.
Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
Test Plan: validate
Reviewers: simonpj, austin, bgamari, hvr, goldfire
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D1184
GHC Trac Issues: #10714
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Currently, GHC's warning generation code is assuming that a name (`RdrName`)
can be imported at most once. This is a correct assumption, because 1) it's OK
to import same names as long as we don't use any of them 2) when we use one of
them, GHC generates an error because it doesn't disambiguate it automatically.
But apparently the story is different with typeclass methods. If I import two
methods with same names, it's OK to use them in typeclass instance
declarations, because the context specifies which one to use. For example, this
is OK (where modules A and B define typeclasses A and B, both with a function
has),
import A
import B
data Blah = Blah
instance A Blah where
has = Blah
instance B Blah where
has = Blah
But GHC's warning generator is not taking this into account, and so if I change
import list of this program to:
import A (A (has))
import B (B (has))
GHC is printing these warnings:
Main.hs:5:1: Warning:
The import of ‘A.has’ from module ‘A’ is redundant
Main.hs:6:1: Warning:
The import of ‘B.has’ from module ‘B’ is redundant
Why? Because warning generation code is _silently_ ignoring multiple symbols
with same names.
With this patch, GHC takes this into account. If there's only one name, then
this patch reduces to the previous version, that is, it works exactly the same
as current GHC (thanks goes to @quchen for realizing this).
Reviewed By: austin
Differential Revision: https://phabricator.haskell.org/D1257
GHC Trac Issues: #10890
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Trac #10796 exposes a way to make `template-haskell`'s `dataToQa` function
freak out if using a `Data` instance that produces a `Constr` (by means of
`toConstr`) using a function name instead of a data constructor name. While
such `Data` instances are somewhat questionable, they are nevertheless present
in popular libraries (e.g., `containers`), so we can at least make `dataToQa`
aware of their existence.
In order to properly distinguish strings which represent variables (as opposed
to data constructors), it was necessary to move functionality from `Lexeme` (in
`ghc`) to `GHC.Lexeme` in a new `ghc-boot` library (which was previously named
`bin-package-db`).
Reviewed By: goldfire, thomie
Differential Revision: https://phabricator.haskell.org/D1313
GHC Trac Issues: #10796
|
|
|
|
|
|
|
|
| |
This fallout was caused by f8fbf385b879fe17740 (see #10935), and looks easy
enough, but admittedly I just tried patching the output, so we're doing it
live.
Signed-off-by: Austin Seipp <austin@well-typed.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
HERMIT users depend on RULES to specify equational properties. 7.10.2
performed both inlining and simplification in both sides of the rules, meaning
they can't really be used for this. This breaks most HERMIT use cases. A
separate commit already disabled this for the LHS of rules. This does so for
the RHS.
See Trac #10829 for nofib results.
Reviewed By: austin, bgamari, simonpj
Differential Revision: https://phabricator.haskell.org/D1246
GHC Trac Issues: #10829
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch is driven by Trac #10935, and reinstates the
-fwarn-monomorphism-restriction warning. It was first lost in 2010:
d2ce0f52d "Super-monster patch implementing the new typechecker -- at
last"
I think the existing documentation is accurate; it is not even
turned on by -Wall.
I added one test.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary: Test included.
Test Plan: Run test T10870.hs on X86/X86_64/Arm/Arm64 etc
Reviewers: bgamari, nomeata, austin
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D1322
GHC Trac Issues: #10870
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Make Linker.hs try asking gcc for lib%s.dll as well, also changed tryGcc
to pass -L to all components by using -B instead. These two fix
shortnames linking on windows.
re-enabled tests: ghcilink003, ghcilink006 and T3333
Added two tests: load_short_name and enabled T1407 on windows.
Reviewed By: thomie, bgamari
Differential Revision: https://phabricator.haskell.org/D1310
GHC Trac Issues: #9878, #1407, #1883, #5289
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
Instead of doing these warnings at MkIface time, we do them
when we create the instances/rules in the typechecker/desugarer.
Emitting warnings for auto-generated instances was a pain
(since the specialization monad doesn't have the capacity
to emit warnings) so instead I just deprecated -fwarn-auto-orphans.
Auto rule orphans are pretty harmless anyway: they don't cause
interface files to be eagerly loaded in.
Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
Test Plan: validate
Reviewers: simonpj, austin, bgamari
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D1297
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Among doing other things, Phab:D201 (bc2289e13d9586be087bd8136943dc35a0130c88)
tried to improve the error messages thrown by the parser. For example a missing
else clause now prints "parse error in if statement: else clause empty" instead
of "parse error (possibly incorrect indentation or mismatched brackets)".
Some error messages got much worse however (see tests), and the result seems to
be a net negative. Although not entirely satisfactory, this commits therefore
reverts those parser changes.
Reviewed By: austin
Differential Revision: https://phabricator.haskell.org/D1309
GHC Trac Issues: #10498
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
For example
```
pattern head `Cons` tail = head : tail
```
Reviewed By: goldfire, austin
Differential Revision: https://phabricator.haskell.org/D1295
GHC Trac Issues: #10747
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Improved error messages are only printed when the old message would be
"No instance for...", since they're not as helpful for "Could not deduce..."
No special test case as error messages are tested by other tests already.
Signed-off-by: David Kraeutmann <kane@kane.cx>
Reviewed By: austin, goldfire
Differential Revision: https://phabricator.haskell.org/D1182
GHC Trac Issues: #10733
|
|
|
|
|
|
|
| |
A missing 'closeOverKinds' triggered Trac #10934.
Happily the fix is simple.
Merge to 7.10.3
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
We had a duplicate copy of the code for --make and for -c
which was a pain. The call graph looked something like this:
compileOne -> genericHscCompileGetFrontendResult -> genericHscFrontend
hscCompileOneShot ---^
with genericHscCompileGetFrontendResult and hscCompileOneShot
duplicating logic for deciding whether or not recompilation
was needed.
This patchset fixes it, so now everything goes through this call-chain:
compileOne (--make entry point)
Calls hscIncrementCompile, invokes the pipeline to do codegen
and sets up linkables.
hscIncrementalCompile (-c entry point)
Calls hscIncrementalFrontend, and then simplifying,
desugaring, and writing out the interface.
hscIncrementalFrontend
Performs recompilation avoidance, if recompilation needed,
does parses typechecking.
I also cleaned up some of the MergeBoot nonsense by introducing
a FrontendResult type.
NB: this BREAKS #8101 again, because I can't unconditionally desugar
due to Haddock barfing on lint, see #10600
Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
Test Plan: validate
Reviewers: simonpj, bgamari, simonmar, austin
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D1302
|
|
|
|
|
|
| |
Reviewed by: kgardas
Differential Revision: https://phabricator.haskell.org/D1311
|
| |
|
|
|
|
|
|
|
|
| |
It should be possible to run the testsuite with older versions of GHC.
Reviewed by: austin
Differential Revision: https://phabricator.haskell.org/D1308
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The Windows Linker has 3 main parts that this patch changes.
1) Identification and classification of sections
2) Adding of symbols to the symbols tables
3) Reallocation of sections
1.
Previously section identification used to be done on a whitelisted
basis. It was also exclusively being done based on the names of the
sections. This meant that there was a bit of a cat and mouse game
between `GCC` and `GHC`. Every time `GCC` added new sections there was a
good chance `GHC` would break. Luckily this hasn't happened much in the
past because the `GCC` versions `GHC` used were largely unchanged.
The new code instead treats all new section as `CODE` or `DATA`
sections, and changes the classifications based on the `Characteristics`
flag in the PE header. By doing so we no longer have the fragility of
changing section names. The one exception to this is the `.ctors`
section, which has no differentiating flag in the PE header, but we know
we need to treat it as initialization data.
The check to see if the sections are aligned by `4` has been removed.
The reason is that debug sections often time are `1 aligned` but do have
relocation symbols. In order to support relocations of `.debug` sections
this check needs to be gone. Crucially this assumption doesn't seem to
be in the rest of the code. We only check if there are at least 4 bytes
to realign further down the road.
2.
The second loop is iterating of all the symbols in the file and trying
to add them to the symbols table. Because the classification of the
sections we did previously are (currently) not available in this phase
we still have to exclude the sections by hand. If they don't we will
load in symbols from sections we've explicitly ignored the in # 1. This
whole part should rewritten to avoid this. But didn't want to do it in
this commit.
3.
Finally the sections are relocated. But for some reason the PE files
contain a Linux relocation constant in them `0x0011` This constant as
far as I can tell does not come from GHC (or I couldn't find where it's
being set). I believe this is probably a bug in GAS. But because the
constant is in the output we have to handle it. I am thus mapping it to
the constant I think it should be `0x0003`.
Finally, static linking *should* work, but won't. At least not if you
want to statically link `libgcc` with exceptions support. Doing so would
require you to link `libgcc` and `libstd++` but also `libmingwex`. The
problem is that `libmingwex` also defines a lot of symbols that the RTS
automatically injects into the symbol table. Presumably because they're
symbols that it needs. like `coshf`. The these symbols are not in a
section that is declared with weak symbols support. So if we ever want
to get this working, we should either a) Ask mingw to declare the
section as such, or b) treat all a imported symbols as being weak.
Though this doesn't seem like it's a good idea..
Test Plan:
Running ./validate for both x86 and x86_64
Also running the specific test case for #10672
make TESTS="T10672_x86 T10672_x64"
Reviewed By: ezyang, thomie, austin
Differential Revision: https://phabricator.haskell.org/D1244
GHC Trac Issues: #9907, #10672, #10563
|
|
|
|
|
| |
This started intermittently failing as a result of D1239.
I suspect this was just the straw that broke the camel's back however.
|