[Git][ghc/ghc][wip/haskell-nix-patches/native/sanity-check-find-file-name] darwin: prevent macos linker from loading clang++

doyougnu (@doyougnu) gitlab at gitlab.haskell.org
Mon Jul 8 15:56:18 UTC 2024



doyougnu pushed to branch wip/haskell-nix-patches/native/sanity-check-find-file-name at Glasgow Haskell Compiler / GHC


Commits:
ee76db2f by doyougnu at 2024-07-08T11:51:51-04:00
darwin: prevent macos linker from loading clang++

-- part of upstreaming the haskell.nix patches

-- see https://github.com/input-output-hk/haskell.nix/pull/2050

-- on macOS GHC queries `clang --print-file-name=c++` which will return
`c++` which GHC then tries to load. This patch ensures that GHC will not
try to load the executable.

- - - - -


1 changed file:

- compiler/GHC/Linker/Loader.hs


Changes:

=====================================
compiler/GHC/Linker/Loader.hs
=====================================
@@ -1486,7 +1486,8 @@ searchForLibUsingGcc logger dflags so dirs = do
    if (file == so)
       then return Nothing
       else do b <- doesFileExist file -- file could be a folder (see #16063)
-              return (if b then Just file else Nothing)
+              let c = any (`isExtensionOf` file) [".o", ".a", ".so", ".dylib", ".lib", ".dll"]
+              return (if b && c then Just file else Nothing)
 
 -- | Retrieve the list of search directory GCC and the System use to find
 --   libraries and components. See Note [Fork/Exec Windows].



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/ee76db2f26085fedca103c8be680dbe5e092ef58

-- 
This project does not include diff previews in email notifications.
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/ee76db2f26085fedca103c8be680dbe5e092ef58
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20240708/f9312432/attachment.html>


More information about the ghc-commits mailing list