1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-14 08:44:58 +00:00

Tests+Userland: Prefer using __builtin_trap() instead of UD2

This way we don't have to hard-code per-architecture instructions.
This commit is contained in:
Gunnar Beutner 2022-10-12 22:07:37 +02:00 committed by Linus Groh
parent 7a8206197e
commit dadf656dc9
3 changed files with 5 additions and 4 deletions

View file

@ -214,8 +214,9 @@ int atexit(void (*handler)())
void _abort()
{
asm volatile("ud2");
__builtin_unreachable();
// According to the GCC manual __builtin_trap() can call abort() so using it here might not seem safe at first. However,
// on all the platforms we support GCC emits an undefined instruction instead of a call.
__builtin_trap();
}
void abort()