8339313: 32-bit build broken

Reviewed-by: coleenp, mbaesken, szaldana
This commit is contained in:
Thomas Stuefe 2024-12-12 18:53:33 +00:00
parent ff85865b75
commit e9ad27fcdc
2 changed files with 11 additions and 1 deletions

View File

@ -47,6 +47,7 @@ Java_NoClassDefFoundErrorTest_callFindClass(JNIEnv *env, jclass klass, jstring c
static char* giant_string() {
#ifdef _LP64
size_t len = ((size_t)INT_MAX) + 3;
char* c_name = malloc(len * sizeof(char));
if (c_name != NULL) {
@ -54,6 +55,14 @@ static char* giant_string() {
c_name[len - 1] = '\0';
}
return c_name;
#else
/* On 32-bit, gcc warns us against using values larger than ptrdiff_t for malloc,
* memset and as array subscript. Since the chance of a 2GB allocation to be
* successful is slim (would typically reach or exceed the user address space
* size), lets just not bother. Returning NULL will cause the test to be silently
* skipped. */
return NULL;
#endif
}
JNIEXPORT jboolean JNICALL

View File

@ -22,11 +22,12 @@
*/
#include <jni.h>
#include <stdint.h>
typedef void (*upcall_func)(void);
JNIEXPORT void JNICALL
Java_LingeredAppWithFFMUpcall_callJNI(JNIEnv *env, jclass cls, jlong upcallAddr) {
upcall_func upcall = (upcall_func)upcallAddr;
upcall_func upcall = (upcall_func)(uintptr_t)upcallAddr;
upcall();
}