[Git][ghc/ghc][master] rts: remove -Wl,-U,___darwin_check_fd_set_overflow hack

Marge Bot (@marge-bot) gitlab at gitlab.haskell.org
Tue Nov 26 13:26:30 UTC 2024



Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC


Commits:
88c4fe1d by Cheng Shao at 2024-11-26T08:25:34-05:00
rts: remove -Wl,-U,___darwin_check_fd_set_overflow hack

This patch bumps macOS minimum SDK version to 11.0 for x86_64-darwin
to align it with aarch64-darwin. This allows us to get rid of the
horrible -Wl,-U,___darwin_check_fd_set_overflow hack, which is causing
linker warnings and testsuite failures on macOS 15. Fixes #25504.

- - - - -


3 changed files:

- .gitlab/generate-ci/gen_ci.hs
- .gitlab/jobs.yaml
- rts/rts.cabal


Changes:

=====================================
.gitlab/generate-ci/gen_ci.hs
=====================================
@@ -444,7 +444,7 @@ opsysVariables AArch64 (Darwin {}) =
           ]
 opsysVariables Amd64 (Darwin {}) =
   mconcat [ "NIX_SYSTEM" =: "x86_64-darwin"
-          , "MACOSX_DEPLOYMENT_TARGET" =: "10.13"
+          , "MACOSX_DEPLOYMENT_TARGET" =: "11.0"
           -- "# Only Sierra and onwards supports clock_gettime. See #12858"
           , "ac_cv_func_clock_gettime" =: "no"
           -- # Only newer OS Xs support utimensat. See #17895


=====================================
.gitlab/jobs.yaml
=====================================
@@ -1072,7 +1072,7 @@
       "HADRIAN_ARGS": "--docs=no-sphinx-pdfs",
       "INSTALL_CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check",
       "LANG": "en_US.UTF-8",
-      "MACOSX_DEPLOYMENT_TARGET": "10.13",
+      "MACOSX_DEPLOYMENT_TARGET": "11.0",
       "NIX_SYSTEM": "x86_64-darwin",
       "RUNTEST_ARGS": "",
       "TEST_ENV": "x86_64-darwin-validate",
@@ -3834,7 +3834,7 @@
       "IGNORE_PERF_FAILURES": "all",
       "INSTALL_CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check",
       "LANG": "en_US.UTF-8",
-      "MACOSX_DEPLOYMENT_TARGET": "10.13",
+      "MACOSX_DEPLOYMENT_TARGET": "11.0",
       "NIX_SYSTEM": "x86_64-darwin",
       "RUNTEST_ARGS": "",
       "TEST_ENV": "x86_64-darwin-release",
@@ -5213,7 +5213,7 @@
       "HADRIAN_ARGS": "--docs=no-sphinx-pdfs",
       "INSTALL_CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check",
       "LANG": "en_US.UTF-8",
-      "MACOSX_DEPLOYMENT_TARGET": "10.13",
+      "MACOSX_DEPLOYMENT_TARGET": "11.0",
       "NIX_SYSTEM": "x86_64-darwin",
       "RUNTEST_ARGS": "",
       "TEST_ENV": "x86_64-darwin-validate",


=====================================
rts/rts.cabal
=====================================
@@ -332,8 +332,6 @@ library
 
       if os(osx)
         ld-options: "-Wl,-search_paths_first"
-                    -- See Note [fd_set_overflow]
-                    "-Wl,-U,___darwin_check_fd_set_overflow"
                     -- See Note [Undefined symbols in the RTS]
                     "-Wl,-undefined,dynamic_lookup"
         if !arch(x86_64) && !arch(aarch64)
@@ -549,48 +547,6 @@ library
                     -- We don't want to compile posix/ticker/*.c, these will be #included
                     -- from Ticker.c
 
-
--- Note [fd_set_overflow]
--- ~~~~~~~~~~~~~~~~~~~~~~
--- In this note is the very sad tale of __darwin_fd_set_overflow.
--- The 8.10.5 release was broken because it was built in an environment
--- where the libraries were provided by XCode 12.*, these libraries introduced
--- a reference to __darwin_fd_set_overflow via the FD_SET macro which is used in
--- Select.c. Unfortunately, this symbol is not available with XCode 11.* which
--- led to a linker error when trying to link anything. This is almost certainly
--- a bug in XCode but we still have to work around it.
-
--- Undefined symbols for architecture x86_64:
---  "___darwin_check_fd_set_overflow", referenced from:
---      _awaitEvent in libHSrts.a(Select.o)
--- ld: symbol(s) not found for architecture x86_64
-
--- One way to fix this is to upgrade your version of xcode, but this would
--- force the upgrade on users prematurely. Fortunately it also seems safe to pass
--- the linker option "-Wl,-U,___darwin_check_fd_set_overflow" because the usage of
--- the symbol is guarded by a guard to check if it's defined.
-
--- __header_always_inline int
--- __darwin_check_fd_set(int _a, const void *_b)
--- {
---    if ((uintptr_t)&__darwin_check_fd_set_overflow != (uintptr_t) 0) {
---#if defined(_DARWIN_UNLIMITED_SELECT) || defined(_DARWIN_C_SOURCE)
---        return __darwin_check_fd_set_overflow(_a, _b, 1);
---#else
---        return __darwin_check_fd_set_overflow(_a, _b, 0);
---#endif
---    } else {
---        return 1;
---    }
---}
-
--- Across the internet there are many other reports of this issue
---  See: https://github.com/mono/mono/issues/19393
---     , https://github.com/sitsofe/fio/commit/b6a1e63a1ff607692a3caf3c2db2c3d575ba2320
-
--- The issue was originally reported in #19950
-
-
 -- Note [Undefined symbols in the RTS]
 -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 -- The RTS is built with a number of `-u` flags. This is to handle cyclic



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/88c4fe1d8a3bdbedf3972fde12f663a974cc2191

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/88c4fe1d8a3bdbedf3972fde12f663a974cc2191
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/20241126/66035338/attachment-0001.html>


More information about the ghc-commits mailing list