summaryrefslogtreecommitdiff
path: root/compiler/main/DriverPipeline.hs
Commit message (Collapse)AuthorAgeFilesLines
* 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.
* iOS: generate archive files when compiling.Austin Seipp2013-08-141-5/+6
| | | | | | | | | | | When cross compiling to iOS, we generate archive files which are linked into the final executable. We already *did* generate archive files - just with the wrong suffix. Fixes #8125. Authored-by: Stephen Blackheath <...@blacksapphire.com> Signed-off-by: Austin Seipp <aseipp@pobox.com>
* Rename doDynamicToo to dynamicTooMkDynamicDynFlagsIan Lynagh2013-07-301-2/+2
| | | | | Makes it look less likely that people will confuse what it is for (e.g. #8104).
* Disable executable stack for the linker note, fixing #703 (again)Edward Z. Yang2013-07-091-1/+11
| | | | Signed-off-by: Edward Z. Yang <ezyang@mit.edu>
* Always have LLVM optimize globalsPeter Wortmann2013-07-051-2/+2
| | | | | | | | This pass is pretty cheap and eliminates the aliases generated by the LLVM backend. This in turn is required for dynamic linking to work correctly, as LLVM fails to properly attribute calls to aliased addresses. Signed-off-by: David Terei <davidterei@gmail.com>
* Fix many ASSERT uses under Clang.Austin Seipp2013-06-181-1/+1
| | | | | | Clang doesn't like whitespace between macro and arguments. Signed-off-by: Austin Seipp <aseipp@pobox.com>
* Use assembler-with-cpp mode when running CPP.Austin Seipp2013-06-181-4/+8
| | | | | | | | | | | | | | | | This is needed because Clang is very strict about C99 macro rules, which dictate that '#' in a body must have a token immediately following it for string-ification. In practice we break this all the time, because we do very weird stuff like: #define FOOBAR(xyz) \ {-# SOME PRAGMA #-} \ baz :: (xyz) \ baz = ... where the leading '#' in in the macro body clearly breaks this rule. Signed-off-by: Austin Seipp <aseipp@pobox.com>
* Handle -opt<blah> options more consistently (#7909)Simon Marlow2013-05-211-45/+19
| | | | | Now these are always added by the run<blah> functions in SysTools, so we never miss any out. Several cleanups resulted.
* Update a comment; spotted by Carter SchonwaldIan Lynagh2013-05-181-1/+1
|
* Don't use getPackageLinkOpts on iOS; fixes #7720.Ian Lynagh2013-04-271-1/+7
| | | | | On iOS, binaries are really static libraries, so we don't want to use flags like -lm when linking them.
* Remove extCoreName from DynFlagsIan Lynagh2013-04-261-25/+19
| | | | We now just pass the filename as an argument
* Remove DynFlags's hscOutName fieldIan Lynagh2013-04-261-8/+4
| | | | We now just pass the output filename as an argument instead
* Fix "-dynamic-too --make"; fixes #7864Ian Lynagh2013-04-261-26/+27
|