summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Ericson <John.Ericson@Obsidian.Systems>2023-01-09 14:34:29 -0500
committerJohn Ericson <John.Ericson@Obsidian.Systems>2023-01-09 14:38:52 -0500
commit4d008095c8edaec4d199254bdc1a8b6efa346918 (patch)
tree88a4f9231abc1b394382e40824a0415be7eb694b
parentcdfdfed2552c553f36c1328ca2e6f9cc105f942d (diff)
downloadhaskell-wip/remove-everywhere-permissive-mach-o-linking.tar.gz
Draft: Don't always pass `-undefined dynamic_lookup` when linking Mach-Oswip/remove-everywhere-permissive-mach-o-linking
As the now-removed comment said, this is only justified for the cyclic dependencies of the RTS. For everything else we should just pass the dependencies to the linker so it can audit that after dynamic loading all symbols should be defined. But now we specify `-undefined dynamic_lookup` in the RTS's linker flags, so that justification no longer applies. Let's remove this and see what happens.
-rw-r--r--compiler/GHC/Linker/Dynamic.hs14
-rw-r--r--rts/rts.cabal.in4
2 files changed, 3 insertions, 15 deletions
diff --git a/compiler/GHC/Linker/Dynamic.hs b/compiler/GHC/Linker/Dynamic.hs
index 171503d4d6..141188cff5 100644
--- a/compiler/GHC/Linker/Dynamic.hs
+++ b/compiler/GHC/Linker/Dynamic.hs
@@ -135,16 +135,6 @@ linkDynLib logger tmpfs dflags0 unit_env o_files dep_packages
-- About the options used for Darwin:
-- -dynamiclib
-- Apple's way of saying -shared
- -- -undefined dynamic_lookup:
- -- Without these options, we'd have to specify the correct
- -- dependencies for each of the dylibs. Note that we could
- -- (and should) do without this for all libraries except
- -- the RTS; all we need to do is to pass the correct
- -- HSfoo_dyn.dylib files to the link command.
- -- This feature requires Mac OS X 10.3 or later; there is
- -- a similar feature, -flat_namespace -undefined suppress,
- -- which works on earlier versions, but it has other
- -- disadvantages.
-- -single_module
-- Build the dynamic library as a single "module", i.e. no
-- dynamic binding nonsense when referring to symbols from
@@ -174,9 +164,7 @@ linkDynLib logger tmpfs dflags0 unit_env o_files dep_packages
, FileOption "" output_fn
]
++ map Option o_files
- ++ [ Option "-undefined",
- Option "dynamic_lookup",
- Option "-single_module" ]
+ ++ [ Option "-single_module" ]
++ (if platformArch platform `elem` [ ArchX86_64, ArchAArch64 ]
then [ ]
else [ Option "-Wl,-read_only_relocs,suppress" ])
diff --git a/rts/rts.cabal.in b/rts/rts.cabal.in
index ba2524d593..1f10db79b4 100644
--- a/rts/rts.cabal.in
+++ b/rts/rts.cabal.in
@@ -742,8 +742,8 @@ library
-- whitelist each such symbol with an additional `-U` (see the man page for more
-- details).
--
--- GHC already does `-undefined dynamic_lookup`, so we just do that for now, but
--- we might try to get more precise with `-U` in the future.
+-- We do `-undefined dynamic_lookup` for now, but we might try to get more
+-- precise with `-U` in the future.
--
-- Note that the RTS also `-u`s some atomics symbols that *are* defined --- and
-- defined within the RTS! It is not immediately clear why this is needed. This