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

Matthew Pickering (@mpickering) gitlab at gitlab.haskell.org
Tue Jan 3 17:46:23 UTC 2023



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


Commits:
85a3348f by Matthew Pickering at 2023-01-03T17:46:01+00:00
darwin: Always pass -no_fixup_chains 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/85a3348ff72b12eaf87b4048265ac335fe8cdf30

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/85a3348ff72b12eaf87b4048265ac335fe8cdf30
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/20230103/ca934bfd/attachment-0001.html>


More information about the ghc-commits mailing list