blob: e5d0f9d0b839c846f3bf1689d5c9289ac7bd8da6 [file] [log] [blame]
b.liue9582032025-04-17 19:18:16 +08001From 9445f477cfcfb3615ffde8f93b1b98c809ee4eca Mon Sep 17 00:00:00 2001
2From: Eugene Gershnik <gershnik@users.noreply.github.com>
3Date: Mon, 6 May 2024 09:29:39 -0700
4Subject: [PATCH] This re-enables build on macOS.
5
6Weak aliases are not supported by clang on Darwin.
7Instead this fix uses inline asm to make `_uuid_time` and alias to `___uuid_time`
8
9Fixes util-linux/util-linux#2873
10---
11 libuuid/src/uuid_time.c | 4 ++++
12 1 file changed, 4 insertions(+)
13
14--- a/libuuid/src/uuid_time.c
15+++ b/libuuid/src/uuid_time.c
16@@ -85,6 +85,10 @@ time_t __uuid_time(const uuid_t uu, stru
17 }
18 #if defined(__USE_TIME_BITS64) && defined(__GLIBC__)
19 extern time_t uuid_time64(const uuid_t uu, struct timeval *ret_tv) __attribute__((weak, alias("__uuid_time")));
20+#elif defined(__clang__) && defined(__APPLE__)
21+__asm__(".globl _uuid_time");
22+__asm__(".set _uuid_time, ___uuid_time");
23+extern time_t uuid_time(const uuid_t uu, struct timeval *ret_tv);
24 #else
25 extern time_t uuid_time(const uuid_t uu, struct timeval *ret_tv) __attribute__((weak, alias("__uuid_time")));
26 #endif