diff options
author | Tamar Christina <tamar@zhox.com> | 2016-12-10 21:13:40 +0000 |
---|---|---|
committer | Tamar Christina <tamar@zhox.com> | 2016-12-10 21:13:40 +0000 |
commit | 490b9429a8ed3c55d17bf0964fb14582eb206a3d (patch) | |
tree | b896eafb204d6d43f395e690ae83e7d11f462a99 /driver | |
parent | 0ac5a0082ae2840783b514f02f94ad0376bf8142 (diff) | |
download | haskell-490b9429a8ed3c55d17bf0964fb14582eb206a3d.tar.gz |
Automate GCC driver wrapper
Summary:
Everytime we upgrade the GCC version this wrapper needed updating.
This is a big fragile and we kept forgetting it.
Instead automate it so we don't have to worry about it.
Test Plan: ./validate
Reviewers: austin, bgamari
Reviewed By: bgamari
Subscribers: thomie, #ghc_windows_task_force
Differential Revision: https://phabricator.haskell.org/D2820
GHC Trac Issues: #12871
Diffstat (limited to 'driver')
-rw-r--r-- | driver/gcc/gcc.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/driver/gcc/gcc.c b/driver/gcc/gcc.c index e66accb804..5c7cb15ae5 100644 --- a/driver/gcc/gcc.c +++ b/driver/gcc/gcc.c @@ -17,6 +17,8 @@ int main(int argc, char** argv) { char *preArgv[4]; char *oldPath; char *newPath; + char *base; + char *version; int n; binDir = getExecutablePath(); @@ -42,18 +44,23 @@ int main(int argc, char** argv) { die("putenv failed\n"); } + /* GCC Version. */ + version = mkString("%d.%d.%d", __GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__); + /* Without these -B args, gcc will still work. However, if you have a mingw installation in c:/mingw then it will use files from that in preference to the in-tree files. */ preArgv[0] = mkString("-B%s", binDir); preArgv[1] = mkString("-B%s/../lib", binDir); #ifdef __MINGW64__ - preArgv[2] = mkString("-B%s/../lib/gcc/x86_64-w64-mingw32/6.2.0", binDir); - preArgv[3] = mkString("-B%s/../libexec/gcc/x86_64-w64-mingw32/6.2.0", binDir); + base = mkString("x86_64-w64-mingw32"); #else - preArgv[2] = mkString("-B%s/../lib/gcc/i686-w64-mingw32/6.2.0", binDir); - preArgv[3] = mkString("-B%s/../libexec/gcc/i686-w64-mingw32/6.2.0", binDir); + base = mkString("i686-w64-mingw32"); #endif + + preArgv[2] = mkString("-B%s/../lib/gcc/%s/%s" , binDir, base, version); + preArgv[3] = mkString("-B%s/../libexec/gcc/%s/%s", binDir, base, version); + run(exePath, 4, preArgv, argc - 1, argv + 1); } |