[Git][ghc/ghc][wip/22426] darwin: Always pass -no_fixup_chains to linker
Matthew Pickering (@mpickering)
gitlab at gitlab.haskell.org
Wed Jan 4 10:30:22 UTC 2023
Matthew Pickering pushed to branch wip/22426 at Glasgow Haskell Compiler / GHC
Commits:
fef9849e by Matthew Pickering at 2023-01-04T10:30:16+00:00
darwin: Always pass -no_fixup_chains to linker
Recent versions of MacOS use a version of ld where `-fixup_chains` is on by default.
This is incompatible with our usage of `-undefined dynamic_lookup`. Therefore we
explicitly disable `fixup-chains` by passing `-no_fixup_chains` 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 [Option "-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_chains` is on by default.
+This is incompatible with our usage of `-undefined dynamic_lookup`. Therefore we
+explicitly disable `fixup_chains` by passing `-no_fixup_chains` 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/fef9849e490391139587041f21a5c747e3a07b1c
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/fef9849e490391139587041f21a5c747e3a07b1c
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/31eb5337/attachment-0001.html>
More information about the ghc-commits
mailing list