diff options
author | Gunnar Beutner <gbeutner@serenityos.org> | 2022-10-12 22:07:37 +0200 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2022-10-14 13:01:13 +0200 |
commit | dadf656dc984c1af7b720d6fdcf6a2f095a4ed09 (patch) | |
tree | ea5a4ac916e38c242dd60aabd2dc11a4ab69fe23 /Userland/Libraries/LibC | |
parent | 7a8206197eae9937a0751ac9e22d55aaf950cec8 (diff) | |
download | serenity-dadf656dc984c1af7b720d6fdcf6a2f095a4ed09.zip |
Tests+Userland: Prefer using __builtin_trap() instead of UD2
This way we don't have to hard-code per-architecture instructions.
Diffstat (limited to 'Userland/Libraries/LibC')
-rw-r--r-- | Userland/Libraries/LibC/stdlib.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/Userland/Libraries/LibC/stdlib.cpp b/Userland/Libraries/LibC/stdlib.cpp index 8a56fc9313..81759f4b1f 100644 --- a/Userland/Libraries/LibC/stdlib.cpp +++ b/Userland/Libraries/LibC/stdlib.cpp @@ -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() |