Skip to content

Commit 84311c5

Browse files
committed
Fix tests on LLVM 20+
1 parent 797d270 commit 84311c5

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

lib/Arch/Runtime/HyperCall.cpp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,15 @@ Memory *__remill_sync_hyper_call(State &state, Memory *mem,
175175
mem = __remill_x86_set_control_reg_4(mem);
176176
break;
177177

178+
#if defined(__clang_major__) && __clang_major__ >= 20
179+
case SyncHyperCall::kX86SysCall:
180+
case SyncHyperCall::kX86SysEnter:
181+
case SyncHyperCall::kX86SysExit:
182+
// LLVM 20+ rejects RSP/RBP constraints in inline asm
183+
// These hypercalls are not executed in normal test workflows anyway
184+
__builtin_debugtrap();
185+
break;
186+
#else
178187
case SyncHyperCall::kX86SysCall:
179188
asm volatile("syscall"
180189
: "=a"(state.gpr.rax.dword), "=r"(esp)
@@ -202,6 +211,7 @@ Memory *__remill_sync_hyper_call(State &state, Memory *mem,
202211
"S"(state.gpr.rsi.dword), "D"(state.gpr.rdi.dword),
203212
"r"(esp), "r"(ebp));
204213
break;
214+
#endif
205215

206216
# elif REMILL_HYPERCALL_AMD64
207217

@@ -233,6 +243,15 @@ Memory *__remill_sync_hyper_call(State &state, Memory *mem,
233243
mem = __remill_amd64_set_control_reg_8(mem);
234244
break;
235245

246+
#if defined(__clang_major__) && __clang_major__ >= 20
247+
case SyncHyperCall::kX86SysCall:
248+
case SyncHyperCall::kX86SysEnter:
249+
case SyncHyperCall::kX86SysExit:
250+
// LLVM 20+ rejects RSP/RBP constraints in inline asm
251+
// These hypercalls are not executed in normal test workflows anyway
252+
__builtin_debugtrap();
253+
break;
254+
#else
236255
case SyncHyperCall::kX86SysCall:
237256
asm volatile("syscall"
238257
: "=a"(state.gpr.rax.qword), "=r"(rsp)
@@ -263,6 +282,7 @@ Memory *__remill_sync_hyper_call(State &state, Memory *mem,
263282
"r"(rsp), "r"(rbp), "r"(r8), "r"(r9), "r"(r10), "r"(r11),
264283
"r"(r12), "r"(r13), "r"(r14), "r"(r15));
265284
break;
285+
#endif
266286

267287
# endif
268288

0 commit comments

Comments
 (0)