From bb4fae32737585ce62a000acb6ca7a54639c424d Mon Sep 17 00:00:00 2001 From: Matthew Pickering Date: Tue, 18 May 2021 08:41:02 +0100 Subject: hadrian: Correct "Don't always link against libffi" I made a mistake in patch 18893bfe81bc91c2a24815d7320b5e2ec4fee3b0 by assuming that the rts `ffi` flag was True whenever we needed libffi but actual it's only set if we are using the system libffi rather than the one that is built in-tree. Fixes #16022 --- hadrian/src/Settings/Builders/Ghc.hs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hadrian/src/Settings/Builders/Ghc.hs b/hadrian/src/Settings/Builders/Ghc.hs index 1a05681a35..0d4c273103 100644 --- a/hadrian/src/Settings/Builders/Ghc.hs +++ b/hadrian/src/Settings/Builders/Ghc.hs @@ -103,6 +103,7 @@ ghcLinkArgs = builder (Ghc LinkHs) ? do buildPath <- getBuildPath libffiName' <- libffiName debugged <- ghcDebugged <$> expr flavour + needsLibffi <- expr useLibFFIForAdjustors let dynamic = Dynamic `wayUnit` way @@ -124,8 +125,9 @@ ghcLinkArgs = builder (Ghc LinkHs) ? do -- are not actually bundled with the rts. Perhaps ffi should be part of -- rts's extra libraries instead of extra bundled libraries in that -- case. Care should be take as to not break the make build. - rtsFfiArg = package rts ? (not useSystemFfi && libffiName' `elem` libs) ? mconcat + rtsFfiArg = package rts ? (not useSystemFfi && needsLibffi) ? mconcat [ arg ("-L" ++ buildPath) + , arg ("-l" ++ libffiName') ] -- This is the -rpath argument that is required for the bindist scenario -- cgit v1.2.1