Skip to content

Commit d55b11a

Browse files
committed
Make __remill_state extern "C"
Closes lifting-bits#677
1 parent 43b2024 commit d55b11a

7 files changed

Lines changed: 7 additions & 7 deletions

File tree

lib/Arch/AArch32/Runtime/Instructions.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929

3030
// A definition is required to ensure that LLVM doesn't optimize the `State` type out of the bytecode
3131
// See https://github.com/lifting-bits/remill/pull/631#issuecomment-1279989004
32-
State __remill_state;
32+
extern "C" State __remill_state;
3333

3434
#define REG_PC state.gpr.r15.dword
3535
#define REG_LR state.gpr.r14.dword

lib/Arch/AArch64/Runtime/Instructions.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929

3030
// A definition is required to ensure that LLVM doesn't optimize the `State` type out of the bytecode
3131
// See https://github.com/lifting-bits/remill/pull/631#issuecomment-1279989004
32-
State __remill_state;
32+
extern "C" State __remill_state;
3333

3434
#define REG_PC state.gpr.pc.qword
3535
#define REG_SP state.gpr.sp.qword

lib/Arch/PPC/Runtime/Instructions.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
// A definition is required to ensure that LLVM doesn't optimize the `State` type out of the bytecode
2323
// See https://github.com/lifting-bits/remill/pull/631#issuecomment-1279989004f
24-
State __remill_state;
24+
extern "C" State __remill_state;
2525

2626
#define HYPER_CALL state.hyper_call
2727

lib/Arch/Runtime/Intrinsics.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ extern "C" void __remill_mark_as_used(const void *);
2929

3030
// Each architecture's semantics module defines this variable
3131
// See https://github.com/lifting-bits/remill/pull/631#issuecomment-1279989004
32-
extern State __remill_state;
32+
extern "C" State __remill_state;
3333

3434
#if defined(REMILL_ON_SPARC32) || defined(REMILL_ON_SPARC64)
3535
extern RegisterWindow __remill_register_window;

lib/Arch/SPARC32/Runtime/Instructions.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525

2626
// A definition is required to ensure that LLVM doesn't optimize the `State` type out of the bytecode
2727
// See https://github.com/lifting-bits/remill/pull/631#issuecomment-1279989004
28-
State __remill_state;
28+
extern "C" State __remill_state;
2929

3030
#define REG_PC state.pc.aword
3131
#define REG_NPC state.next_pc.aword

lib/Arch/SPARC64/Runtime/Instructions.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525

2626
// A definition is required to ensure that LLVM doesn't optimize the `State` type out of the bytecode
2727
// See https://github.com/lifting-bits/remill/pull/631#issuecomment-1279989004
28-
State __remill_state;
28+
extern "C" State __remill_state;
2929

3030
#define REG_PC state.pc.aword
3131
#define REG_NPC state.next_pc.aword

lib/Arch/X86/Runtime/Instructions.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929

3030
// A definition is required to ensure that LLVM doesn't optimize the `State` type out of the bytecode
3131
// See https://github.com/lifting-bits/remill/pull/631#issuecomment-1279989004
32-
State __remill_state;
32+
extern "C" State __remill_state;
3333

3434
#define REG_IP state.gpr.rip.word
3535
#define REG_EIP state.gpr.rip.dword

0 commit comments

Comments
 (0)