diff options
| -rw-r--r-- | test/004-SignalTest/signaltest.cc | 7 | ||||
| -rw-r--r-- | test/115-native-bridge/nativebridge.cc | 5 |
2 files changed, 8 insertions, 4 deletions
diff --git a/test/004-SignalTest/signaltest.cc b/test/004-SignalTest/signaltest.cc index 1414715bbf..34e331b901 100644 --- a/test/004-SignalTest/signaltest.cc +++ b/test/004-SignalTest/signaltest.cc @@ -93,13 +93,16 @@ extern "C" JNIEXPORT void JNICALL Java_Main_terminateSignalTest(JNIEnv*, jclass) char *go_away_compiler = nullptr; extern "C" JNIEXPORT jint JNICALL Java_Main_testSignal(JNIEnv*, jclass) { -#if defined(__arm__) || defined(__i386__) || defined(__x86_64__) || defined(__aarch64__) +#if defined(__arm__) || defined(__i386__) || defined(__aarch64__) // On supported architectures we cause a real SEGV. *go_away_compiler = 'a'; +#elif defined(__x86_64__) + // Cause a SEGV using an instruction known to be 3 bytes long to account for hardcoded jump + // in the signal handler + asm volatile("movl $0, %%eax;" "movb $1, (%%al);" : : : "%eax"); #else // On other architectures we simulate SEGV. kill(getpid(), SIGSEGV); #endif return 1234; } - diff --git a/test/115-native-bridge/nativebridge.cc b/test/115-native-bridge/nativebridge.cc index 04326b3028..702e779bb1 100644 --- a/test/115-native-bridge/nativebridge.cc +++ b/test/115-native-bridge/nativebridge.cc @@ -206,8 +206,9 @@ static jint trampoline_Java_Main_testSignal(JNIEnv*, jclass) { #if defined(__arm__) || defined(__i386__) || defined(__aarch64__) *go_away_compiler = 'a'; #elif defined(__x86_64__) - // Cause a SEGV using an instruction known to be 3 bytes long - asm volatile("movl $0, %%eax;" "movb $1, (%%eax);" : : : "%eax"); + // Cause a SEGV using an instruction known to be 3 bytes long to account for hardcoded jump + // in the signal handler + asm volatile("movl $0, %%eax;" "movb $1, (%%al);" : : : "%eax"); #else // On other architectures we simulate SEGV. kill(getpid(), SIGSEGV); |