[Git][ghc/ghc][wip/22426] darwin: Always pass -no_fixup_chain to linker

Matthew Pickering (@mpickering) gitlab at gitlab.haskell.org
Wed Jan 4 10:27:26 UTC 2023



Matthew Pickering pushed to branch wip/22426 at Glasgow Haskell Compiler / GHC


Commits:
84df1f21 by Matthew Pickering at 2023-01-04T10:27:18+00:00
darwin: Always pass -no_fixup_chain to linker

Recent versions of MacOS use a version of ld where `-fixup_chain` is on by default.
This is incompatible with our usage of `-undefined dynamic_lookup`. Therefore we
explicitly disable `fixup-chain` by passing `-no_fixup_chain` to the linker on
darwin. This results in a warning of the form:

ld: warning: -undefined dynamic_lookup may not work with chained fixups

The manual explains the incompatible nature of these two flags:

     -undefined treatment
             Specifies how undefined symbols are to be treated. Options are: error, warning,
             suppress, or dynamic_lookup.  The default is error. Note: dynamic_lookup that
             depends on lazy binding will not work with chained fixups.

A relevant ticket is #22429

- - - - -


1 changed file:

- compiler/GHC/SysTools/Info.hs


Changes:

=====================================
compiler/GHC/SysTools/Info.hs
=====================================
@@ -136,7 +136,8 @@ getLinkerInfo' logger dflags = do
         -- Darwin has neither GNU Gold or GNU LD, but a strange linker
         -- that doesn't support --version. We can just assume that's
         -- what we're using.
-        return $ DarwinLD []
+        -- See Note [Dynamic lookup and chained fixups]
+        return $ DarwinLD ["-Wl,-no_fixup_chains"]
       OSMinGW32 ->
         -- GHC doesn't support anything but GNU ld on Windows anyway.
         -- Process creation is also fairly expensive on win32, so
@@ -236,3 +237,27 @@ getCompilerInfo' logger pgm = do
             text "Make sure you're using GNU gcc, or clang"
           return UnknownCC
       )
+
+{-
+Note [Dynamic lookup and chained fixups]
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Recent versions of MacOS use a version of ld where `-fixup_chain` is on by default.
+This is incompatible with our usage of `-undefined dynamic_lookup`. Therefore we
+explicitly disable `fixup-chain` by passing `-no_fixup_chain` to the linker on
+darwin. This results in a warning of the form:
+
+ld: warning: -undefined dynamic_lookup may not work with chained fixups
+
+The manual explains the incompatible nature of these two flags:
+
+     -undefined treatment
+             Specifies how undefined symbols are to be treated. Options are: error, warning,
+             suppress, or dynamic_lookup.  The default is error. Note: dynamic_lookup that
+             depends on lazy binding will not work with chained fixups.
+
+A relevant ticket is #22429
+
+-}
+
+



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

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/84df1f217f92eb698188c8371c66c59dca26691c
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/20230104/fc7ddadd/attachment-0001.html>


More information about the ghc-commits mailing list