diff --git a/AK/Platform.h b/AK/Platform.h index 940de32e3d..7a80ab7b91 100644 --- a/AK/Platform.h +++ b/AK/Platform.h @@ -145,10 +145,14 @@ #ifdef NAKED # undef NAKED #endif -#if !ARCH(AARCH64) +#if !ARCH(AARCH64) || defined(AK_COMPILER_CLANG) # define NAKED __attribute__((naked)) #else -# define NAKED +// GCC doesn't support __attribute__((naked)) on AArch64. We use NAKED to mark functions +// that are entirely written in inline assembly; having these be inlined would cause +// various problems, such as explicit `ret` instructions accidentally exiting the caller +// function or GCC discarding function arguments as they appear "dead". +# define NAKED NEVER_INLINE #endif #ifdef DISALLOW