Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions clang/lib/AST/ASTContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11856,10 +11856,11 @@ QualType ASTContext::GetBuiltinType(unsigned Id,
"'.' should only occur at end of builtin type list!");

bool Variadic = (TypeStr[0] == '.');

bool IsCheriLibcall = Id != Builtin::BIsetjmp && Id != Builtin::BIlongjmp;
IsCheriLibcall &= Target->getTargetOpts().ABI != "cheriot-baremetal";
FunctionType::ExtInfo EI(getDefaultCallingConvention(
Variadic, /*IsCXXMethod=*/false, /*IsBuiltin=*/true,
/*IsLibcall*/ Target->getTargetOpts().ABI != "cheriot-baremetal"));
/*IsLibcall*/ IsCheriLibcall));
if (BuiltinInfo.isNoReturn(Id)) EI = EI.withNoReturn(true);


Expand Down
21 changes: 21 additions & 0 deletions clang/test/CodeGen/cheri/riscv/cheriot-setjmp.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// RUN: %clang_cc1 %s -o - "-triple" "riscv32cheriot-unknown-unknown" "-emit-llvm" "-mframe-pointer=none" "-mcmodel=small" "-target-abi" "cheriot" "-Oz" "-Werror" -std=c2x | FileCheck %s
// Verify that setjmp is called without cherilibcallcc
struct __jmp_buf
{
unsigned __cs0;
unsigned __cs1;
unsigned __csp;
unsigned __cra;
};

typedef struct __jmp_buf jmp_buf[1];

__attribute__((returns_twice)) int setjmp(jmp_buf env) __asm__("setjmp");

jmp_buf buf;

// CHECK-LABEL: @test
// CHECK: call i32 @setjmp
void test() {
setjmp(buf);
}