driver: unconditionally disable relaxation when linking partially
ClosedPublic

Authored by trofi on Jun 23 2018, 5:51 AM.

Details

Summary

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

Diff Detail

Repository
rGHC Glasgow Haskell Compiler
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
trofi created this revision.Jun 23 2018, 5:51 AM
bgamari accepted this revision.Aug 21 2018, 11:15 AM

Looks reasonable.

This revision is now accepted and ready to land.Aug 21 2018, 11:15 AM
This revision was automatically updated to reflect the committed changes.