Skip to content

Commit 4f6b827

Browse files
committed
Use __asm instead of asm
With `--std=c99` option coroutine/arm64/Context.h errs: ``` In file included from cont.c:26: coroutine/arm64/Context.h:59:5: error: call to undeclared function 'asm'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration] 59 | asm ("hint #8;" : "+r"(r17) : "r"(r16)); | ^ ``` Also move the common function header.
1 parent 6219066 commit 4f6b827

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

coroutine/arm64/Context.h

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,22 +50,19 @@ static inline void coroutine_initialize_main(struct coroutine_context * context)
5050
context->stack_pointer = NULL;
5151
}
5252

53-
#if defined(__ARM_FEATURE_PAC_DEFAULT) && __ARM_FEATURE_PAC_DEFAULT != 0
54-
// Sign the given instruction address with the given modifier and key A
5553
static inline void *ptrauth_sign_instruction_addr(void *addr, void *modifier) {
54+
#if defined(__ARM_FEATURE_PAC_DEFAULT) && __ARM_FEATURE_PAC_DEFAULT != 0
55+
// Sign the given instruction address with the given modifier and key A
5656
register void *r17 __asm("r17") = addr;
5757
register void *r16 __asm("r16") = modifier;
5858
// Use HINT mnemonic instead of PACIA1716 for compatibility with older assemblers.
59-
asm ("hint #8;" : "+r"(r17) : "r"(r16));
59+
__asm ("hint #8;" : "+r"(r17) : "r"(r16));
6060
addr = r17;
61-
return addr;
62-
}
6361
#else
64-
// No-op if PAC is not enabled
65-
static inline void *ptrauth_sign_instruction_addr(void *addr, void *modifier) {
62+
// No-op if PAC is not enabled
63+
#endif
6664
return addr;
6765
}
68-
#endif
6966

7067
static inline void coroutine_initialize(
7168
struct coroutine_context *context,

0 commit comments

Comments
 (0)