Commit 7b211b4e authored by Tamar Christina's avatar Tamar Christina Committed by Ben Gamari

Upgrade GCC to 5.2.0 for Windows x86 and x86_64

This patch does a few things

- Moved GHC x86 to MinGW-w64 (Using Awson's patch)
- Moves Both GHCs to MSYS2 toolchains
- Completely removes the dependencies on the git tarball repo
  - Downloads only the required tarball for the architecture for
    which we are building
  - Downloads the perl tarball is missing as well
  - Fixed a few bugs in the linker to fix tests on Windows

The links currently point to repo.msys2.org and GitHub, it might be
more desirable to mirror them on
http://downloads.haskell.org/~ghc/mingw/ as with the previous patch
attempt.

For more details on what the MSYS2 packages I include see #10726
(Awson's comment). but it should contain all we need
and no python or fortran, which makes the uncompressed tar a 1-2
hundreds mb smaller.

The `GCC 5.2.0` in the package supports `libgcc` as a shared library,
this is a problem since
when compiling with -shared the produced dll now has a dependency on
`libgcc_s_sjlj-1.dll`.
To solve this the flag `-static-libgcc` is now being used for all GCC
calls on windows.

Test Plan:
./validate was ran both on x86 and x86_64 windows and compared against
the baseline.

A few test were failing due to Ld no longer being noisy. These were
updated.

The changes to the configure script *should* be validated by the build
bots for the other platforms before landing

Reviewers: simonmar, awson, bgamari, austin, thomie

Reviewed By: thomie

Subscribers: #ghc_windows_task_force, thomie, awson

Differential Revision: https://phabricator.haskell.org/D1123

GHC Trac Issues: #10726, #9014, #9218, #10435
parent b0dee610
......@@ -738,6 +738,30 @@ The flag is only needed on ELF systems. On Windows (PE) and Mac OS X
-}
{- Note [Windows static libGCC]
The GCC versions being upgraded to in #10726 are configured with
dynamic linking of libgcc supported. This results in libgcc being
linked dynamically when a shared library is created.
This introduces thus an extra dependency on GCC dll that was not
needed before by shared libraries created with GHC. This is a particular
issue on Windows because you get a non-obvious error due to this missing
dependency. This dependent dll is also not commonly on your path.
For this reason using the static libgcc is preferred as it preserves
the same behaviour that existed before. There are however some very good
reasons to have the shared version as well as described on page 181 of
https://gcc.gnu.org/onlinedocs/gcc-5.2.0/gcc.pdf :
"There are several situations in which an application should use the
shared ‘libgcc’ instead of the static version. The most common of these
is when the application wishes to throw and catch exceptions across different
shared libraries. In that case, each of the libraries as well as the application
itself should use the shared ‘libgcc’. "
-}
neededLinkArgs :: LinkerInfo -> [Option]
neededLinkArgs (GnuLD o) = o
neededLinkArgs (GnuGold o) = o
......@@ -815,7 +839,9 @@ getLinkerInfo' dflags = do
, "-Wl,--reduce-memory-overheads"
-- Increase default stack, see
-- Note [Windows stack usage]
, "-Xlinker", "--stack=0x800000,0x800000" ]
-- Force static linking of libGCC
-- Note [Windows static libGCC]
, "-Xlinker", "--stack=0x800000,0x800000", "-static-libgcc" ]
_ -> do
-- In practice, we use the compiler as the linker here. Pass
-- -Wl,--version to get linker version info.
......
This diff is collapsed.
......@@ -47,9 +47,13 @@ int main(int argc, char** argv) {
from that in preference to the in-tree files. */
preArgv[0] = mkString("-B%s", binDir);
preArgv[1] = mkString("-B%s/../lib", binDir);
preArgv[2] = mkString("-B%s/../lib/gcc/mingw32/4.5.2", binDir);
preArgv[3] = mkString("-B%s/../libexec/gcc/mingw32/4.5.2", binDir);
#ifdef __MINGW64__
preArgv[2] = mkString("-B%s/../lib/gcc/x86_64-w64-mingw32/5.2.0", binDir);
preArgv[3] = mkString("-B%s/../libexec/gcc/x86_64-w64-mingw32/5.2.0", binDir);
#else
preArgv[2] = mkString("-B%s/../lib/gcc/i686-w64-mingw32/5.2.0", binDir);
preArgv[3] = mkString("-B%s/../libexec/gcc/i686-w64-mingw32/5.2.0", binDir);
#endif
run(exePath, 4, preArgv, argc - 1, argv + 1);
}
This diff is collapsed.
# The format of the lines in this file is:
# localpath remotepath
# where
# * localpath is where to put the repository in a checked out tree,
# * remotepath is where the tarball is in the central repository.
#
# Lines that start with a '#' are comments.
mingw/binutils-2.19.1-mingw32-bin.tar.gz ghc-tarballs/binutils-2.19.1-mingw32-bin.tar.gz
mingw/gcc-core-3.4.5-20060117-3.tar.gz ghc-tarballs/gcc-core-3.4.5-20060117-3.tar.gz
mingw/mingw-runtime-3.14.tar.gz ghc-tarballs/mingw-runtime-3.14.tar.gz
mingw/w32api-3.13-mingw32-dev.tar.gz ghc-tarballs/w32api-3.13-mingw32-dev.tar.gz
libffi/tarball/libffi-3.0.8.tar.gz ghc-tarballs/libffi-3.0.8.tar.gz
Creating library file: T5435_load_dyn_asm.dll.a
Creating library file: T5435_load_dyn_gcc.dll.a
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment