Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chain the configuration of ldProgram #9269

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/bootstrap.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
key: bootstrap-${{ runner.os }}-${{ matrix.ghc }}-20221115-${{ github.sha }}
restore-keys: bootstrap-${{ runner.os }}-${{ matrix.ghc }}-20221115-

- uses: actions/checkout@v3
- uses: actions/checkout@v4
# See https://github.com/haskell/cabal/pull/8739
- name: Sudo chmod to permit ghcup to update its cache
run: |
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/changelogs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:
run: cabal v2-update
# Cannot install it from tarball due to
# https://github.com/haskell/cabal/issues/7360
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
repository: "fgaz/changelog-d"
path: "changelog-d"
Expand All @@ -59,7 +59,7 @@ jobs:
pushd changelog-d
cabal v2-install
popd
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Run changelog-d
run: |
changelog-d changelog.d
2 changes: 1 addition & 1 deletion .github/workflows/format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
fourmolu:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: haskell-actions/run-fourmolu@v8
with:
pattern: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
hlint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: haskell/actions/hlint-setup@v2
with:
version: "3.5"
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/quick-jobs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:
run: cabal v2-update
- name: Install alex
run: cabal v2-install alex --constraint='alex ==3.2.7.3'
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Regenerate files
run: |
make -B lexer
Expand Down Expand Up @@ -87,7 +87,7 @@ jobs:
ghcup install cabal --set latest
- name: Update Hackage index
run: cabal v2-update
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Install doctest
run: make doctest-install
- name: Doctest
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/users-guide.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:
python-version: ['3.10']

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: recursive

Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ jobs:

steps:

- uses: actions/checkout@v3
- uses: actions/checkout@v4

# See the following link for a breakdown of the following step
# https://github.com/haskell/actions/issues/7#issuecomment-745697160
Expand Down Expand Up @@ -197,7 +197,7 @@ jobs:
# cause it does not work with the git version included in it, see:
# https://github.com/actions/checkout/issues/170
# https://github.com/actions/checkout/issues/295
# - uses: actions/checkout@v3
# - uses: actions/checkout@v4
- name: Checkout
run: |
echo $GITHUB_REF $GITHUB_SHA
Expand Down Expand Up @@ -251,7 +251,7 @@ jobs:
ghc: ${{ fromJSON (needs.validate.outputs.GHC_FOR_RELEASE) }}

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

# See https://github.com/haskell/cabal/pull/8739
- name: Sudo chmod to permit ghcup to update its cache
Expand Down
2 changes: 1 addition & 1 deletion .gitlab/brew.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ brew_dir="${CI_PROJECT_DIR}/.brew"

if [ ! -e "${brew_dir}" ]; then
mkdir -p "${brew_dir}"
curl -L "https://github.com/Homebrew/brew/archive/refs/tags/${BREW_VERSION}.tar.gz" | tar xz --strip 1 -C "${brew_dir}"
curl --fail-with-body -L "https://github.com/Homebrew/brew/archive/refs/tags/${BREW_VERSION}.tar.gz" | tar xz --strip 1 -C "${brew_dir}"
fi

export PATH="${brew_dir}/bin:${brew_dir}/sbin:$PATH"
Expand Down
4 changes: 2 additions & 2 deletions Cabal-syntax/Cabal-syntax.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@ library
array >= 0.4.0.1 && < 0.6,
base >= 4.9 && < 5,
binary >= 0.7 && < 0.9,
bytestring >= 0.10.0.0 && < 0.12,
bytestring >= 0.10.0.0 && < 0.13,
containers >= 0.5.0.0 && < 0.7,
deepseq >= 1.3.0.1 && < 1.6,
directory >= 1.2 && < 1.4,
filepath >= 1.3.0.1 && < 1.5,
mtl >= 2.1 && < 2.4,
parsec >= 3.1.13.0 && < 3.2,
pretty >= 1.1.1 && < 1.2,
text (>= 1.2.3.0 && < 1.3) || (>= 2.0 && < 2.1),
text (>= 1.2.3.0 && < 1.3) || (>= 2.0 && < 2.2),
time >= 1.4.0.1 && < 1.13,
-- transformers-0.4.0.0 doesn't have record syntax e.g. for Identity
-- See also https://github.com/ekmett/transformers-compat/issues/35
Expand Down
605 changes: 0 additions & 605 deletions Cabal-syntax/src/Distribution/Fields/Lexer.hs

This file was deleted.

4 changes: 3 additions & 1 deletion Cabal-syntax/src/Distribution/System.hs
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ buildOS = classifyOS Permissive System.Info.os

-- | These are the known Arches: I386, X86_64, PPC, PPC64, Sparc,
-- Arm, AArch64, Mips, SH, IA64, S390, S390X, Alpha, Hppa, Rs6000,
-- M68k, Vax, RISCV64, JavaScript and Wasm32.
-- M68k, Vax, RISCV64, LoongArch64, JavaScript and Wasm32.
--
-- The following aliases can also be used:
-- * PPC alias: powerpc
Expand Down Expand Up @@ -211,6 +211,7 @@ data Arch
| M68k
| Vax
| RISCV64
| LoongArch64
| JavaScript
| Wasm32
| OtherArch String
Expand Down Expand Up @@ -240,6 +241,7 @@ knownArches =
, M68k
, Vax
, RISCV64
, LoongArch64
, JavaScript
, Wasm32
]
Expand Down
4 changes: 2 additions & 2 deletions Cabal-tests/tests/UnitTests/Distribution/Utils/Structured.hs
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ tests = testGroup "Distribution.Utils.Structured"
-- The difference is in encoding of newtypes
#if MIN_VERSION_base(4,7,0)
, testCase "GenericPackageDescription" $
md5Check (Proxy :: Proxy GenericPackageDescription) 0xedd391339de1201511636bbb563fa5db
md5Check (Proxy :: Proxy GenericPackageDescription) 0x6ad1e12c6f88291e9b8c131d239eda70
, testCase "LocalBuildInfo" $
md5Check (Proxy :: Proxy LocalBuildInfo) 0x40253e3699453643336bdc7911717af0
md5Check (Proxy :: Proxy LocalBuildInfo) 0xbc7ac84a9bc43345c812af222c3e5ba0
#endif
]

Expand Down
4 changes: 2 additions & 2 deletions Cabal/Cabal.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ library
Cabal-syntax ^>= 3.11,
array >= 0.4.0.1 && < 0.6,
base >= 4.9 && < 5,
bytestring >= 0.10.0.0 && < 0.12,
bytestring >= 0.10.0.0 && < 0.13,
containers >= 0.5.0.0 && < 0.7,
deepseq >= 1.3.0.1 && < 1.6,
directory >= 1.2 && < 1.4,
Expand Down Expand Up @@ -305,7 +305,7 @@ library
-- See also https://github.com/ekmett/transformers-compat/issues/35
transformers (>= 0.3 && < 0.4) || (>=0.4.1.0 && <0.7),
mtl >= 2.1 && < 2.4,
text (>= 1.2.3.0 && < 1.3) || (>= 2.0 && < 2.1),
text (>= 1.2.3.0 && < 1.3) || (>= 2.0 && < 2.2),
parsec >= 3.1.13.0 && < 3.2

other-modules:
Expand Down
27 changes: 1 addition & 26 deletions Cabal/src/Distribution/Simple/Configure.hs
Original file line number Diff line number Diff line change
Expand Up @@ -767,22 +767,6 @@ configure (pkg_descr0, pbi) cfg = do
)
return False

let compilerSupportsGhciLibs :: Bool
compilerSupportsGhciLibs =
case compilerId comp of
CompilerId GHC version
| version > mkVersion [9, 3] && windows ->
False
CompilerId GHC _ ->
True
CompilerId GHCJS _ ->
True
_ -> False
where
windows = case compPlatform of
Platform _ Windows -> True
Platform _ _ -> False

let ghciLibByDefault =
case compilerId comp of
CompilerId GHC _ ->
Expand All @@ -799,15 +783,6 @@ configure (pkg_descr0, pbi) cfg = do
not (GHCJS.isDynamic comp)
_ -> False

withGHCiLib_ <-
case fromFlagOrDefault ghciLibByDefault (configGHCiLib cfg) of
True | not compilerSupportsGhciLibs -> do
warn verbosity $
"--enable-library-for-ghci is no longer supported on Windows with"
++ " GHC 9.4 and later; ignoring..."
return False
v -> return v

let sharedLibsByDefault
| fromFlag (configDynExe cfg) =
-- build a shared library if dynamically-linked
Expand Down Expand Up @@ -912,7 +887,7 @@ configure (pkg_descr0, pbi) cfg = do
, withProfExeDetail = ProfDetailNone
, withOptimization = fromFlag $ configOptimization cfg
, withDebugInfo = fromFlag $ configDebugInfo cfg
, withGHCiLib = withGHCiLib_
, withGHCiLib = fromFlagOrDefault ghciLibByDefault $ configGHCiLib cfg
, splitSections = split_sections
, splitObjs = split_objs
, stripExes = strip_exe
Expand Down
4 changes: 3 additions & 1 deletion Cabal/src/Distribution/Simple/GHC/Internal.hs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,9 @@ configureToolchain _implInfo ghcProg ghcInfo =
. addKnownProgram
ldProgram
{ programFindLocation = findProg ldProgramName extraLdPath
, programPostConf = configureLd
, programPostConf = \v cp ->
-- Call any existing configuration first and then add any new configuration
configureLd v =<< programPostConf ldProgram v cp
}
. addKnownProgram
arProgram
Expand Down
1 change: 1 addition & 0 deletions Cabal/src/Distribution/Simple/PreProcess.hs
Original file line number Diff line number Diff line change
Expand Up @@ -863,6 +863,7 @@ platformDefines lbi =
M68k -> ["m68k"]
Vax -> ["vax"]
RISCV64 -> ["riscv64"]
LoongArch64 -> ["loongarch64"]
JavaScript -> ["javascript"]
Wasm32 -> ["wasm32"]
OtherArch _ -> []
Expand Down
4 changes: 3 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,9 @@ 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 = if "-relocatable" `isInfixOf` ldHelpOutput then "YES" else "NO"
m = Map.insert k v (programProperties ldProg)
return $ ldProg{programProperties = m}
}
Expand Down
19 changes: 16 additions & 3 deletions Cabal/src/Distribution/Simple/Program/Ld.hs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ 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 @@ -67,10 +69,14 @@ 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 = ["-r", "-o", target]
putStrLn "\n\n\n"
print ld
putStrLn "\n\n\n"

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

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

simple = programInvocation ld simpleArgs
Expand Down Expand Up @@ -104,3 +110,10 @@ 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
7 changes: 1 addition & 6 deletions Cabal/src/Distribution/Simple/Setup/Config.hs
Original file line number Diff line number Diff line change
Expand Up @@ -322,12 +322,7 @@ defaultConfigFlags progDb =
, configCabalFilePath = NoFlag
, configVerbosity = Flag normal
, configUserInstall = Flag False -- TODO: reverse this
#if defined(mingw32_HOST_OS)
-- See #8062 and GHC #21019.
, configGHCiLib = Flag False
#else
, configGHCiLib = NoFlag
#endif
, configGHCiLib = Flag True
, configSplitSections = Flag False
, configSplitObjs = Flag False -- takes longer, so turn off by default
, configStripExes = NoFlag
Expand Down
2 changes: 1 addition & 1 deletion cabal-install-solver/cabal-install-solver.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ library
build-depends:
, array >=0.4 && <0.6
, base >=4.10 && <4.19
, bytestring >=0.10.6.0 && <0.12
, bytestring >=0.10.6.0 && <0.13
, Cabal ^>=3.11
, Cabal-syntax ^>=3.11
, containers >=0.5.6.2 && <0.7
Expand Down
2 changes: 1 addition & 1 deletion cabal-install/cabal-install.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ library
base16-bytestring >= 0.1.1 && < 1.1.0.0,
base64-bytestring >= 1.0 && < 1.3,
binary >= 0.7.3 && < 0.9,
bytestring >= 0.10.6.0 && < 0.12,
bytestring >= 0.10.6.0 && < 0.13,
containers >= 0.5.6.2 && < 0.7,
cryptohash-sha256 >= 0.11 && < 0.12,
directory >= 1.3.7.0 && < 1.4,
Expand Down
7 changes: 4 additions & 3 deletions cabal-install/src/Distribution/Client/BuildReports/Upload.hs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import Distribution.Client.HttpUtils
import Distribution.Client.Setup
( RepoContext (..)
)
import Distribution.Client.Types.Credentials (Auth)
import Distribution.Simple.Utils (die')
import System.FilePath.Posix
( (</>)
Expand All @@ -36,15 +37,15 @@ import System.FilePath.Posix
type BuildReportId = URI
type BuildLog = String

uploadReports :: Verbosity -> RepoContext -> (String, String) -> URI -> [(BuildReport, Maybe BuildLog)] -> IO ()
uploadReports :: Verbosity -> RepoContext -> Auth -> URI -> [(BuildReport, Maybe BuildLog)] -> IO ()
uploadReports verbosity repoCtxt auth uri reports = do
for_ reports $ \(report, mbBuildLog) -> do
buildId <- postBuildReport verbosity repoCtxt auth uri report
case mbBuildLog of
Just buildLog -> putBuildLog verbosity repoCtxt auth buildId buildLog
Nothing -> return ()

postBuildReport :: Verbosity -> RepoContext -> (String, String) -> URI -> BuildReport -> IO BuildReportId
postBuildReport :: Verbosity -> RepoContext -> Auth -> URI -> BuildReport -> IO BuildReportId
postBuildReport verbosity repoCtxt auth uri buildReport = do
let fullURI = uri{uriPath = "/package" </> prettyShow (BuildReport.package buildReport) </> "reports"}
transport <- repoContextGetTransport repoCtxt
Expand Down Expand Up @@ -87,7 +88,7 @@ postBuildReport verbosity repoCtxt auth uri buildReport = do
putBuildLog
:: Verbosity
-> RepoContext
-> (String, String)
-> Auth
-> BuildReportId
-> BuildLog
-> IO ()
Expand Down
Loading
Loading