Skip to content

Commit

Permalink
Merge pull request #8 from zakkak/2024-08-20-backport-libffi-update
Browse files Browse the repository at this point in the history
Backport: [GR-55064] Update LIBFFI to 3.4.6
  • Loading branch information
zakkak authored Aug 28, 2024
2 parents 47161c4 + 2d5a579 commit 722c5d5
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 107 deletions.
6 changes: 3 additions & 3 deletions truffle/mx.truffle/mx_truffle.py
Original file line number Diff line number Diff line change
Expand Up @@ -1036,10 +1036,10 @@ def __init__(self, suite, name, deps, workingSets, **kwargs):
self.out_dir = self.get_output_root()
if mx.get_os() == 'windows':
self.delegate = mx_native.DefaultNativeProject(suite, name, subDir, [], [], None,
mx.join(self.out_dir, 'libffi-3.4.4'),
mx.join(self.out_dir, 'libffi-3.4.6'),
'static_lib',
deliverable='ffi',
cflags=['-MD', '-O2', '-DFFI_BUILDING_DLL'])
cflags=['-MD', '-O2', '-DFFI_STATIC_BUILD'])
self.delegate._source = dict(tree=['include',
'src',
mx.join('src', 'x86')],
Expand Down Expand Up @@ -1073,7 +1073,7 @@ def getArchivableResults(self, use_relpath=True, single=False):
'include/ffi.h',
'include/ffitarget.h'],
mx.join(self.out_dir, 'libffi-build'),
mx.join(self.out_dir, 'libffi-3.4.4'))
mx.join(self.out_dir, 'libffi-3.4.6'))
configure_args = ['--disable-dependency-tracking',
'--disable-shared',
'--with-pic',
Expand Down
4 changes: 2 additions & 2 deletions truffle/mx.truffle/suite.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,12 @@

"LIBFFI_SOURCES" : {
"resource" : True,
"version" : "3.4.4",
"version" : "3.4.6",
"urls" : [
"https://lafo.ssw.uni-linz.ac.at/pub/graal-external-deps/libffi-{version}.tar.gz",
"https://github.com/libffi/libffi/releases/download/v{version}/libffi-{version}.tar.gz",
],
"digest" : "sha512:88680aeb0fa0dc0319e5cd2ba45b4b5a340bc9b4bcf20b1e0613b39cd898f177a3863aa94034d8e23a7f6f44d858a53dcd36d1bb8dee13b751ef814224061889",
"digest" : "sha512:033d2600e879b83c6bce0eb80f69c5f32aa775bf2e962c9d39fbd21226fa19d1e79173d8eaa0d0157014d54509ea73315ad86842356fc3a303c0831c94c6ab39",
},

"ANTLR4": {
Expand Down
2 changes: 1 addition & 1 deletion truffle/src/com.oracle.truffle.nfi.native/src/closure.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
*/
#if defined(_WIN32)
// Workaround for static linking. See comment in ffi.h, line 115.
#define FFI_BUILDING
#define FFI_STATIC_BUILD
#endif

#include "trufflenfi.h"
Expand Down
2 changes: 1 addition & 1 deletion truffle/src/com.oracle.truffle.nfi.native/src/jni.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
*/
#if defined(_WIN32)
// Workaround for static linking. See comment in ffi.h, line 115.
#define FFI_BUILDING
#define FFI_STATIC_BUILD
#endif

#include "native.h"
Expand Down
2 changes: 1 addition & 1 deletion truffle/src/com.oracle.truffle.nfi.native/src/signature.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
*/
#if defined(_WIN32)
// Workaround for static linking. See comment in ffi.h, line 115.
#define FFI_BUILDING
#define FFI_STATIC_BUILD
#endif

#include "native.h"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
From dcbda6eaf27ea03dd09b0d7edf67351c07209f2f Mon Sep 17 00:00:00 2001
From fd913e2cce4901c12be4b6e0d88a1a719cc3a8fb Mon Sep 17 00:00:00 2001
From: Roland Schatz <[email protected]>
Date: Thu, 7 Apr 2022 18:09:05 +0200
Date: Mon, 8 Jul 2024 14:18:28 +0200
Subject: [PATCH 1/2] Preconfigure sources for x64 Windows build

The configuration was done using Git for Windows to run
`configure` from Developer Command Prompt:
The configuration was done using the x64 Native Tools Command Prompt for
VS 2022, with Git for Windows on the PATH. To reproduce run this
command:

> sh configure --disable-builddir ^
--disable-dependency-tracking ^
Expand All @@ -16,33 +17,29 @@ The configuration was done using Git for Windows to run
CXXCPP="cl -nologo -EP" ^
--build=amd64-mingw64
---
fficonfig.h.in => fficonfig.h | 125 ++++++++++++++++---------------
include/{ffi.h.in => ffi.h} | 18 ++---
fficonfig.h.in => fficonfig.h | 103 ++++++++++++++++---------------
include/{ffi.h.in => ffi.h} | 14 ++---
{src/x86 => include}/ffitarget.h | 0
3 files changed, 72 insertions(+), 71 deletions(-)
rename fficonfig.h.in => fficonfig.h (71%)
3 files changed, 59 insertions(+), 58 deletions(-)
rename fficonfig.h.in => fficonfig.h (70%)
rename include/{ffi.h.in => ffi.h} (98%)
rename {src/x86 => include}/ffitarget.h (100%)

diff --git a/fficonfig.h.in b/fficonfig.h
similarity index 71%
similarity index 70%
rename from fficonfig.h.in
rename to fficonfig.h
index d38b781..6284190 100644
index 2e4aac6..59723f3 100644
--- a/fficonfig.h.in
+++ b/fficonfig.h
@@ -1,171 +1,172 @@
@@ -1,159 +1,160 @@
+/* fficonfig.h. Generated from fficonfig.h.in by configure. */
/* fficonfig.h.in. Generated from configure.ac by autoheader. */

/* Define if building universal (internal helper macro) */
-#undef AC_APPLE_UNIVERSAL_BUILD
+/* #undef AC_APPLE_UNIVERSAL_BUILD */

/* Define to 1 if using 'alloca.c'. */
-#undef C_ALLOCA
+/* #undef C_ALLOCA */

/* Define to the flags needed for the .section .eh_frame directive. */
-#undef EH_FRAME_FLAGS
+/* #undef EH_FRAME_FLAGS */
Expand Down Expand Up @@ -76,11 +73,7 @@ index d38b781..6284190 100644
-#undef FFI_NO_STRUCTS
+/* #undef FFI_NO_STRUCTS */

/* Define to 1 if you have 'alloca', as a function or macro. */
-#undef HAVE_ALLOCA
+#define HAVE_ALLOCA 1

/* Define to 1 if <alloca.h> works. */
/* Define to 1 if you have the <alloca.h> header file. */
-#undef HAVE_ALLOCA_H
+/* #undef HAVE_ALLOCA_H */

Expand Down Expand Up @@ -137,30 +130,6 @@ index d38b781..6284190 100644
-#undef HAVE_MEMFD_CREATE
+/* #undef HAVE_MEMFD_CREATE */

/* Define to 1 if you have the `mkostemp' function. */
-#undef HAVE_MKOSTEMP
+/* #undef HAVE_MKOSTEMP */

/* Define to 1 if you have the `mkstemp' function. */
-#undef HAVE_MKSTEMP
+/* #undef HAVE_MKSTEMP */

/* Define to 1 if you have the `mmap' function. */
-#undef HAVE_MMAP
+/* #undef HAVE_MMAP */

/* Define if mmap with MAP_ANON(YMOUS) works. */
-#undef HAVE_MMAP_ANON
+/* #undef HAVE_MMAP_ANON */

/* Define if mmap of /dev/zero works. */
-#undef HAVE_MMAP_DEV_ZERO
+/* #undef HAVE_MMAP_DEV_ZERO */

/* Define if read-only mmap of a plain file works. */
-#undef HAVE_MMAP_FILE
+/* #undef HAVE_MMAP_FILE */

/* Define if your compiler supports pointer authentication. */
-#undef HAVE_PTRAUTH
+/* #undef HAVE_PTRAUTH */
Expand Down Expand Up @@ -193,10 +162,6 @@ index d38b781..6284190 100644
-#undef HAVE_SYS_MEMFD_H
+/* #undef HAVE_SYS_MEMFD_H */

/* Define to 1 if you have the <sys/mman.h> header file. */
-#undef HAVE_SYS_MMAN_H
+/* #undef HAVE_SYS_MMAN_H */

/* Define to 1 if you have the <sys/stat.h> header file. */
-#undef HAVE_SYS_STAT_H
+#define HAVE_SYS_STAT_H 1
Expand Down Expand Up @@ -231,7 +196,7 @@ index d38b781..6284190 100644

/* Define to the full name and version of this package. */
-#undef PACKAGE_STRING
+#define PACKAGE_STRING "libffi 3.4.4"
+#define PACKAGE_STRING "libffi 3.4.6"

/* Define to the one symbol short name of this package. */
-#undef PACKAGE_TARNAME
Expand All @@ -243,7 +208,7 @@ index d38b781..6284190 100644

/* Define to the version of this package. */
-#undef PACKAGE_VERSION
+#define PACKAGE_VERSION "3.4.4"
+#define PACKAGE_VERSION "3.4.6"

/* The size of `double', as computed by sizeof. */
-#undef SIZEOF_DOUBLE
Expand All @@ -257,15 +222,6 @@ index d38b781..6284190 100644
-#undef SIZEOF_SIZE_T
+#define SIZEOF_SIZE_T 8

/* If using the C implementation of alloca, define if you know the
direction of stack growth for your system; otherwise it will be
@@ -173,22 +174,22 @@
STACK_DIRECTION > 0 => grows toward higher addresses
STACK_DIRECTION < 0 => grows toward lower addresses
STACK_DIRECTION = 0 => direction of growth unknown */
-#undef STACK_DIRECTION
+/* #undef STACK_DIRECTION */

/* Define to 1 if all of the C90 standard headers exist (not just the ones
required in a freestanding environment). This macro is provided for
backward compatibility; new code need not use it. */
Expand All @@ -283,11 +239,11 @@ index d38b781..6284190 100644

/* Version number of package */
-#undef VERSION
+#define VERSION "3.4.4"
+#define VERSION "3.4.6"

/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
significant byte first (like Motorola and SPARC, unlike Intel). */
@@ -198,12 +199,12 @@
@@ -163,7 +164,7 @@
# endif
#else
# ifndef WORDS_BIGENDIAN
Expand All @@ -296,24 +252,18 @@ index d38b781..6284190 100644
# endif
#endif

/* Define to `unsigned int' if <sys/types.h> does not define. */
-#undef size_t
+/* #undef size_t */


#ifdef HAVE_HIDDEN_VISIBILITY_ATTRIBUTE
diff --git a/include/ffi.h.in b/include/ffi.h
similarity index 98%
rename from include/ffi.h.in
rename to include/ffi.h
index 227ac79..6318a33 100644
index e5c1dae..ef012e2 100644
--- a/include/ffi.h.in
+++ b/include/ffi.h
@@ -1,5 +1,5 @@
/* -----------------------------------------------------------------*-C-*-
- libffi @VERSION@
+ libffi 3.4.4
- Copyright (c) 2011, 2014, 2019, 2021, 2022 Anthony Green
+ libffi 3.4.6
- Copyright (c) 2011, 2014, 2019, 2021, 2022, 2024 Anthony Green
- Copyright (c) 1996-2003, 2007, 2008 Red Hat, Inc.

@@ -50,8 +50,8 @@ extern "C" {
Expand All @@ -336,25 +286,7 @@ index 227ac79..6318a33 100644
#define FFI_TYPE_LONGDOUBLE 4
#else
#define FFI_TYPE_LONGDOUBLE FFI_TYPE_DOUBLE
@@ -223,7 +223,7 @@ FFI_EXTERN ffi_type ffi_type_float;
FFI_EXTERN ffi_type ffi_type_double;
FFI_EXTERN ffi_type ffi_type_pointer;

-#if @HAVE_LONG_DOUBLE@
+#if 0
FFI_EXTERN ffi_type ffi_type_longdouble;
#else
#define ffi_type_longdouble ffi_type_double
@@ -232,7 +232,7 @@ FFI_EXTERN ffi_type ffi_type_longdouble;
#ifdef FFI_TARGET_HAS_COMPLEX_TYPE
FFI_EXTERN ffi_type ffi_type_complex_float;
FFI_EXTERN ffi_type ffi_type_complex_double;
-#if @HAVE_LONG_DOUBLE@
+#if 0
FFI_EXTERN ffi_type ffi_type_complex_longdouble;
#else
#define ffi_type_complex_longdouble ffi_type_complex_double
@@ -333,7 +333,7 @@ size_t ffi_java_raw_size (ffi_cif *cif) __attribute__((deprecated));
@@ -322,7 +322,7 @@ size_t ffi_java_raw_size (ffi_cif *cif) __attribute__((deprecated));
__declspec(align(8))
#endif
typedef struct {
Expand All @@ -363,7 +295,7 @@ index 227ac79..6318a33 100644
void *trampoline_table;
void *trampoline_table_entry;
#else
@@ -394,7 +394,7 @@ ffi_prep_closure_loc (ffi_closure*,
@@ -375,7 +375,7 @@ ffi_prep_closure_loc (ffi_closure*,
# pragma pack 8
#endif
typedef struct {
Expand All @@ -372,7 +304,7 @@ index 227ac79..6318a33 100644
void *trampoline_table;
void *trampoline_table_entry;
#else
@@ -419,7 +419,7 @@ typedef struct {
@@ -400,7 +400,7 @@ typedef struct {
} ffi_raw_closure;

typedef struct {
Expand All @@ -386,5 +318,5 @@ similarity index 100%
rename from src/x86/ffitarget.h
rename to include/ffitarget.h
--
2.38.4
2.44.1

Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
From e5a5380862ea8e92c3e0c1634c5f305c8648425b Mon Sep 17 00:00:00 2001
From 9601e9219678f2a1ad628ae78e4d8c11c27217a9 Mon Sep 17 00:00:00 2001
From: Roland Schatz <[email protected]>
Date: Wed, 17 May 2023 16:10:46 +0200
Subject: [PATCH 2/2] Adjust sources for building with mx

---
include/Makefile.am | 9 -
include/Makefile.in | 610 ---------------------------------
include/Makefile.in | 609 ---------------------------------
{include => src}/ffi_common.h | 0
fficonfig.h => src/fficonfig.h | 0
4 files changed, 619 deletions(-)
4 files changed, 618 deletions(-)
delete mode 100644 include/Makefile.am
delete mode 100644 include/Makefile.in
rename {include => src}/ffi_common.h (100%)
Expand All @@ -31,10 +31,10 @@ index 5f0d406..0000000
-nodist_include_HEADERS = ffi.h ffitarget.h
diff --git a/include/Makefile.in b/include/Makefile.in
deleted file mode 100644
index 7e3bbf0..0000000
index ae3ad01..0000000
--- a/include/Makefile.in
+++ /dev/null
@@ -1,610 +0,0 @@
@@ -1,609 +0,0 @@
-# Makefile.in generated by automake 1.16.5 from Makefile.am.
-# @configure_input@
-
Expand Down Expand Up @@ -219,7 +219,6 @@ index 7e3bbf0..0000000
-am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/ffi.h.in
-DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
-ACLOCAL = @ACLOCAL@
-ALLOCA = @ALLOCA@
-AMTAR = @AMTAR@
-AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
-AM_LTLDFLAGS = @AM_LTLDFLAGS@
Expand Down Expand Up @@ -654,5 +653,5 @@ similarity index 100%
rename from fficonfig.h
rename to src/fficonfig.h
--
2.38.4
2.44.1

0 comments on commit 722c5d5

Please sign in to comment.