From 9ea24ebc94b7b90cff45cdf5cf012fbc9b3dadac Mon Sep 17 00:00:00 2001 From: Antoine Martin Date: Fri, 20 Dec 2024 18:48:48 -0500 Subject: [PATCH] add missing patches --- user/lwjgl3/add-missing-include-for-nfd.patch | 25 ++ user/lwjgl3/disable-remotery.patch | 30 ++ user/lwjgl3/ffi-patches.patch | 257 ++++++++++++++++++ user/lwjgl3/force-use-of-system-libffi.patch | 38 +++ ...emove-gcc-prefixes-for-aarch64-arm32.patch | 26 ++ user/lwjgl3/remove-preadv2.patch | 52 ++++ 6 files changed, 428 insertions(+) create mode 100644 user/lwjgl3/add-missing-include-for-nfd.patch create mode 100644 user/lwjgl3/disable-remotery.patch create mode 100644 user/lwjgl3/ffi-patches.patch create mode 100644 user/lwjgl3/force-use-of-system-libffi.patch create mode 100644 user/lwjgl3/remove-gcc-prefixes-for-aarch64-arm32.patch create mode 100644 user/lwjgl3/remove-preadv2.patch diff --git a/user/lwjgl3/add-missing-include-for-nfd.patch b/user/lwjgl3/add-missing-include-for-nfd.patch new file mode 100644 index 0000000..c3c217e --- /dev/null +++ b/user/lwjgl3/add-missing-include-for-nfd.patch @@ -0,0 +1,25 @@ +From f0aa43a634fd86732e3653be0cf117f9f69f5df7 Mon Sep 17 00:00:00 2001 +From: knuxify +Date: Sun, 11 Dec 2022 16:13:22 +0100 +Subject: [PATCH] add missing include for nfd + +--- + config/linux/build.xml | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/config/linux/build.xml b/config/linux/build.xml +index 5098004..6acd46a 100644 +--- a/config/linux/build.xml ++++ b/config/linux/build.xml +@@ -262,7 +262,7 @@ + + + +- ++ + + + +-- +2.38.1 + diff --git a/user/lwjgl3/disable-remotery.patch b/user/lwjgl3/disable-remotery.patch new file mode 100644 index 0000000..4776849 --- /dev/null +++ b/user/lwjgl3/disable-remotery.patch @@ -0,0 +1,30 @@ +From 80a7bdc48ff5150208c3417c2d0aadf3bc2e5498 Mon Sep 17 00:00:00 2001 +From: knuxify +Date: Sun, 11 Dec 2022 16:12:10 +0100 +Subject: [PATCH] disable remotery + +--- + config/build-bindings.xml | 7 +------ + 1 file changed, 1 insertion(+), 6 deletions(-) + +diff --git a/config/build-bindings.xml b/config/build-bindings.xml +index 7a458f1..8db9186 100644 +--- a/config/build-bindings.xml ++++ b/config/build-bindings.xml +@@ -49,12 +49,7 @@ This script is included in /config/build-definitions.xml. + + + +- +- +- +- +- +- ++ + + + +-- +2.38.1 + diff --git a/user/lwjgl3/ffi-patches.patch b/user/lwjgl3/ffi-patches.patch new file mode 100644 index 0000000..4fb2b9f --- /dev/null +++ b/user/lwjgl3/ffi-patches.patch @@ -0,0 +1,257 @@ +From 48a3172ef8f3a0dc0538cec1c4305bcdf9c31016 Mon Sep 17 00:00:00 2001 +From: Ioannis Tsakpinis +Date: Mon, 3 Oct 2022 01:26:12 +0300 +Subject: [PATCH] feat(libffi) update to 3.4.3 + +--- + .../java/org/lwjgl/system/libffi/LibFFI.java | 4 +- + modules/lwjgl/core/src/main/c/libffi/ffi.h | 68 +++++++++++-------- + .../core/src/main/c/libffi/x86/ffitarget.h | 7 +- + .../kotlin/core/libffi/templates/LibFFI.kt | 19 +++--- + 4 files changed, 55 insertions(+), 43 deletions(-) + +diff --git a/modules/lwjgl/core/src/generated/java/org/lwjgl/system/libffi/LibFFI.java b/modules/lwjgl/core/src/generated/java/org/lwjgl/system/libffi/LibFFI.java +index 465295188d..a3485820c7 100644 +--- a/modules/lwjgl/core/src/generated/java/org/lwjgl/system/libffi/LibFFI.java ++++ b/modules/lwjgl/core/src/generated/java/org/lwjgl/system/libffi/LibFFI.java +@@ -102,12 +102,14 @@ public class LibFFI { + *
  • {@link #FFI_OK OK}
  • + *
  • {@link #FFI_BAD_TYPEDEF BAD_TYPEDEF}
  • + *
  • {@link #FFI_BAD_ABI BAD_ABI}
  • ++ *
  • {@link #FFI_BAD_ARGTYPE BAD_ARGTYPE}
  • + * + */ + public static final int + FFI_OK = 0, + FFI_BAD_TYPEDEF = 1, +- FFI_BAD_ABI = 2; ++ FFI_BAD_ABI = 2, ++ FFI_BAD_ARGTYPE = 3; + + protected LibFFI() { + throw new UnsupportedOperationException(); +diff --git a/modules/lwjgl/core/src/main/c/libffi/ffi.h b/modules/lwjgl/core/src/main/c/libffi/ffi.h +index 5b5efd2697..6c16184a77 100644 +--- a/modules/lwjgl/core/src/main/c/libffi/ffi.h ++++ b/modules/lwjgl/core/src/main/c/libffi/ffi.h +@@ -1,6 +1,7 @@ + /* -----------------------------------------------------------------*-C-*- +- libffi @VERSION@ - Copyright (c) 2011, 2014, 2019 Anthony Green +- - Copyright (c) 1996-2003, 2007, 2008 Red Hat, Inc. ++ libffi @VERSION@ ++ - Copyright (c) 2011, 2014, 2019, 2021, 2022 Anthony Green ++ - Copyright (c) 1996-2003, 2007, 2008 Red Hat, Inc. + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation +@@ -62,6 +63,31 @@ extern "C" { + #define FFI_EXEC_TRAMPOLINE_TABLE 0 + #endif + ++/* If these change, update src/mips/ffitarget.h. */ ++#define FFI_TYPE_VOID 0 ++#define FFI_TYPE_INT 1 ++#define FFI_TYPE_FLOAT 2 ++#define FFI_TYPE_DOUBLE 3 ++#if HAVE_LONG_DOUBLE ++#define FFI_TYPE_LONGDOUBLE 4 ++#else ++#define FFI_TYPE_LONGDOUBLE FFI_TYPE_DOUBLE ++#endif ++#define FFI_TYPE_UINT8 5 ++#define FFI_TYPE_SINT8 6 ++#define FFI_TYPE_UINT16 7 ++#define FFI_TYPE_SINT16 8 ++#define FFI_TYPE_UINT32 9 ++#define FFI_TYPE_SINT32 10 ++#define FFI_TYPE_UINT64 11 ++#define FFI_TYPE_SINT64 12 ++#define FFI_TYPE_STRUCT 13 ++#define FFI_TYPE_POINTER 14 ++#define FFI_TYPE_COMPLEX 15 ++ ++/* This should always refer to the last type code (for sanity checks). */ ++#define FFI_TYPE_LAST FFI_TYPE_COMPLEX ++ + #include + + #ifndef LIBFFI_ASM +@@ -224,7 +250,8 @@ FFI_EXTERN ffi_type ffi_type_complex_longdouble; + typedef enum { + FFI_OK = 0, + FFI_BAD_TYPEDEF, +- FFI_BAD_ABI ++ FFI_BAD_ABI, ++ FFI_BAD_ARGTYPE + } ffi_status; + + typedef struct { +@@ -317,11 +344,17 @@ typedef struct { + void *trampoline_table; + void *trampoline_table_entry; + #else +- char tramp[FFI_TRAMPOLINE_SIZE]; ++ union { ++ char tramp[FFI_TRAMPOLINE_SIZE]; ++ void *ftramp; ++ }; + #endif + ffi_cif *cif; + void (*fun)(ffi_cif*,void*,void**,void*); + void *user_data; ++#if defined(_MSC_VER) && defined(_M_IX86) ++ void *padding; ++#endif + } ffi_closure + #ifdef __GNUC__ + __attribute__((aligned (8))) +@@ -362,7 +395,7 @@ ffi_prep_closure_loc (ffi_closure*, + ffi_cif *, + void (*fun)(ffi_cif*,void*,void**,void*), + void *user_data, +- void*codeloc); ++ void *codeloc); + + #ifdef __sgi + # pragma pack 8 +@@ -498,31 +531,6 @@ ffi_status ffi_get_struct_offsets (ffi_abi abi, ffi_type *struct_type, + + #endif + +-/* If these change, update src/mips/ffitarget.h. */ +-#define FFI_TYPE_VOID 0 +-#define FFI_TYPE_INT 1 +-#define FFI_TYPE_FLOAT 2 +-#define FFI_TYPE_DOUBLE 3 +-#if HAVE_LONG_DOUBLE +-#define FFI_TYPE_LONGDOUBLE 4 +-#else +-#define FFI_TYPE_LONGDOUBLE FFI_TYPE_DOUBLE +-#endif +-#define FFI_TYPE_UINT8 5 +-#define FFI_TYPE_SINT8 6 +-#define FFI_TYPE_UINT16 7 +-#define FFI_TYPE_SINT16 8 +-#define FFI_TYPE_UINT32 9 +-#define FFI_TYPE_SINT32 10 +-#define FFI_TYPE_UINT64 11 +-#define FFI_TYPE_SINT64 12 +-#define FFI_TYPE_STRUCT 13 +-#define FFI_TYPE_POINTER 14 +-#define FFI_TYPE_COMPLEX 15 +- +-/* This should always refer to the last type code (for sanity checks). */ +-#define FFI_TYPE_LAST FFI_TYPE_COMPLEX +- + #ifdef __cplusplus + } + #endif +diff --git a/modules/lwjgl/core/src/main/c/libffi/x86/ffitarget.h b/modules/lwjgl/core/src/main/c/libffi/x86/ffitarget.h +index 60caf0db97..3cc1b29b44 100644 +--- a/modules/lwjgl/core/src/main/c/libffi/x86/ffitarget.h ++++ b/modules/lwjgl/core/src/main/c/libffi/x86/ffitarget.h +@@ -203,9 +203,11 @@ typedef enum ffi_abi { + # define FFI_NATIVE_RAW_API 1 /* x86 has native raw api support */ + #endif + +-#if !defined(GENERATE_LIBFFI_MAP) && defined(__ASSEMBLER__) \ +- && defined(__CET__) ++#if !defined(GENERATE_LIBFFI_MAP) && defined(__CET__) + # include ++# if (__CET__ & 1) != 0 ++# define ENDBR_PRESENT ++# endif + # define _CET_NOTRACK notrack + #else + # define _CET_ENDBR +@@ -213,4 +215,3 @@ typedef enum ffi_abi { + #endif + + #endif +- +diff --git a/modules/lwjgl/core/src/templates/kotlin/core/libffi/templates/LibFFI.kt b/modules/lwjgl/core/src/templates/kotlin/core/libffi/templates/LibFFI.kt +index 18f922c12e..28d2dafc38 100644 +--- a/modules/lwjgl/core/src/templates/kotlin/core/libffi/templates/LibFFI.kt ++++ b/modules/lwjgl/core/src/templates/kotlin/core/libffi/templates/LibFFI.kt +@@ -62,7 +62,7 @@ typedef void (*FFI_CLOSURE_FUN)(ffi_cif*, void*, void**, void*);""") + val ABI = EnumConstant( + """ + ABI enumeration. +- ++ + LWJGL note: ABIs that are not applicable to the current platform will have a value of -1 and should not be used. + """, + +@@ -107,7 +107,8 @@ typedef void (*FFI_CLOSURE_FUN)(ffi_cif*, void*, void**, void*);""") + + "OK".enum, + "BAD_TYPEDEF".enum, +- "BAD_ABI".enum ++ "BAD_ABI".enum, ++ "BAD_ARGTYPE".enum + ) + + macro..Address..ffi_type.p("type_void", "The {@code ffi_type_void} struct.", void()) +@@ -140,7 +141,7 @@ typedef void (*FFI_CLOSURE_FUN)(ffi_cif*, void*, void**, void*);""") + "prep_cif", + """ + Initializes the specified Call Interface (CIF) according to the given parameters. +- ++ + The resulting {@code ffi_cif} holds pointers to all the {@code ffi_type} objects that were used during initialization. You must ensure that these type + objects have a lifetime at least as long as that of the {@code ffi_cif}. + """, +@@ -195,7 +196,7 @@ typedef void (*FFI_CLOSURE_FUN)(ffi_cif*, void*, void**, void*);""") + "call", + """ + Calls the function {@code fn} according to the description given in {@code cif}. +- ++ + {@code cif} must have already been prepared using #prep_cif(). + """, + +@@ -208,7 +209,7 @@ typedef void (*FFI_CLOSURE_FUN)(ffi_cif*, void*, void**, void*);""") + "rvalue", + """ + a pointer to a chunk of memory that will hold the result of the function call. +- ++ + This must be large enough to hold the result, no smaller than the system register size (generally 32 or 64 bits), and must be suitably aligned; it + is the caller's responsibility to ensure this. If CIF declares that the function returns {@code void} (using #type_void), then {@code rvalue} is + ignored. +@@ -223,7 +224,7 @@ typedef void (*FFI_CLOSURE_FUN)(ffi_cif*, void*, void**, void*);""") + "avalues", + """ + a vector of {@code void *} pointers that point to the memory locations holding the argument values for a call. +- ++ + If {@code cif} declares that the function has no arguments (i.e., {@code nargs} was 0), then {@code avalues} is ignored. Note that argument values + may be modified by the callee (for instance, structs passed by value); the burden of copying pass-by-value arguments is placed on the caller. + +@@ -260,7 +261,7 @@ typedef void (*FFI_CLOSURE_FUN)(ffi_cif*, void*, void**, void*);""") + "closure_alloc", + """ + Allocates a chunk of memory holding {@code size} bytes. +- ++ + Returns a pointer to the writable address, and sets {@code *code} to the corresponding executable address. + """, + +@@ -281,7 +282,7 @@ typedef void (*FFI_CLOSURE_FUN)(ffi_cif*, void*, void**, void*);""") + "prep_closure_loc", + """ + Prepares a closure function. +- ++ + After calling {@code ffi_prep_closure_loc,} you can cast {@code codeloc} to the appropriate pointer-to-function type. + """, + +@@ -295,7 +296,7 @@ typedef void (*FFI_CLOSURE_FUN)(ffi_cif*, void*, void**, void*);""") + "{@code cif} - The {@code ffi_cif} passed to {@code ffi_prep_closure_loc}.", + """ + {@code ret} - a pointer to the memory used for the function's return value. +- ++ + If the function is declared as returning {@code void}, then this value is garbage and should not be used. + + Otherwise, {@code fun} must fill the object to which this points, following the same special promotion behavior as {@code ffi_call}. That is, diff --git a/user/lwjgl3/force-use-of-system-libffi.patch b/user/lwjgl3/force-use-of-system-libffi.patch new file mode 100644 index 0000000..7782fe4 --- /dev/null +++ b/user/lwjgl3/force-use-of-system-libffi.patch @@ -0,0 +1,38 @@ +From 6fc0c85eabffd4208221d74868702b52a6a3d17e Mon Sep 17 00:00:00 2001 +From: knuxify +Date: Sun, 11 Dec 2022 16:04:23 +0100 +Subject: [PATCH] force use of system libffi + +--- + config/linux/build.xml | 9 ++------- + 1 file changed, 2 insertions(+), 7 deletions(-) + +diff --git a/config/linux/build.xml b/config/linux/build.xml +index 299ca65..5098004 100644 +--- a/config/linux/build.xml ++++ b/config/linux/build.xml +@@ -187,13 +187,8 @@ + +
    + +- +- +- +- +- + +- ++ + + + +@@ -476,4 +471,4 @@ + + + +- +\ No newline at end of file ++ +-- +2.38.1 + diff --git a/user/lwjgl3/remove-gcc-prefixes-for-aarch64-arm32.patch b/user/lwjgl3/remove-gcc-prefixes-for-aarch64-arm32.patch new file mode 100644 index 0000000..4f1c712 --- /dev/null +++ b/user/lwjgl3/remove-gcc-prefixes-for-aarch64-arm32.patch @@ -0,0 +1,26 @@ +From 1b5ccef4539d7a1dadac4c35112cdc5a1fbf4e90 Mon Sep 17 00:00:00 2001 +From: knuxify +Date: Sun, 5 Feb 2023 16:19:58 +0100 +Subject: [PATCH] remove prefixes for aarch64/arm32 + +--- + config/linux/build.xml | 5 +--- + 1 file changed, 1 insertion(+), 3 deletions(-) + +diff --git a/config/linux/build.xml b/config/linux/build.xml +index 299ca65..e2fe8fe 100644 +--- a/config/linux/build.xml ++++ b/config/linux/build.xml +@@ -5,9 +5,6 @@ + + + +- +- +- + + + +-- +2.39.1 + diff --git a/user/lwjgl3/remove-preadv2.patch b/user/lwjgl3/remove-preadv2.patch new file mode 100644 index 0000000..42be464 --- /dev/null +++ b/user/lwjgl3/remove-preadv2.patch @@ -0,0 +1,52 @@ +From 77cce2fea2c6bf657a3d3fddecc731f596fe14dc Mon Sep 17 00:00:00 2001 +From: knuxify +Date: Sat, 26 Nov 2022 10:06:53 +0100 +Subject: [PATCH] rip preadv2 out of this file we don't have it + +--- + .../kotlin/core/linux/templates/uio.kt | 24 +------------------ + 1 file changed, 1 insertion(+), 23 deletions(-) + +diff --git a/modules/lwjgl/core/src/templates/kotlin/core/linux/templates/uio.kt b/modules/lwjgl/core/src/templates/kotlin/core/linux/templates/uio.kt +index 2d8f9bf..da03b03 100644 +--- a/modules/lwjgl/core/src/templates/kotlin/core/linux/templates/uio.kt ++++ b/modules/lwjgl/core/src/templates/kotlin/core/linux/templates/uio.kt +@@ -67,28 +67,6 @@ val uio = "UIO".nativeClass(Module.CORE_LINUX, nativeSubPath = "linux") { + off_t("__offset", "") + ) + +- SaveErrno..ssize_t( +- "preadv2", +- "", +- +- int("__fd", ""), +- iovec.const.p("__iovec", ""), +- int("__count", ""), +- off_t("__offset", ""), +- int("__flags", "") +- ) +- +- SaveErrno..ssize_t( +- "pwritev2", +- "", +- +- int("__fd", ""), +- iovec.const.p("__iovec", ""), +- int("__count", ""), +- off_t("__offset", ""), +- int("__flags", "") +- ) +- + SaveErrno..ssize_t( + "process_vm_readv", + "Read from another process' address space.", +@@ -112,4 +90,4 @@ val uio = "UIO".nativeClass(Module.CORE_LINUX, nativeSubPath = "linux") { + unsigned_long_int("__riovcnt", ""), + unsigned_long_int("__flags", "") + ) +-} +\ No newline at end of file ++} +-- +2.38.1 +