From 681a835af879a46e1d30ce2d46d4b150cfbba528 Mon Sep 17 00:00:00 2001 From: Steffen Moeller Date: Fri, 4 Dec 2026 23:55:23 +0100 Subject: [PATCH] hal: omit librt from Darwin linking Darwin supplies the HAL timing functions through libSystem. Select -lrt using the configured host OS and keep -pthread tied to the uspace build mode. --- src/hal/Submakefile | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/hal/Submakefile b/src/hal/Submakefile index 8b7e42bac14..290a0095858 100644 --- a/src/hal/Submakefile +++ b/src/hal/Submakefile @@ -2,10 +2,14 @@ HALLIBSRCS := hal/hal_lib.c hal/hal_lib_query.c hal/hal_lib_extra.c $(ULAPISRCS) $(call TOOBJSDEPS, $(HALLIBSRCS)): EXTRAFLAGS += -fPIC $(ULAPI_CFLAGS) USERSRCS += $(HALLIBSRCS) +HALLIB_LIBS := ifeq ($(BUILD_SYS),uspace) -HALLIB_LIBS := -pthread -lrt -else -HALLIB_LIBS := -lrt +HALLIB_LIBS += -pthread +endif + +# Darwin supplies the timing functions through libSystem. +ifeq ($(filter darwin% macos%,$(HOST_OS)),) +HALLIB_LIBS += -lrt endif HALLIB := ../lib/liblinuxcnchal.so