[commit: ghc] master: Automate GCC driver wrapper (490b942)

git at git.haskell.org git at git.haskell.org
Sat Dec 10 21:14:30 UTC 2016


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/490b9429a8ed3c55d17bf0964fb14582eb206a3d/ghc

>---------------------------------------------------------------

commit 490b9429a8ed3c55d17bf0964fb14582eb206a3d
Author: Tamar Christina <tamar at zhox.com>
Date:   Sat Dec 10 21:13:40 2016 +0000

    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


>---------------------------------------------------------------

490b9429a8ed3c55d17bf0964fb14582eb206a3d
 driver/gcc/gcc.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/driver/gcc/gcc.c b/driver/gcc/gcc.c
index e66accb..5c7cb15 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);
 }
 



More information about the ghc-commits mailing list