From 45432b54a73264636cbcdea8ab6dc4c0c28facca Mon Sep 17 00:00:00 2001 From: julia Date: Sat, 31 May 2025 12:20:08 +1000 Subject: [PATCH 1/2] ltimer: support old clang without __attr__(error) Clang didn't have `__attribute__((error(msg)))` until version 14, but we support older versions of Clang. Both GCC and clang support `__has_attribute(error)`; GCC since v5 (2015) and Clang seemingly always. This fixes builds that were failing due to 'unknown attribute error'. We are not relying on the presence of this attribute for correct output, but purely as a debug message which fails before the linker. If we don't support the message failing at link-time is OK too. Signed-off-by: julia --- libplatsupport/include/platsupport/ltimer.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libplatsupport/include/platsupport/ltimer.h b/libplatsupport/include/platsupport/ltimer.h index 73749e990..e121ec54b 100644 --- a/libplatsupport/include/platsupport/ltimer.h +++ b/libplatsupport/include/platsupport/ltimer.h @@ -325,7 +325,7 @@ static inline void ltimer_us_delay(ltimer_t *timer, uint64_t microseconds) * with calling the ltimer functions inside the callback, the ltimer interface * functions are not reentrant. */ -#ifndef CONFIG_LIB_PLAT_SUPPORT_HAVE_TIMER +#if !defined(CONFIG_LIB_PLAT_SUPPORT_HAVE_TIMER) && __has_attribute(error) __attribute__((error("no ltimer support for this platform"))) #endif int ltimer_default_init(ltimer_t *timer, ps_io_ops_t ops, ltimer_callback_fn_t callback, void *callback_token); @@ -333,7 +333,7 @@ int ltimer_default_init(ltimer_t *timer, ps_io_ops_t ops, ltimer_callback_fn_t c /* initialise the subset of functions required to get * the resources this ltimer needs without initialising the actual timer * drivers*/ -#ifndef CONFIG_LIB_PLAT_SUPPORT_HAVE_TIMER +#if !defined(CONFIG_LIB_PLAT_SUPPORT_HAVE_TIMER) && __has_attribute(error) __attribute__((error("no ltimer support for this platform"))) #endif int ltimer_default_describe(ltimer_t *timer, ps_io_ops_t ops); From 23cd7ba49afb3ef275d4b33c783748eddaf7f689 Mon Sep 17 00:00:00 2001 From: julia Date: Thu, 29 May 2025 13:49:36 +1000 Subject: [PATCH 2/2] ltimer: indicate no support for more platforms These were taken from the sel4test Sel4testHaveTimer config option. Signed-off-by: julia --- libplatsupport/CMakeLists.txt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/libplatsupport/CMakeLists.txt b/libplatsupport/CMakeLists.txt index 70bcc197b..96466438d 100644 --- a/libplatsupport/CMakeLists.txt +++ b/libplatsupport/CMakeLists.txt @@ -48,7 +48,13 @@ config_choice( mark_as_advanced(CLEAR LibPlatSupportX86ConsoleDevice LibPlatSupportLPTMRclock) # Some platforms don't have a platform timer. -if(KernelPlatformCheshire) +if( + (KernelPlatformQEMUArmVirt AND NOT (KernelArmExportPCNTUser AND KernelArmExportPTMRUser)) + OR KernelPlatformRocketchip + OR KernelPlatformRocketchipZCU102 + OR KernelPlatformCheshire + OR (SIMULATION AND (KernelArchRiscV OR KernelArchARM)) +) set(LibPlatSupportHaveTimer OFF) else() set(LibPlatSupportHaveTimer ON)