Loading pkgs/by-name/ut/util-linux/fix-darwin-build.patch 0 → 100644 +35 −0 Original line number Diff line number Diff line From e47c6f751a7ef87640c61316ada774e8e9cc6b07 Mon Sep 17 00:00:00 2001 From: Eugene Gershnik <gershnik@users.noreply.github.com> Date: Mon, 6 May 2024 09:29:39 -0700 Subject: [PATCH] libuuid: fix uuid_time on macOS without attribute((alias)) Weak aliases are not supported by clang on Darwin. Instead this fix uses inline asm to make `_uuid_time` an alias to `___uuid_time` It appears that on macOS the time API is purely 32 or 64 bit depending on the build type. There is no ABI issue on that platform and `uuid_time` can be unconditionally aliased to `_uuid_time`. This is all conjectural, however, since I have no ability to make 32-bit builds for macOS - the Apple toolchain doesn't support this since 2019. Fixes util-linux/util-linux#2873 --- libuuid/src/uuid_time.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libuuid/src/uuid_time.c b/libuuid/src/uuid_time.c index 9b415b3ee73..df0478e1909 100644 --- a/libuuid/src/uuid_time.c +++ b/libuuid/src/uuid_time.c @@ -85,6 +85,10 @@ time_t __uuid_time(const uuid_t uu, struct timeval *ret_tv) } #if defined(__USE_TIME_BITS64) && defined(__GLIBC__) extern time_t uuid_time64(const uuid_t uu, struct timeval *ret_tv) __attribute__((weak, alias("__uuid_time"))); +#elif defined(__clang__) && defined(__APPLE__) +__asm__(".globl _uuid_time"); +__asm__(".set _uuid_time, ___uuid_time"); +extern time_t uuid_time(const uuid_t uu, struct timeval *ret_tv); #else extern time_t uuid_time(const uuid_t uu, struct timeval *ret_tv) __attribute__((weak, alias("__uuid_time"))); #endif pkgs/by-name/ut/util-linux/package.nix +7 −10 Original line number Diff line number Diff line Loading @@ -2,7 +2,6 @@ lib, stdenv, fetchurl, fetchpatch, pkg-config, zlib, shadow, Loading @@ -15,6 +14,7 @@ pam, systemdSupport ? lib.meta.availableOn stdenv.hostPlatform systemd, systemd, sqlite, nlsSupport ? true, translateManpages ? true, po4a, Loading @@ -27,21 +27,16 @@ stdenv.mkDerivation rec { pname = "util-linux" + lib.optionalString (!nlsSupport && !ncursesSupport && !systemdSupport) "-minimal"; version = "2.39.4"; version = "2.40.4"; src = fetchurl { url = "mirror://kernel/linux/utils/util-linux/v${lib.versions.majorMinor version}/util-linux-${version}.tar.xz"; hash = "sha256-bE+HI9r9QcOdk+y/FlCfyIwzzVvTJ3iArlodl6AU/Q4="; hash = "sha256-XB2vczsE6YWa/cO9h8xIEYDuD4i1wJRrFv3skxl1+3k="; }; patches = [ ./rtcwake-search-PATH-for-shutdown.patch (fetchpatch { name = "basename.patch"; url = "https://git.kernel.org/pub/scm/utils/util-linux/util-linux.git/patch/?id=77454e58d58f904cfdc02d3ca5bb65f1bd8739fc"; hash = "sha256-ELWC4bYN3rvn9XIN0XgCo55pXNfS2VpbZWuwzRLfO/0="; }) ./fix-darwin-build.patch ]; # We separate some of the utilities into their own outputs. This Loading @@ -64,7 +59,7 @@ stdenv.mkDerivation rec { postPatch = '' patchShebangs tests/run.sh patchShebangs tests/run.sh tools/all_syscalls substituteInPlace sys-utils/eject.c \ --replace "/bin/umount" "$bin/bin/umount" Loading Loading @@ -95,6 +90,7 @@ stdenv.mkDerivation rec { (lib.withFeature ncursesSupport "ncursesw") (lib.withFeature systemdSupport "systemd") (lib.withFeatureAs systemdSupport "systemdsystemunitdir" "${placeholder "bin"}/lib/systemd/system/") (lib.withFeatureAs systemdSupport "tmpfilesdir" "${placeholder "out"}/lib/tmpfiles.d") (lib.enableFeature translateManpages "poman") "SYSCONFSTATICDIR=${placeholder "lib"}/lib" ] Loading @@ -121,6 +117,7 @@ stdenv.mkDerivation rec { [ zlib libxcrypt sqlite ] ++ lib.optionals pamSupport [ pam ] ++ lib.optionals capabilitiesSupport [ libcap_ng ] Loading Loading
pkgs/by-name/ut/util-linux/fix-darwin-build.patch 0 → 100644 +35 −0 Original line number Diff line number Diff line From e47c6f751a7ef87640c61316ada774e8e9cc6b07 Mon Sep 17 00:00:00 2001 From: Eugene Gershnik <gershnik@users.noreply.github.com> Date: Mon, 6 May 2024 09:29:39 -0700 Subject: [PATCH] libuuid: fix uuid_time on macOS without attribute((alias)) Weak aliases are not supported by clang on Darwin. Instead this fix uses inline asm to make `_uuid_time` an alias to `___uuid_time` It appears that on macOS the time API is purely 32 or 64 bit depending on the build type. There is no ABI issue on that platform and `uuid_time` can be unconditionally aliased to `_uuid_time`. This is all conjectural, however, since I have no ability to make 32-bit builds for macOS - the Apple toolchain doesn't support this since 2019. Fixes util-linux/util-linux#2873 --- libuuid/src/uuid_time.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libuuid/src/uuid_time.c b/libuuid/src/uuid_time.c index 9b415b3ee73..df0478e1909 100644 --- a/libuuid/src/uuid_time.c +++ b/libuuid/src/uuid_time.c @@ -85,6 +85,10 @@ time_t __uuid_time(const uuid_t uu, struct timeval *ret_tv) } #if defined(__USE_TIME_BITS64) && defined(__GLIBC__) extern time_t uuid_time64(const uuid_t uu, struct timeval *ret_tv) __attribute__((weak, alias("__uuid_time"))); +#elif defined(__clang__) && defined(__APPLE__) +__asm__(".globl _uuid_time"); +__asm__(".set _uuid_time, ___uuid_time"); +extern time_t uuid_time(const uuid_t uu, struct timeval *ret_tv); #else extern time_t uuid_time(const uuid_t uu, struct timeval *ret_tv) __attribute__((weak, alias("__uuid_time"))); #endif
pkgs/by-name/ut/util-linux/package.nix +7 −10 Original line number Diff line number Diff line Loading @@ -2,7 +2,6 @@ lib, stdenv, fetchurl, fetchpatch, pkg-config, zlib, shadow, Loading @@ -15,6 +14,7 @@ pam, systemdSupport ? lib.meta.availableOn stdenv.hostPlatform systemd, systemd, sqlite, nlsSupport ? true, translateManpages ? true, po4a, Loading @@ -27,21 +27,16 @@ stdenv.mkDerivation rec { pname = "util-linux" + lib.optionalString (!nlsSupport && !ncursesSupport && !systemdSupport) "-minimal"; version = "2.39.4"; version = "2.40.4"; src = fetchurl { url = "mirror://kernel/linux/utils/util-linux/v${lib.versions.majorMinor version}/util-linux-${version}.tar.xz"; hash = "sha256-bE+HI9r9QcOdk+y/FlCfyIwzzVvTJ3iArlodl6AU/Q4="; hash = "sha256-XB2vczsE6YWa/cO9h8xIEYDuD4i1wJRrFv3skxl1+3k="; }; patches = [ ./rtcwake-search-PATH-for-shutdown.patch (fetchpatch { name = "basename.patch"; url = "https://git.kernel.org/pub/scm/utils/util-linux/util-linux.git/patch/?id=77454e58d58f904cfdc02d3ca5bb65f1bd8739fc"; hash = "sha256-ELWC4bYN3rvn9XIN0XgCo55pXNfS2VpbZWuwzRLfO/0="; }) ./fix-darwin-build.patch ]; # We separate some of the utilities into their own outputs. This Loading @@ -64,7 +59,7 @@ stdenv.mkDerivation rec { postPatch = '' patchShebangs tests/run.sh patchShebangs tests/run.sh tools/all_syscalls substituteInPlace sys-utils/eject.c \ --replace "/bin/umount" "$bin/bin/umount" Loading Loading @@ -95,6 +90,7 @@ stdenv.mkDerivation rec { (lib.withFeature ncursesSupport "ncursesw") (lib.withFeature systemdSupport "systemd") (lib.withFeatureAs systemdSupport "systemdsystemunitdir" "${placeholder "bin"}/lib/systemd/system/") (lib.withFeatureAs systemdSupport "tmpfilesdir" "${placeholder "out"}/lib/tmpfiles.d") (lib.enableFeature translateManpages "poman") "SYSCONFSTATICDIR=${placeholder "lib"}/lib" ] Loading @@ -121,6 +117,7 @@ stdenv.mkDerivation rec { [ zlib libxcrypt sqlite ] ++ lib.optionals pamSupport [ pam ] ++ lib.optionals capabilitiesSupport [ libcap_ng ] Loading