Skip to content

Commit

Permalink
Fix configuation of ldProgram
Browse files Browse the repository at this point in the history
Standard GNU `ld` ues `--relocatable` while `ld.gold` uses a `-relocatable`
flag (with a single `-`). Code will now detect both versions.
  • Loading branch information
erikd committed Nov 14, 2023
1 parent fe24c78 commit fc440b8
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion Cabal/src/Distribution/Simple/Program/Builtin.hs
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,19 @@ ldProgram =
-- `lld` only accepts `-help`.
`catchIO` (\_ -> return "")
let k = "Supports relocatable output"
v = if "--relocatable" `isInfixOf` ldHelpOutput then "YES" else "NO"
-- Standard GNU `ld` ues `--relocatable` while `ld.gold` uses
-- `-relocatable` (single `-`).
v
| "-relocatable" `isInfixOf` ldHelpOutput = "YES"
-- ld64 on macOS has this lovely response for "--help"
--
-- ld64: For information on command line options please use 'man ld'.
--
-- it does however support -r, if you read the manpage
-- (e.g. https://www.manpagez.com/man/1/ld64/)
| "ld64:" `isPrefixOf` ldHelpOutput = "YES"
| otherwise = "NO"

m = Map.insert k v (programProperties ldProg)
return $ ldProg{programProperties = m}
}
Expand Down

0 comments on commit fc440b8

Please sign in to comment.