Skip to content

Commit

Permalink
Reverse change as a test
Browse files Browse the repository at this point in the history
  • Loading branch information
erikd committed Sep 19, 2023
1 parent 8c0b0d5 commit 969b58e
Showing 1 changed file with 3 additions and 12 deletions.
15 changes: 3 additions & 12 deletions Cabal/src/Distribution/Simple/Program/Ld.hs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ module Distribution.Simple.Program.Ld
import Distribution.Compat.Prelude
import Prelude ()

import qualified Data.Map as Map

import Distribution.Simple.Compiler (arResponseFilesSupported)
import Distribution.Simple.Flag
( fromFlagOrDefault
Expand Down Expand Up @@ -69,10 +67,10 @@ combineObjectFiles verbosity lbi ld target files = do
-- have a slight problem. What we have to do is link files in batches into
-- a temp object file and then include that one in the next batch.

let simpleArgs = prependRelocatableFlag ["-o", target]
let simpleArgs = ["-r", "-o", target]

initialArgs = prependRelocatableFlag ["-o", target]
middleArgs = prependRelocatableFlag ["-o", target, tmpfile]
initialArgs = ["-r", "-o", target]
middleArgs = ["-r", "-o", target, tmpfile]
finalArgs = middleArgs

simple = programInvocation ld simpleArgs
Expand Down Expand Up @@ -106,10 +104,3 @@ combineObjectFiles verbosity lbi ld target files = do
runProgramInvocation verbosity inv
renameFile target tmpfile
run invs

-- Prepend "-r" to the list if the linker supports relocatable outputs.
prependRelocatableFlag :: [String] -> [String]
prependRelocatableFlag xs =
case Map.lookup "Supports relocatable output" $ programProperties ld of
Just "YES" -> "-r" : xs
_other -> xs

0 comments on commit 969b58e

Please sign in to comment.