File tree Expand file tree Collapse file tree 2 files changed +19
-4
lines changed Expand file tree Collapse file tree 2 files changed +19
-4
lines changed Original file line number Diff line number Diff line change @@ -22,9 +22,11 @@ namespace LIBC_NAMESPACE_DECL {
2222// supports the MTE instructions, not whether the compiler is configured to use
2323// them.)
2424
25- [[gnu::naked]] LLVM_LIBC_FUNCTION(void , longjmp,
26- ([[maybe_unused]] jmp_buf buf,
27- [[maybe_unused]] int val)) {
25+ #ifndef __GNUC__
26+ [[gnu::naked]]
27+ #endif
28+ LLVM_LIBC_FUNCTION (void , longjmp,
29+ ([[maybe_unused]] jmp_buf buf, [[maybe_unused]] int val)) {
2830 // If BTI branch protection is in use, the compiler will automatically insert
2931 // a BTI here, so we don't need to make any extra effort to do so.
3032
@@ -87,6 +89,11 @@ namespace LIBC_NAMESPACE_DECL {
8789 R"(
8890 ret
8991 )" );
92+
93+ #ifdef __GNUC__
94+ // GCC fails here because it doesn't recognize a value is returned.
95+ __builtin_unreachable ();
96+ #endif
9097}
9198
9299} // namespace LIBC_NAMESPACE_DECL
Original file line number Diff line number Diff line change 1212
1313namespace LIBC_NAMESPACE_DECL {
1414
15- [[gnu::naked]] LLVM_LIBC_FUNCTION(int , setjmp, ([[maybe_unused]] jmp_buf buf)) {
15+ #ifndef __GNUC__
16+ [[gnu::naked]]
17+ #endif
18+ LLVM_LIBC_FUNCTION (int , setjmp, ([[maybe_unused]] jmp_buf buf)) {
1619 // If BTI branch protection is in use, the compiler will automatically insert
1720 // a BTI here, so we don't need to make any extra effort to do so.
1821
@@ -88,6 +91,11 @@ namespace LIBC_NAMESPACE_DECL {
8891 R"(
8992 ret
9093 )" );
94+
95+ #ifdef __GNUC__
96+ // GCC fails here because it doesn't recognize a value is returned.
97+ __builtin_unreachable ();
98+ #endif
9199}
92100
93101} // namespace LIBC_NAMESPACE_DECL
You can’t perform that action at this time.
0 commit comments