Skip to content

Conversation

armandomontanez
Copy link
Contributor

If the compiler in use offers __sev(), __wfe(), or __wfi(), forward declare them to be sure they're available for use.

Recent LLVM/Clang changes are enforcing #include <arm_acle.h> as the way to get this builtin:

external/pico-sdk+/src/common/pico_sync/mutex.c:77:9: error: call to undeclared library function '__wfe' with type 'void (void)'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
   77 |         lock_internal_spin_unlock_with_wait(&mtx->core, save);
      |         ^
external/pico-sdk+/src/common/pico_sync/include/pico/lock_core.h:128:95: note: expanded from macro 'lock_internal_spin_unlock_with_wait'
  128 | #define lock_internal_spin_unlock_with_wait(lock, save) spin_unlock((lock)->spin_lock, save), __wfe()
      |                                                                                               ^
external/pico-sdk+/src/common/pico_sync/mutex.c:77:9: note: include the header <arm_acle.h> or explicitly provide a declaration for '__wfe'

Forward declaring using the same signature as arm_acle.h makes clang happy again.

If the compiler in use offers __sev(), __wfe(), or __wfi(), forward
declare them to be sure they're available for use.
@kilograham
Copy link
Contributor

i find this a bit weird that you'd need to declare a builtin; will merge, (assuming that the arm header does declare it like this?)

@kilograham kilograham added this to the 2.2.1 milestone Sep 15, 2025
@kilograham kilograham merged commit 8fcd44a into raspberrypi:develop Sep 15, 2025
6 checks passed
@armandomontanez
Copy link
Contributor Author

i find this a bit weird that you'd need to declare a builtin; will merge, (assuming that the arm header does declare it like this?)

Agreed. I checked in with some LLVM folks and it sounds like this is an intentional change despite the fact that it's not how builtins have traditionally been managed. 😕

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants