Simon Marlow pushed to branch wip/simonmar/rts-ld-options at Glasgow Haskell Compiler / GHC
Commits:
-
06406143
by Simon Marlow at 2026-11-05T10:57:35+00:00
3 changed files:
Changes:
| ... | ... | @@ -321,13 +321,6 @@ linkExecutable logger tmpfs opts unit_env o_files dep_units = do |
| 321 | 321 | ++ pkg_lib_path_opts
|
| 322 | 322 | ++ extraLinkObj
|
| 323 | 323 | ++ noteLinkObjs
|
| 324 | - -- See Note [RTS/ghc-internal interface]
|
|
| 325 | - -- (-u<sym> must come before -lghc-internal...!)
|
|
| 326 | - ++ (if ghcInternalUnitId `elem` map unitId pkgs
|
|
| 327 | - then [concat [ "-Wl,-u,"
|
|
| 328 | - , ['_' | platformLeadingUnderscore platform]
|
|
| 329 | - , "init_ghc_hs_iface" ]]
|
|
| 330 | - else [])
|
|
| 331 | 324 | ++ pkg_link_opts
|
| 332 | 325 | ++ pkg_framework_opts
|
| 333 | 326 | ++ (if platformOS platform == OSDarwin
|
| ... | ... | @@ -38,8 +38,8 @@ |
| 38 | 38 | * explicit.
|
| 39 | 39 | *
|
| 40 | 40 | * Note that the init_ghc_hs_iface symbol is explicitly included in the final
|
| 41 | - * binary via the linker flag `-uinit_ghc_hs_iface`, when an executable is
|
|
| 42 | - * linked against ghc-internal by GHC.
|
|
| 41 | + * binary via the linker flag `-uinit_ghc_hs_iface`, which we put
|
|
| 42 | + * in the rts package's ld-options.
|
|
| 43 | 43 | *
|
| 44 | 44 | * `-uinit_ghc_hs_iface` ensures that the `init_ghc_hs_iface` symbol is
|
| 45 | 45 | * included in the final link, even when we link against `ghc-internal.a`
|
| ... | ... | @@ -351,6 +351,13 @@ library |
| 351 | 351 | stg/Ticky.h
|
| 352 | 352 | stg/Types.h
|
| 353 | 353 | |
| 354 | + -- The RTS calls init_ghc_hs_iface, which is defined in ghc-internal: see
|
|
| 355 | + -- Note [RTS/ghc-internal interface] in RtsToHsIface.c.
|
|
| 356 | + if flag(leading-underscore)
|
|
| 357 | + ld-options: -Wl,-u,_init_ghc_hs_iface
|
|
| 358 | + else
|
|
| 359 | + ld-options: -Wl,-u,init_ghc_hs_iface
|
|
| 360 | + |
|
| 354 | 361 | if os(osx)
|
| 355 | 362 | ld-options: "-Wl,-search_paths_first"
|
| 356 | 363 | if !arch(x86_64) && !arch(aarch64)
|