Skip to content

Please upgrade libffi to ≥ 3.4.3 #1488

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
xiangzhai opened this issue Dec 7, 2022 · 2 comments · Fixed by #1491
Closed

Please upgrade libffi to ≥ 3.4.3 #1488

xiangzhai opened this issue Dec 7, 2022 · 2 comments · Fixed by #1491

Comments

@xiangzhai
Copy link

xiangzhai commented Dec 7, 2022

Hi,

Libffi v3.4.3 adds support for static trampoline for LoongArch. Earlier versions, for example, v3.4.2 is lack of loongarch*-*-linux-* for enable_exec_static_tramp:

diff --git a/native/libffi/configure.ac b/native/libffi/configure.ac
index 70f6d2c2e..c70b23bf6 100644
--- a/native/libffi/configure.ac
+++ b/native/libffi/configure.ac
@@ -373,7 +373,7 @@ if test "$enable_exec_static_tramp" != no; then
 case "$target" in
      *-cygwin*)
      ;;  
-     *arm*-*-linux-* | aarch64*-*-linux-* | i*86-*-linux-* | x86_64-*-linux-*)
+     *arm*-*-linux-* | aarch64*-*-linux-* | i*86-*-linux-* | x86_64-*-linux-* | loongarch*-*-linux-*)
        AC_DEFINE(FFI_EXEC_STATIC_TRAMP, 1,
                  [Define this if you want statically defined trampolines])
      ;;         

ffi_tramp_arch for LoongArch64 is NULL when FFI_EXEC_STATIC_TRAMP is not defined, so ffi_tramp_init in the native/libffi/src/tramp.c will early return goto dynamic trampoline instead:

/*
 * Initialize the static trampoline feature.
 */
static int 
ffi_tramp_init (void)
{
  if (tramp_globals.status == TRAMP_GLOBALS_PASSED)
    return 1;

  if (tramp_globals.status == TRAMP_GLOBALS_FAILED)
    return 0;

=>  if (ffi_tramp_arch == NULL)
    {   
      tramp_globals.status = TRAMP_GLOBALS_FAILED;
=>      return 0;
    }   
...

Just merged static trampoline for LoongArch into jna in my local enviroment, passed all Testsuites, no regression.

Thanks,
Leslie Zhai

@Panxuefeng-loongson
Copy link
Contributor

@matthiasblaesing

@matthiasblaesing
Copy link
Member

Please check #1491

@matthiasblaesing matthiasblaesing linked a pull request Dec 16, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants