summaryrefslogtreecommitdiff
path: root/compiler/main/DriverPipeline.hs
Commit message (Collapse)AuthorAgeFilesLines
...
* Don't do a half-hearted recompilation check in compileOneEdward Z. Yang2015-01-031-1/+1
| | | | | | | | | | | | | | | | | | | Summary: The isNothing maybe_old_linkable check predates 48bc81ad466edfc80237015dbe5d78ba70eb5095, which fixed #481 by requiring recompilation information to be passed in as an argument to compileOne. As a result, the check here is redundant: the client has already taken a look at the object file to see if it is available or not. Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu> Test Plan: validate Reviewers: simonmar, austin Subscribers: carter, thomie Differential Revision: https://phabricator.haskell.org/D594
* Generate real (but empty) object files for signatures.Edward Z. Yang2014-12-021-7/+42
| | | | | | | | | | | | | | | | | | | | | Summary: It's not great, but it preserves a nice invariant that every Haskell source file has an object file (we already have a hack in place ensure this is the case for hs-boot files) and further ensures every package has a library associated with it (which would not be the case if the package had all signatures and we didn't make object files.) Contains Cabal submodule update. Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu> Test Plan: validate Reviewers: simonpj, austin Subscribers: carter, thomie Differential Revision: https://phabricator.haskell.org/D548
* arm64: 64bit iOS and SMP support (#7942)Luke Iannini2014-11-191-0/+1
| | | | Signed-off-by: Austin Seipp <austin@well-typed.com>
* Disable AVX for LLVM 3.2 by default (#9391)Peter Wortmann2014-11-181-5/+11
| | | | | | | | | Due to a bug LLVM generates a C-like frame pointer prelude for functions that use AVX instructions. This causes programs using the GHC calling convention to crash, therefore we simply disable them. People that want to use AVX should consider upgrading to a more current LLVM version. Signed-off-by: Austin Seipp <austin@well-typed.com>
* Add __GLASGOW_HASKELL_TH__=YES/NO to CPP definitionsJoachim Breitner2014-10-291-0/+6
| | | | | | | | | | | | | | Test Plan: None really. Reviewers: austin Reviewed By: austin Subscribers: thomie, carter, simonmar Differential Revision: https://phabricator.haskell.org/D386 GHC Trac Issues: #9734
* Typo in commentGabor Greif2014-10-281-2/+2
|
* Implementation of hsig (module signatures), per #9252Edward Z. Yang2014-10-241-6/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Module signatures, like hs-boot files, are Haskell modules which omit value definitions and contain only signatures. This patchset implements one particular aspect of module signature, namely compiling them against a concrete implementation. It works like this: when we compile an hsig file, we must be told (via the -sig-of flag) what module this signature is implementing. The signature is compiled into an interface file which reexports precisely the entities mentioned in the signature file. We also verify that the interface is compatible with the implementation. This feature is useful in a few situations: 1. Like explicit import lists, signatures can be used to reduce sensitivity to upstream changes. However, a signature can be defined once and then reused by many modules. 2. Signatures can be used to quickly check if a new upstream version is compatible, by typechecking just the signatures and not the actual modules. 3. A signature can be used to mediate separate modular development, where the signature is used as a placeholder for functionality which is loaded in later. (This is only half useful at the moment, since typechecking against signatures without implementations is not implemented in this patchset.) Unlike hs-boot files, hsig files impose no performance overhead. This patchset punts on the type class instances (and type families) problem: instances simply leak from the implementation to the signature. You can explicitly specify what instances you expect to have, and those will be checked, but you may get more instances than you asked for. Our eventual plan is to allow hiding instances, but to consider all transitively reachable instances when considering overlap and soundness. ToDo: signature merging: when a module is provided by multiple signatures for the same base implementation, we should not consider this ambiguous. ToDo: at the moment, signatures do not constitute use-sites, so if you write a signature for a deprecated function, you won't get a warning when you compile the signature. Future work: The ability to feed in shaping information so that we can take advantage of more type equalities than might be immediately evident. Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu> Test Plan: validate and new tests Reviewers: simonpj, simonmar, hvr, austin Subscribers: simonmar, relrod, ezyang, carter, goldfire Differential Revision: https://phabricator.haskell.org/D130 GHC Trac Issues: #9252
* Revert "Rename _closure to _static_closure, apply naming consistently."Edward Z. Yang2014-10-201-2/+2
| | | | | | | This reverts commit 35672072b4091d6f0031417bc160c568f22d0469. Conflicts: compiler/main/DriverPipeline.hs
* Indentation and non-semantic changes only.Edward Z. Yang2014-10-191-20/+20
| | | | | | | | | | | | | | | Summary: Get these lines fitting in 80 columns, and replace ptext (sLit ...) with text Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu> Test Plan: validate Reviewers: simonmar, austin Subscribers: thomie, carter, ezyang, simonmar Differential Revision: https://phabricator.haskell.org/D342
* Implement `MIN_VERSION_GLASGOW_HASKELL()` macroHerbert Valerio Riedel2014-10-051-6/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This exposes the `cProjectPatchLevel{1,2}` value at the CPP level to allow it to be used in CPP conditionals. Concretely, GHC 7.10.2.20150623 would result in #define __GLASGOW_HASKELL__ 710 #define __GLASGOW_HASKELL_PATCHLEVEL1__ 2 #define __GLASGOW_HASKELL_PATCHLEVEL2__ 20150623 while GHC 7.10.3 results in #define __GLASGOW_HASKELL__ 710 #define __GLASGOW_HASKELL_PATCHLEVEL1__ 3 and finally GHC 7.9.20141009 results in #define __GLASGOW_HASKELL__ 709 #define __GLASGOW_HASKELL_PATCHLEVEL1__ 20141009 As it's error-prone to properly express CPP conditionals for testing GHC multi-component versions, a new macro `MIN_VERSION_GLASGOW_HASKELL()` is provided (also via the new CPP include file `ghcversion.h`) Finally, in order to make it easier to define the new CPP macro `MIN_VERSION_GLASGOW_HASKELL()`, a new default-included `include/ghcversion.h` is used for the new CPP definitions. Reviewed By: ekmett, austin, #ghc Differential Revision: https://phabricator.haskell.org/D66
* Rename _closure to _static_closure, apply naming consistently.Edward Z. Yang2014-10-011-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: In preparation for indirecting all references to closures, we rename _closure to _static_closure to ensure any old code will get an undefined symbol error. In order to reference a closure foobar_closure (which is now undefined), you should instead use STATIC_CLOSURE(foobar). For convenience, a number of these old identifiers are macro'd. Across C-- and C (Windows and otherwise), there were differing conventions on whether or not foobar_closure or &foobar_closure was the address of the closure. Now, all foobar_closure references are addresses, and no & is necessary. CHARLIKE/INTLIKE were not changed, simply alpha-renamed. Part of remove HEAP_ALLOCED patch set (#8199) Depends on D265 Signed-off-by: Edward Z. Yang <ezyang@mit.edu> Test Plan: validate Reviewers: simonmar, austin Subscribers: simonmar, ezyang, carter, thomie Differential Revision: https://phabricator.haskell.org/D267 GHC Trac Issues: #8199
* Make Applicative a superclass of MonadAustin Seipp2014-09-091-3/+3
| | | | | | | | | | | | | | | | | | | | | Summary: This includes pretty much all the changes needed to make `Applicative` a superclass of `Monad` finally. There's mostly reshuffling in the interests of avoid orphans and boot files, but luckily we can resolve all of them, pretty much. The only catch was that Alternative/MonadPlus also had to go into Prelude to avoid this. As a result, we must update the hsc2hs and haddock submodules. Signed-off-by: Austin Seipp <austin@well-typed.com> Test Plan: Build things, they might not explode horribly. Reviewers: hvr, simonmar Subscribers: simonmar Differential Revision: https://phabricator.haskell.org/D13
* driver: pass '-fPIC' option to assembler as wellSergei Trofimovich2014-08-271-0/+44
| | | | | | | | | | | | | | | | | | | | | | | Summary: Before the patch '-fPIC' was passed only to C compiler, but not to assembler itself. It led to runtime crash in GHC_DYNAMIC_PROGRAMS=YES mode on sparc32. Technical details are in 'Note [-fPIC for assembler]'. Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org> Test Plan: validate on sparc Reviewers: simonmar, austin, kgardas Reviewed By: austin Subscribers: simonmar, ezyang, carter Differential Revision: https://phabricator.haskell.org/D177
* fix darwin threaded static linking by removing -lpthread option #9189Bob Ippolito2014-08-101-1/+1
| | | | | | | | | | | | | | | | Summary: Signed-off-by: Bob Ippolito <bob@redivi.com> Test Plan: See repro instructions in trac #9189 Reviewers: austin Reviewed By: austin Subscribers: phaskell, simonmar, relrod, ezyang, carter Differential Revision: https://phabricator.haskell.org/D120 GHC Trac Issues: #9189
* Make PackageState an abstract type.Edward Z. Yang2014-08-051-4/+3
| | | | | | | | | | | | Summary: Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu> Test Plan: validate Reviewers: simonpj, simonmar, hvr, austin Subscribers: simonmar, relrod, ezyang, carter Differential Revision: https://phabricator.haskell.org/D107
* Rename PackageId to PackageKey, distinguishing it from Cabal's PackageId.Edward Z. Yang2014-07-211-12/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Previously, both Cabal and GHC defined the type PackageId, and we expected them to be roughly equivalent (but represented differently). This refactoring separates these two notions. A package ID is a user-visible identifier; it's the thing you write in a Cabal file, e.g. containers-0.9. The components of this ID are semantically meaningful, and decompose into a package name and a package vrsion. A package key is an opaque identifier used by GHC to generate linking symbols. Presently, it just consists of a package name and a package version, but pursuant to #9265 we are planning to extend it to record other information. Within a single executable, it uniquely identifies a package. It is *not* an InstalledPackageId, as the choice of a package key affects the ABI of a package (whereas an InstalledPackageId is computed after compilation.) Cabal computes a package key for the package and passes it to GHC using -package-name (now *extremely* misnamed). As an added bonus, we don't have to worry about shadowing anymore. As a follow on, we should introduce -current-package-key having the same role as -package-name, and deprecate the old flag. This commit is just renaming. The haddock submodule needed to be updated. Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu> Test Plan: validate Reviewers: simonpj, simonmar, hvr, austin Subscribers: simonmar, relrod, carter Differential Revision: https://phabricator.haskell.org/D79 Conflicts: compiler/main/HscTypes.lhs compiler/main/Packages.lhs utils/haddock
* driver: use absolute paths in ld scripts (#7452)Austin Seipp2014-07-201-1/+3
| | | | | | Patch contributed by slowmo. Signed-off-by: Austin Seipp <austin@well-typed.com>
* Revert "Make -fno-write-interface to all modes of GHC, not just -fno-code."Edward Z. Yang2014-06-271-1/+2
| | | | This reverts commit 05120ecd95b2ebf9b096a95304793cd78be9506e.
* Make -fno-write-interface to all modes of GHC, not just -fno-code.Edward Z. Yang2014-06-271-2/+1
| | | | Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
* Add new flag -fwrite-interface for -fno-code.Edward Z. Yang2014-06-261-1/+3
| | | | | | | | | | | | | | | | | | | Summary: Normally, -fno-code does not generate interface files. However, if you want to use it to type check over multiple runs of GHC, you will need the interface files to check source files further down the dependency chain; -fwrite-interface does this for you. Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu> Test Plan: clean validate, and a new test-case Reviewers: simonpj Subscribers: simonmar, relrod, carter Differential Revision: https://phabricator.haskell.org/D27
* Fix up b84748121e777dAustin Seipp2014-06-231-1/+1
| | | | | | I forgot to amend this to my last commit. Signed-off-by: Austin Seipp <austin@well-typed.com>
* Fix #9047Austin Seipp2014-06-231-21/+25
| | | | Signed-off-by: Austin Seipp <austin@well-typed.com>
* Add LANGUAGE pragmas to compiler/ source filesHerbert Valerio Riedel2014-05-151-2/+2
| | | | | | | | | | | | | | | | | | In some cases, the layout of the LANGUAGE/OPTIONS_GHC lines has been reorganized, while following the convention, to - place `{-# LANGUAGE #-}` pragmas at the top of the source file, before any `{-# OPTIONS_GHC #-}`-lines. - Moreover, if the list of language extensions fit into a single `{-# LANGUAGE ... -#}`-line (shorter than 80 characters), keep it on one line. Otherwise split into `{-# LANGUAGE ... -#}`-lines for each individual language extension. In both cases, try to keep the enumeration alphabetically ordered. (The latter layout is preferable as it's more diff-friendly) While at it, this also replaces obsolete `{-# OPTIONS ... #-}` pragma occurences by `{-# OPTIONS_GHC ... #-}` pragmas.
* Remove external coreAustin Seipp2014-05-031-18/+8
| | | | Signed-off-by: Austin Seipp <austin@well-typed.com>
* Kill whitespace after cpp's `-I` flagHerbert Valerio Riedel2014-04-211-1/+1
| | | | | | This clean-up is in a similiar spirit as 574ef4293b8676. Signed-off-by: Herbert Valerio Riedel <hvr@gnu.org>
* Fix #8641, creating directories when we have stubs.Edward Z. Yang2014-04-101-0/+2
| | | | Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
* Don't preprocess .s filesSimon Marlow2014-04-081-9/+12
| | | | | | | | | One important reason is that gcc 4.8.1 sometimes crashes: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60436 Another reason is that preprocessing assembly files unnecessarily slows down compilation.
* DriverPipeline: Ensure -globalopt is passed to LLVM optBen Gamari2014-03-131-2/+6
| | | | | | | | While -O1 and -O2 both include -globalopt, the order in which the passes are run means that aliases aren't resolved which then causes llc to fall over. See GHC bug #8855. Signed-off-by: Austin Seipp <austin@well-typed.com>
* Switch on -dynamic-too with QuasiQuotes as well.Austin Seipp2014-02-191-1/+3
| | | | | | As pointed out by Albert Y. C. Lai on glasgow-haskell-users. Signed-off-by: Austin Seipp <austin@well-typed.com>
* Fix inplace dynamic linking on OS X (#8266)Christiaan Baaj2014-01-281-7/+9
| | | | Signed-off-by: Austin Seipp <austin@well-typed.com>
* Fix #8677 (fallout from #8180)Austin Seipp2014-01-211-1/+2
| | | | | | | | | When using TemplateHaskell and -prof, we *do not* want -dynamic-too, because we're going to *expect* that you compiled the vanilla/dyn way already, and are compiling profiling the second time (i.e. so GHCi can just load the normal, non-profiled object files.) Signed-off-by: Austin Seipp <austin@well-typed.com>
* Fix #8451Gabor Pali2014-01-181-0/+4
| | | | | | On FreeBSD, /usr/lib has to be added to the library path on linking when libthr is needed but -nostdlib is used (which is the case when the -prof and -threaded flags are combined).
* Don't pass -nodefaultlibs to ClangAustin Seipp2014-01-151-5/+7
| | | | | | | This fixes a large majority of the testsuite failures on Mavericks with Clang. Signed-off-by: Austin Seipp <austin@well-typed.com>
* Fix binary linking errors on SolarisKarel Gardas2014-01-141-1/+10
| | | | | | | The -u option must be placed before libraries which define the necessary symbols. Signed-off-by: Austin Seipp <austin@well-typed.com>
* Fix the behavior of ae87e122 (#8180)Austin Seipp2014-01-141-2/+2
| | | | | | | | | As Simon pointed out, we should only enable -dynamic-too in the template haskell case if GHC is dynamic and we're not already compiling in the dyn way (the dyn way will be switched on by -dynamic-too later in the pipeline anyway - see pipeLoop) Signed-off-by: Austin Seipp <austin@well-typed.com>
* Disable -dynamic-too on WindowsAustin Seipp2014-01-141-8/+10
| | | | Signed-off-by: Austin Seipp <austin@well-typed.com>
* Fix #8180Austin Seipp2014-01-121-4/+12
| | | | | | | | | When compiling a set of modules under --make, we need to check if the module graph has TemplateHaskell enabled. If it does, then we need to switch on -dynamic-too for GHCi, so that the linker can properly find the right dynamic object files. Signed-off-by: Austin Seipp <austin@well-typed.com>
* Fix __GLASGOW_HASKELL_LLVM__ #defineAustin Seipp2014-01-071-1/+3
| | | | | | | (It improperly used 'show' on the Maybe Int, not the Int.) Authored-by: Karel Gardas <karel.gardas@centrum.cz> Signed-off-by: Austin Seipp <austin@well-typed.com>
* Correctly set relative rpath for OS X (#8266)Austin Seipp2013-10-251-0/+7
| | | | | | | | | This includes both executables (by correcly setting the rpath to the topDir) and libffi, and GHC itself, so that everything works with no build tree. Authored-by: Christiaan Baaj <christiaan.baaij@gmail.com> Signed-off-by: Austin Seipp <austin@well-typed.com>
* Enable -msse to be specified by itself.Geoffrey Mainland2013-09-221-6/+5
| | | | This sets the SSE "version" to 1.0.
* Add support for -mavx512* flags.Geoffrey Mainland2013-09-221-4/+15
|
* Set LLVM option -stack-alignment=32 when compiling AVX instructions.Geoffrey Mainland2013-09-221-1/+7
|
* Add support for -mavx and -mavx2 flags.Geoffrey Mainland2013-09-221-1/+11
|
* Restructure compilation pipeline to allow hooksAustin Seipp2013-09-221-113/+41
| | | | | | | | | | | | | | | | This commit exposes GHC's internal compiler pipeline through a `Hooks` module in the GHC API. It currently allows you to hook: * Foreign import/exports declarations * The frontend up to type checking * The one shot compilation mode * Core compilation, and the module iface * Linking and the phases in DriverPhases.hs * Quasiquotation Authored-by: Luite Stegeman <stegeman@gmail.com> Authored-by: Edsko de Vries <edsko@well-typed.com> Signed-off-by: Austin Seipp <austin@well-typed.com>
* Distinguish between hs-main cases when giving rtsopts advice.Edward Z. Yang2013-09-151-0/+1
| | | | Signed-off-by: Edward Z. Yang <ezyang@mit.edu>
* Fix AMP warnings.Austin Seipp2013-09-111-0/+7
| | | | | Authored-by: David Luposchainsky <dluposchainsky@gmail.com> Signed-off-by: Austin Seipp <austin@well-typed.com>
* Fix annoying iOS linker warnings (#8208)Austin Seipp2013-09-041-2/+13
| | | | | Authored-by: Luke Iannini <lukexi@me.com> Signed-off-by: Austin Seipp <aseipp@pobox.com>
* Fix validate failure.Austin Seipp2013-08-281-1/+1
| | | | Signed-off-by: Austin Seipp <aseipp@pobox.com>
* Rework how iOS does linking (#8127)Austin Seipp2013-08-281-31/+60
| | | | | | | | | | | | | | | | | | | | | | | | iOS has some particular constraints about how applications can be built: * We must generate a static library (.a) since XCode does the final link. * We need to carefully give the right set of arguments to libtool in the case we're generating an archive. * Dynamic linking isn't supported. * It can only be done on OS X. This patch cleans up all of the above. We add a new flag `-staticlib` (only supported on Darwin) that allows us to produce archive files using libtool, and a -pgmlibtool flag to control which 'libtool' executable to use. This fixes #8127. I believe this is the last piece missing from the iOS cross compiler. Authored-by: Luke Iannini <lukexi@me.com> Authored-by: Maxwell Swadling <maxwellswadling@gmail.com> Authored-by: Stephen Blackheath <...@blacksapphire.com> Signed-off-by: Austin Seipp <aseipp@pobox.com>
* Only add -O to C compilations if there was -O on the command lineSimon Marlow2013-08-221-3/+5
| | | | | | | | | | | | In 1e2b3780ebc40d28cd0f029b90df102df09e6827 I changed the option ordering for C compilations. A side effect was that -optc options came before the automatic -O we were adding, which made it so that the -debug RTS was getting optimised when it shouldn't have been. Perhaps we shouldn't have automatic -O options added to C compilations. But that might cause problems for build systems that are relying on the current behaviour, so I've made a minor change instead: now C optimisation level == Haskell optimisation level.