summaryrefslogtreecommitdiff
path: root/compiler/main/DriverPipeline.hs
Commit message (Collapse)AuthorAgeFilesLines
* Add support for ASM foreign files (.s) in TH (#16180)Sylvain Henry2019-01-201-4/+5
|
* Support generating HIE filesAlec Theriault2018-12-111-10/+28
| | | | | | | | | | | | | | | | | | | | Adds a `-fenable-ide-info` flag which instructs GHC to generate `.hie` files (see the wiki page: https://ghc.haskell.org/trac/ghc/wiki/HIEFiles). This is a rebased version of Zubin Duggal's (@wz1000) GHC changes for his GSOC project, as posted here: https://gist.github.com/wz1000/5ed4ddd0d3e96d6bc75e095cef95363d. Test Plan: ./validate Reviewers: bgamari, gershomb, nomeata, alanz, sjakobi Reviewed By: alanz, sjakobi Subscribers: alanz, hvr, sjakobi, rwbarton, wz1000, carter Differential Revision: https://phabricator.haskell.org/D5239
* Windows: Use the "big" PE object format on amd64Ben Gamari2018-12-061-1/+37
| | | | | | | | | | | | | | Test Plan: Do full build on Windows. Reviewers: AndreasK, Phyx Reviewed By: AndreasK Subscribers: rwbarton, erikd, carter GHC Trac Issues: #15934 Differential Revision: https://phabricator.haskell.org/D5383
* Revert "driver: unconditionally disable relaxation when linking partially"Ryan Scott2018-08-221-4/+5
| | | | | | | | This reverts commit 1cc9061fce4270739677d475190fd6e890e8b1f9. This appears to break a clean build with certain versions of `ld.gold`. See https://phabricator.haskell.org/rGHC1cc9061fce42#132967.
* Introduce flag -keep-hscpp-filesroland2018-08-211-0/+2
| | | | | | | | | | | | | | Test Plan: `make test=T10869` Reviewers: mpickering, thomie, ezyang, bgamari Reviewed By: thomie, bgamari Subscribers: rwbarton, carter GHC Trac Issues: #10869 Differential Revision: https://phabricator.haskell.org/D4861
* driver: unconditionally disable relaxation when linking partiallySergei Trofimovich2018-08-211-5/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In https://github.com/gentoo-haskell/gentoo-haskell/issues/704 user explicitly uses -Wl,--relax for most built binaries. Most of the time this works fine except for capi haskell code similar to the following: ```haskell {-# LANGUAGE CApiFFI #-} module Z where import Foreign.C foreign import capi "unistd.h close" c_close :: CInt -> IO CInt ``` In this case compilation fails as: ``` $ inplace/bin/ghc-stage2 -c Z.hs -optl-Wl,--relax -fforce-recomp ld: --relax and -r may not be used together ``` GHC's driver already disables relaxation on sparc as there relaxation is already a default mode. This change disables relaxation on partial linking for all platforms where linker is binutils linker. Reported-by: wmyrda Bug: https://github.com/gentoo-haskell/gentoo-haskell/issues/704 Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org> Test Plan: pass -optl-Wl,--relax in test above Reviewers: bgamari Reviewed By: bgamari Subscribers: rwbarton, thomie, carter Differential Revision: https://phabricator.haskell.org/D4888
* Fix space leaksSimon Marlow2018-07-161-2/+2
| | | | | | | | | | | | | | | | | | | | | Summary: All these were detected by -fghci-leak-check when GHC was compiled *without* optimisation (e.g. using the "quick" build flavour). Unfortunately I don't know of a good way to keep this working. I'd like to just disable the -fghci-leak-check flag when the compiler is built without optimisation, but it doesn't look like we have an easy way to do that. And even if we could, it would be fragile anyway, Test Plan: `cd testsuite/tests/ghci; make` Reviewers: bgamari, hvr, erikd, tdammers Subscribers: tdammers, rwbarton, thomie, carter GHC Trac Issues: #15246 Differential Revision: https://phabricator.haskell.org/D4872
* Fix gcc.exe: error: CreateProcess: No such file or directoryMoritz Angermann2018-06-201-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | When GHC links binaries on windows, we pass a -L and -l flag to gcc for each dependency in the transitive dependency closure. As this will usually overflow the command argument limit on windows, we use response files to pass all arguments to gcc. gcc however internally passes only the -l flags via a response file to the collect2 command, but puts the -L flags on the command line. As such if we pass enough -L flags to gcc--even via a response file--we will eventually overflow the command line argument length limit due to gcc passing them to collect2 without resorting to a response file. To prevent this from happening we move all lirbaries into a shared temporary folder, and only need to pass a single -L flag to gcc. Ideally however this was fixed in gcc. Reviewers: bgamari, Phyx Reviewed By: bgamari Subscribers: erikd, rwbarton, thomie, carter Differential Revision: https://phabricator.haskell.org/D4762
* dead strip dylibs on macOSMoritz Angermann2018-05-301-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When linking dynamic libraries or executables, we compute the full transitive closure over the dependencies, and instruct the linker to link all dependencies. With deep dependency trees the number of transitive dependencies can grow quickly. macOS since the Sierra release has an upper limit on the load command sizes the linker parses when loading dynamic lirbaries. As such it is mandatory to keep the number of load commands (and their size) small on recent macOS releases. An approach that would just link direct dependencies as specified by the -package-id flag is insufficient, because GHC can inline across packages and the library or executable being linked could refer to symbols deep in the dependency tree. If we just recursively linked librarys and re-exported their symbols, this increases the number of symbols in libraries with many dependencies and ultimately puts excessive strain on the linker to the point where linking takes a lot longer than even the compilation of the modules. We can however build a list of symbols from the obejcts we want to link, and try to compute the libraries we need to link that contain those symbols from the transitive dependency closure. Luckily, we don't need to write this ourselves, but can use the ld64 `-dead_strip_dylibs` linker flag on macOS to achive the same result. This will link only the libraries that are actually referenced, which is usually a small subset of the full transitive dependency closure. As such we should stay within the load command size limit for almost all but pathological cases. Reviewers: bgamari Reviewed By: bgamari Subscribers: lelf, rwbarton, thomie, carter GHC Trac Issues: #14444 Differential Revision: https://phabricator.haskell.org/D4714
* Extract hard-coded LLVM opt flags into a fileKavon Farvardin2018-05-301-4/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | To resolve ticket #11295, I think it makes sense to stop hard-coding the pass sequences used by GHC when compiling with LLVM into the compiler itself. This patchset introduces a companion to the existing `llvm-targets` file called `llvm-passes`. The passes file is a simple association list that holds the default LLVM `opt` pass sequence used by GHC. This allows end users to easily save their favorite optimization flags when compiling with LLVM. The main benefit for ticket #11295 is that when adding a custom pass sequence, it tends to be an extremely long string that would be unsightly in the code. This is essentially part 1 of 2 for ticket #11295. Test Plan: ./validate Reviewers: bgamari, angerman Reviewed By: angerman Subscribers: rwbarton, thomie, carter Differential Revision: https://phabricator.haskell.org/D4695
* Simplify -ddump-json implementationMatthew Pickering2018-05-131-2/+1
| | | | | | | | | | | | | | | | | | | This patch takes the much simpler route of whenever the compiler tries to output something. We just dump a JSON document there and then. I think this should be sufficient to work with and anything more refined quickly got complicated as it was necessary to demarcate message scopes and so on. Reviewers: bgamari, dfeuer Reviewed By: bgamari Subscribers: Phyx, dfeuer, rwbarton, thomie, carter GHC Trac Issues: #14078 Differential Revision: https://phabricator.haskell.org/D4532
* Do not supply `-mcpu` if `-optlc` provides `-mcpu` already.Moritz Angermann2018-05-051-2/+3
| | | | | | | | | | Reviewers: bgamari Subscribers: thomie, carter GHC Trac Issues: #14982 Differential Revision: https://phabricator.haskell.org/D4548
* Support adding objects from THAlec Theriault2018-03-251-0/+2
| | | | | | | | | | | | | | | | | | | | | | The user facing TH interface changes are: * 'addForeignFile' is renamed to 'addForeignSource' * 'qAddForeignFile'/'addForeignFile' now expect 'FilePath's * 'RawObject' is now a constructor for 'ForeignSrcLang' * 'qAddTempFile'/'addTempFile' let you request a temporary file from the compiler. Test Plan: unsure about this, added a TH test Reviewers: goldfire, bgamari, angerman Reviewed By: bgamari, angerman Subscribers: hsyl20, mboes, carter, simonmar, bitonic, ljli, rwbarton, thomie GHC Trac Issues: #14298 Differential Revision: https://phabricator.haskell.org/D4217
* Remove splitEithers, use partitionEithers from baseÖmer Sinan Ağacan2018-03-121-2/+3
|
* Change how includes for input file directory worksTamar Christina2018-02-191-8/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | GHC Used to only allow for one include mode, namely `-I`. The problem with `-I` includes is that it supercedes all other includes, including the system include paths. This is not a problem for paths requested by the user, but it is a problem for the ones we implicitly derive and add. In particular we add the source directory of the input file to the include path. This is problematic because it causes any file with the name of a system include, to inadvertently loop as the wrong file gets included. Since this is an implicitly include, and as far as I can tell, only done so local includes are found (as the sources given to GCC reside in a temp folder) then switch from `-I` to `-iquote`. This requires a submodule update for haddock Test Plan: ./validate Reviewers: austin, bgamari, hvr Reviewed By: bgamari Subscribers: carter, rwbarton, thomie GHC Trac Issues: #14312 Differential Revision: https://phabricator.haskell.org/D4080
* Add new mbmi and mbmi2 compiler flagsJohn Ky2018-01-211-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | This adds support for the bit deposit and extraction operations provided by the BMI and BMI2 instruction set extensions on modern amd64 machines. Implement x86 code generator for pdep and pext. Properly initialise bmiVersion field. pdep and pext test cases Fix pattern match for pdep and pext instructions Fix build of pdep and pext code for 32-bit architectures Test Plan: Validate Reviewers: austin, simonmar, bgamari, angerman Reviewed By: bgamari Subscribers: trommler, carter, angerman, thomie, rwbarton, newhoggy GHC Trac Issues: #14206 Differential Revision: https://phabricator.haskell.org/D4236
* Get rid of some stuttering in comments and docsGabor Greif2017-12-191-1/+1
|
* Rename ghc-version -> ghcversion-fileMoritz Angermann2017-11-191-1/+1
| | | | | | | | | | Reviewers: bgamari Reviewed By: bgamari Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D4210
* Adds -ghc-version flag to ghc.Moritz Angermann2017-11-181-3/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: When building the rts with ghc (e.g. using ghc as a c compiler), ghc's "Value Add"[1] is, it includes adding `-include /path/to/ghcversion.h`. For this it looksup the rts package in the package database, which--if empty--fails. Thus to allow compiling C files with GHC, we add the `-ghc-version` flag, which takes the path to the `ghcversion.h` file. A `-no-ghc-version` flag was omitted, as at that point it becomes questionable why one would use ghc to compile c if one doesn't any of the added value. -- [1] from `compiler/main/DriverPipeline.hs` > -- add package include paths even if we're just compiling .c > -- files; this is the Value Add(TM) that using ghc instead of > -- gcc gives you :) Reviewers: bgamari, geekosaur, austin Reviewed By: bgamari Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D4135
* Typofixes in commentsGabor Greif2017-10-301-1/+1
|
* Split SysTools up someTamar Christina2017-10-101-187/+3
| | | | | | | | | | | | | | | | | Summary: SysTools and DriverTools have an annoying mutual dependency. They also each contain pieces of the linker. In order for changes to be shared between the library and the exe linking code this dependency needs to be broken in order to avoid using hs-boot files. Reviewers: austin, bgamari, erikd Reviewed By: bgamari Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D4071
* compiler: introduce custom "GhcPrelude" PreludeHerbert Valerio Riedel2017-09-191-0/+2
| | | | | | | | | | | | | | | | | | This switches the compiler/ component to get compiled with -XNoImplicitPrelude and a `import GhcPrelude` is inserted in all modules. This is motivated by the upcoming "Prelude" re-export of `Semigroup((<>))` which would cause lots of name clashes in every modulewhich imports also `Outputable` Reviewers: austin, goldfire, bgamari, alanz, simonmar Reviewed By: bgamari Subscribers: goldfire, rwbarton, thomie, mpickering, bgamari Differential Revision: https://phabricator.haskell.org/D3989
* Use ar for -staticlibMoritz Angermann2017-09-131-5/+32
| | | | | | | | | | | | | | | | Hopefully we can get rid of libtool, by using ar only Depends on: D3579 Test Plan: validate Reviewers: austin, hvr, bgamari, erikd Reviewed By: bgamari Subscribers: rwbarton, thomie, erikd Differential Revision: https://phabricator.haskell.org/D3721
* Drop special handling of iOS and AndroidMoritz Angermann2017-09-071-1/+1
| | | | | | | | | | | | | | | As far as GHC is concerned, iOS **is** Darwin, and Android **is** Linux. Depends on D3352 Reviewers: austin, hvr, bgamari Reviewed By: bgamari Subscribers: Ericson2314, ryantrinkle, rwbarton, thomie, erikd Differential Revision: https://phabricator.haskell.org/D3579
* Clean up opt and llcMoritz Angermann2017-09-061-93/+144
| | | | | | | | | | | | | | | | | | | | | The LLVM backend shells out to LLVMs `opt` and `llc` tools. This clean up introduces a shared data structure to carry the arguments we pass to each tool so that corresponding flags are next to each other. It drops the hard coded data layouts in favor of using `-mtriple` and have LLVM infer them. Furthermore we add `clang` as a proper tool, so we don't rely on assuming that `clang` is called `clang` on the `PATH` when using `clang` as the assembler. Finally this diff also changes the type of `optLevel` from `Int` to `Word`, as we do not have negative optimization levels. Reviewers: erikd, hvr, austin, rwbarton, bgamari, kavon Reviewed By: kavon Subscribers: michalt, Ericson2314, ryantrinkle, dfeuer, carter, simonpj, kavon, simonmar, thomie, erikd, snowleopard Differential Revision: https://phabricator.haskell.org/D3352
* Add support for producing position-independent executablesBen Gamari2017-08-221-6/+4
| | | | | | | | | | | | | | | | Previously due to #12759 we disabled PIE support entirely. However, this breaks the user's ability to produce PIEs. Add an explicit flag, -fPIE, allowing the user to build PIEs. Test Plan: Validate Reviewers: rwbarton, austin, simonmar Subscribers: trommler, simonmar, trofi, jrtc27, thomie GHC Trac Issues: #12759, #13702 Differential Revision: https://phabricator.haskell.org/D3589
* Ensure that we always link against libmBen Gamari2017-07-281-0/+1
| | | | | | | | | | | | | | | ld.gold is particularly picky that we declare all of our link dependencies on Nix. See #14022. Test Plan: Validate on Nix Reviewers: austin Subscribers: hvr, rwbarton, thomie GHC Trac Issues: #14022 Differential Revision: https://phabricator.haskell.org/D3787
* Make module membership on ModuleGraph fasterBartosz Nitka2017-07-181-4/+1
| | | | | | | | | | | | | | | | | | | When loading/reloading with a large number of modules (>5000) the cost of linear lookups becomes significant. The changes here made `:reload` go from 6s to 1s on my test case. The bottlenecks were `needsLinker` in `DriverPipeline` and `getModLoop` in `GhcMake`. Test Plan: ./validate Reviewers: simonmar, austin, bgamari Subscribers: thomie, rwbarton Differential Revision: https://phabricator.haskell.org/D3703
* Use correct section types syntax for architectureBen Gamari2017-07-111-2/+4
| | | | | | | | | | | | | | | | | | Previously GHC would always assume that section types began with `@` while producing assembly, which is not true. For instance, in ARM assembly syntax section types begin with `%`. This abstracts out section type pretty-printing and adjusts it to correctly account for the target architectures assembly flavor. Reviewers: austin, hvr, Phyx Reviewed By: Phyx Subscribers: Phyx, rwbarton, thomie, erikd GHC Trac Issues: #13937 Differential Revision: https://phabricator.haskell.org/D3712
* Always allow -staticlibMoritz Angermann2017-07-111-4/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | the `-staticlib` flag is currently only supported on apple platforms, due to the avaiablity of libtool (the apple version, which is unlike the gnu version). This however prevents the use of -staticlib in cases where it would be beneficial as well. The functionality that `-staticlib` uses from `libtool` can be stubbed with a small script like the following: ``` #!/bin/bash # This script pretends to be libtool. And supports # only a limited set of flags. # # It is supposed to be a stand in for libtool -static, whic # creates a static archive. This is done by locating all -l<lib> # libs in the provied -L<lib path> library paths, and building an # MRI script to create the final archive from all the libraries, and # other provided inputs. # name=${0##*/} target=${name%-*} set -e ldflags_L=() ldflags_l=() output="" inputs=() STATIC=0 DYNAMIC=1 mode=$DYNAMIC verbose=0 # find_lib <name> path path path path function find_lib () { lib=$1; shift 1; for dir in $@; do if [ -f "$dir/$lib" ]; then echo "$dir/$lib" break fi done } while [ "$#" -gt 0 ]; do case "$1" in -v|--verbose) verbose=1; shift 1;; -o) output="$2"; shift 2;; -L*) ldflags_L+=("${1:2:${#1}-2}"); shift 1;; -l*) ldflags_l+=("lib${1:2:${#1}-2}.a"); shift 1;; -static) mode=$STATIC; shift 1;; -dynamic) mode=$DYNAMIC; shift 1;; -Wl,*) ldflags+=("${1#*,}"); shift 1;; -*) echo "unknown option: $1" >&2; exit 1;; *) inputs+=("$1"); shift 1;; esac done if [ ! $mode == $STATIC ]; then echo "-dynamic not supported!" >&2; exit 1; fi MRI="create ${output}\n" for input in "${ldflags_l[@]}"; do lib=$(find_lib $input ${ldflags_L[@]}) if [ -z $lib ]; then echo "Failed to find lib $input" >&2 exit 1 else MRI+="addlib $lib\n" continue fi done for input in "${inputs[@]}"; do MRI+="addmod $input\n" done MRI+="save\nend\n" echo -e "$MRI" | $target-ar -M $target-ranlib $output ``` if `ar` supports MRI scripts. Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3706
* Revert "Make module membership on ModuleGraph faster"Ben Gamari2017-06-271-1/+4
| | | | | | I had not intended on merging this. This reverts commit b0708588e87554899c2efc80a2d3eba353dbe926.
* Make module membership on ModuleGraph fasterBartosz Nitka2017-06-271-4/+1
| | | | | | | | | | | | | | | | | | | When loading/reloading with a large number of modules (>5000) the cost of linear lookups becomes significant. The changes here made `:reload` go from 6s to 1s on my test case. The bottlenecks were `needsLinker` in `DriverPipeline` and `getModLoop` in `GhcMake`. Test Plan: ./validate Reviewers: simonmar, austin, bgamari Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3646
* Refactor temp files cleanupDouglas Wilson2017-06-081-27/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Remove filesToNotIntermediateClean from DynFlags, create a data type FilesToClean, and change filesToClean in DynFlags to be a FilesToClean. Modify SysTools.newTempName and the Temporary constructor of PipelineMonad.PipelineOutput to take a TempFileLifetime, which specifies whether a temp file should live until the end of GhcMonad.withSession, or until the next time cleanIntermediateTempFiles is called. These changes allow the cleaning of intermediate files in GhcMake to be much more efficient. HscTypes.hptObjs is removed as it is no longer used. A new performance test T13701 is added, which passes both with and without -keep-tmp-files. The test fails by 25% without the patch, and passes when -keep-tmp-files is added. Note that there are still at two hotspots caused by algorithms quadratic in the number of modules, however neither of them allocate. They are: * DriverPipeline.compileOne'.needsLinker * GhcMake.getModLoop DriverPipeline.compileOne'.needsLinker is changed slightly to improve the situation. I don't like adding these Types to DynFlags, but they need to be seen by Dynflags, SysTools and PipelineMonad. The alternative seems to be to create a new module. Reviewers: austin, hvr, bgamari, dfeuer, niteria, simonmar, erikd Reviewed By: simonmar Subscribers: rwbarton, thomie GHC Trac Issues: #13701 Differential Revision: https://phabricator.haskell.org/D3620
* Compile modules that are needed by template haskell, even with -fno-code.Douglas Wilson2017-05-201-33/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch relates to Trac #8025 The goal here is to enable typechecking of packages that contain some template haskell. Prior to this patch, compilation of a package with -fno-code would fail if any functions in the package were called from within a splice. downsweep is changed to do an additional pass over the modules, targetting any ModSummaries transitively depended on by a module that has LangExt.TemplateHaskell enabled. Those targeted modules have hscTarget changed from HscNothing to the default target of the platform. There is a small change to the prevailing_target logic to enable this. A simple test is added. I have benchmarked with and without a patched haddock (available:https://github.com/duog/haddock/tree/wip-no-explicit-th-compi lation). Running cabal haddock on the wreq package results in a 25% speedup on my machine: time output from patched cabal haddock: real 0m5.780s user 0m5.304s sys 0m0.496s time output from unpatched cabal haddock: real 0m7.712s user 0m6.888s sys 0m0.736s Reviewers: austin, bgamari, ezyang Reviewed By: bgamari Subscribers: bgamari, DanielG, rwbarton, thomie GHC Trac Issues: #8025 Differential Revision: https://phabricator.haskell.org/D3441
* Use NEED_PTHREAD_LIBMoritz Angermann2017-05-111-11/+8
| | | | | | | | | | | | | we do the same for the rts already. And using the configure script should be more robust than hand-picking the OSs here. Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3563
* UNREG: remove dead code around -split-objsSergei Trofimovich2017-04-161-5/+0
| | | | Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
* Drop special handling of iOSMoritz Angermann2017-04-121-8/+1
| | | | | | | | | | | | | | | | | | | | iOS at least since iOS8 (we are currently at iOS10.3), allows for dynamic libaries, hence any artificail restriction on dyanmic libraries should be lifted. Please ping me with any iOS related issues that should potentially resurface. The iOS toolchain has considerably changed over the years, and I'm willing to drop work arounds in good faith. Reviewers: bgamari, austin Reviewed By: bgamari Subscribers: rwbarton, thomie GHC Trac Issues: #13559, #7722 Differential Revision: https://phabricator.haskell.org/D3451
* Optimise common cases of GHC.setProgramDynFlagsSimon Marlow2017-04-011-1/+9
| | | | | | | | | | | | | | | | | | * If the package flags haven't changed, don't do initPackages (which might take multiple seconds in extreme cases) * Provide a way to change the log_action without invalidating the summary cache. Test Plan: validate Reviewers: niteria, bgamari, austin, erikd, ezyang Reviewed By: bgamari Subscribers: mpickering, rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3392
* Various patches to support android cross compilationMoritz Angermann2017-03-291-1/+1
| | | | | | | | | | | | | | | | | | | | - Better test for SHT_INIT_ARRAY than openbsd_HOST_OS This is actually bens patch: https://gist.github.com/bgamari/c846e6a5f2cd988716cd5e36c68d5bef - linux-android defines. - No need for -lpthread on OSAndroid However, I’m confused why we do not use the AC NEED_PTHREAD_LIB value here? - Use mmap on android - Support `none` vendor. Reviewers: austin, hvr, bgamari, erikd, simonmar Reviewed By: bgamari Subscribers: rwbarton, thomie, erikd Differential Revision: https://phabricator.haskell.org/D3356
* Introduce putLogMsgBen Gamari2017-03-151-2/+2
| | | | | | | | | | | | | This factors out the repetition of (log_action dflags dflags) and will hopefully allow us to someday better abstract log output. Test Plan: Validate Reviewers: austin, hvr, goldfire Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3334
* Allow compilation of C/C++/ObjC/ObjC++ files with module from THFrancesco Mazzoli2017-03-081-50/+65
| | | | | | | | | | | | | | | | | | | | The main goal is to easily allow the inline-c project (and similar projects such as inline-java) to emit C/C++ files to be compiled and linked with the current module. Moreover, `addCStub` is removed, since it's quite fragile. Most notably, the C stubs end up in the file generated by `CodeOutput.outputForeignStubs`, which is tuned towards generating a file for stubs coming from `capi` and Haskell-to-C exports. Reviewers: simonmar, austin, goldfire, facundominguez, dfeuer, bgamari Reviewed By: dfeuer, bgamari Subscribers: snowleopard, rwbarton, dfeuer, thomie, duncan, mboes Differential Revision: https://phabricator.haskell.org/D3280
* Add -fwhole-archive-hs-libsSimon Marlow2017-03-021-5/+21
| | | | | | | | | | | | | | | | | | We're building a demo to show how to hot-swap Haskell code in a running process, and unfortunately it wasn't possible to convince GHC to generate the correct linker command line without this extra knob. Test Plan: Tested it on a hot-swapping demo (which is not released yet, but will be shortly) Reviewers: niteria, austin, erikd, JonCoens, bgamari Reviewed By: bgamari Subscribers: Phyx, rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3136
* Give better error message with you run ghc foo.bkpEdward Z. Yang2017-02-231-0/+4
| | | | | | | | | | | | | | | | Summary: Detect Backpackish suffixes, and bail out if we try to run them in the pipeline. Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu> Test Plan: validate Reviewers: rwbarton, bgamari, austin Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3172
* Ditch static flagsSylvain Henry2017-02-021-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | This patch converts the 4 lasting static flags (read from the command line and unsafely stored in immutable global variables) into dynamic flags. Most use cases have been converted into reading them from a DynFlags. In cases for which we don't have easy access to a DynFlags, we read from 'unsafeGlobalDynFlags' that is set at the beginning of each 'runGhc'. It's not perfect (not thread-safe) but it is still better as we can set/unset these 4 flags before each run when using GHC API. Updates haddock submodule. Rebased and finished by: bgamari Test Plan: validate Reviewers: goldfire, erikd, hvr, austin, simonmar, bgamari Reviewed By: simonmar Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2839 GHC Trac Issues: #8440
* Add support for StaticPointers in GHCiBen Gamari2017-02-021-2/+3
| | | | | | | | | | | | | | | | | | | | | Here we add support to GHCi for StaticPointers. This process begins by adding remote GHCi messages for adding entries to the static pointer table. We then collect binders needing SPT entries after linking and send the interpreter a message adding entries with the appropriate fingerprints. Test Plan: `make test TEST=StaticPtr` Reviewers: facundominguez, mboes, simonpj, simonmar, goldfire, austin, hvr, erikd Reviewed By: simonpj, simonmar Subscribers: RyanGlScott, simonpj, thomie Differential Revision: https://phabricator.haskell.org/D2504 GHC Trac Issues: #12356
* Always use -Xlinker for -rpathBartosz Nitka2017-01-211-3/+18
| | | | | | | | | | | | | | | | | | | | | | | | Currently we use `-Wl` which takes a list of comma-separated options. Unfortunately that breaks when you use it with `-rpath` and a path that has commas in them. Buck, the build system, produces paths with commas in them. `-Xlinker` doesn't have this disadvantage and as far as I can tell is supported by both `gcc` and `clang`. Anecdotally `nvcc` supports `-Xlinker`, but not `-Wl`. Test Plan: ./validate, harbourmaster Reviewers: nomeata, simonmar, austin, bgamari, hvr Reviewed By: simonmar, bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2971
* Enable subsections via symbols on iOSDemi Obenour2017-01-101-1/+1
| | | | | | | | | | | | | | Test Plan: GHC CI Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2915 GHC Trac Issues: #11040, #13049
* -dead_strip is now the default on DarwinDemi Obenour2017-01-101-10/+14
| | | | | | | | | | | | | | | | | | | This enables subsections-via-symbols (-dead_strip) by default on Darwin. The Static Reference Table (SRT) needs to be split in order for -dead_strip to be helpful, so this commit always splits it on Darwin systems. Test Plan: GHC CI on Darwin Reviewers: erikd, austin, bgamari Reviewed By: erikd, bgamari Subscribers: erikd, thomie Differential Revision: https://phabricator.haskell.org/D2911 GHC Trac Issues: #11040, #13049
* Allow use of the external interpreter in stage1.Shea Levy2016-12-201-4/+0
| | | | | | | | | | | | | | | | | | | Summary: Now that we have -fexternal-interpreter, we can lose most of the GHCI ifdefs. This was originally added in https://phabricator.haskell.org/D2826 but that led to a compatibility issue with ghc 7.10.x on Windows. That's fixed here and the revert reverted. Reviewers: goldfire, hvr, austin, bgamari, Phyx Reviewed By: Phyx Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2884 GHC Trac Issues: #13008
* Revert "Allow use of the external interpreter in stage1."Tamar Christina2016-12-191-0/+4
| | | | This reverts commit 52ba9470a7e85d025dc84a6789aa809cdd68b566.