Revert "driver: unconditionally disable relaxation when linking partially"
authorRyan Scott <ryan.gl.scott@gmail.com>
Wed, 22 Aug 2018 13:19:42 +0000 (09:19 -0400)
committerRyan Scott <ryan.gl.scott@gmail.com>
Wed, 22 Aug 2018 13:19:42 +0000 (09:19 -0400)
This reverts commit 1cc9061fce4270739677d475190fd6e890e8b1f9.

This appears to break a clean build with certain versions of
`ld.gold`. See
https://phabricator.haskell.org/rGHC1cc9061fce42#132967.

compiler/main/DriverPipeline.hs

index eff542a..a9e486c 100644 (file)
@@ -2171,11 +2171,12 @@ joinObjectFiles dflags o_files output_fn = do
                      ++ (if osInfo == OSFreeBSD
                           then [SysTools.Option "-L/usr/lib"]
                           else [])
-                        -- gcc on sparc sets -Wl,--relax implicitly (another
-                        -- use case is when use passes -optl-Wl,--relax)
-                        -- but -r and --relax are incompatible for ld, so
+                        -- gcc on sparc sets -Wl,--relax implicitly, but
+                        -- -r and --relax are incompatible for ld, so
                         -- disable --relax explicitly.
-                     ++ (if ldIsGnuLd
+                     ++ (if platformArch (targetPlatform dflags)
+                                `elem` [ArchSPARC, ArchSPARC64]
+                         && ldIsGnuLd
                             then [SysTools.Option "-Wl,-no-relax"]
                             else [])
                      ++ map SysTools.Option ld_build_id