GNU bug report logs - #41242
Port feature/native-comp to Windows

Previous Next

Package: emacs;

Reported by: Nicolas Bértolo <nicolasbertolo <at> gmail.com>

Date: Wed, 13 May 2020 19:28:01 UTC

Severity: wishlist

Done: Andrea Corallo <akrl <at> sdf.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Andrea Corallo <akrl <at> sdf.org>
To: Nicolas Bértolo <nicolasbertolo <at> gmail.com>
Cc: 41242 <at> debbugs.gnu.org
Subject: bug#41242: Port feature/native-comp to Windows - Reduce the number of files probed when finding a lisp file.
Date: Tue, 02 Jun 2020 23:08:16 +0000
Nicolas Bértolo <nicolasbertolo <at> gmail.com> writes:

> Hi,
>
> The recent patches broke the Windows build. There is one patch that
> fixes it and another one that improves the way to check for the gccjit version
> functions.

I've pushed "Fix DLL imports of gccjit version functions." on the second
I've some perplexity.

> Nico.
> From 8aa7673f626bfa2c12e6f9c8bbec102ce2fb72d1 Mon Sep 17 00:00:00 2001
> From: =?UTF-8?q?Nicol=C3=A1s=20B=C3=A9rtolo?= <nicolasbertolo <at> gmail.com>
> Date: Mon, 1 Jun 2020 19:56:37 -0300
> Subject: [PATCH 2/2] Remove kludge for detecting if gcc_jit_version_major can
>  be called.
>
> * src/comp.c (comp-libgccjit-version): Use 'dlsym' in Posix and the
> normal function loading mechanism in Windows.
> ---
>  src/comp.c | 23 ++++++++++++++---------
>  1 file changed, 14 insertions(+), 9 deletions(-)
>
> diff --git a/src/comp.c b/src/comp.c
> index 8e7582b3e65..084d0b6745b 100644
> --- a/src/comp.c
> +++ b/src/comp.c
> @@ -365,6 +365,8 @@ #define gcc_jit_version_major fn_gcc_jit_version_major
>  #define gcc_jit_version_minor fn_gcc_jit_version_minor
>  #define gcc_jit_version_patchlevel fn_gcc_jit_version_patchlevel
>  
> +#else
> +#include <dlfcn.h>
>  #endif
>  
>  static bool
> @@ -3999,15 +4001,18 @@ DEFUN ("comp-libgccjit-version", Fcomp_libgccjit_version,
>  #if defined (LIBGCCJIT_HAVE_gcc_jit_version) || defined (WINDOWSNT)
>    load_gccjit_if_necessary (true);
>  
> -  /* FIXME this kludge is quite bad.  Can we dynamically load on all
> -     operating systems?  */
> -#pragma GCC diagnostic ignored "-Waddress"
> -  return gcc_jit_version_major
> -    ? list3 (make_fixnum (gcc_jit_version_major ()),
> -	     make_fixnum (gcc_jit_version_minor ()),
> -	     make_fixnum (gcc_jit_version_patchlevel ()))
> -    : Qnil;
> -#pragma GCC diagnostic pop
> +  bool ok_to_call;
> +
> +#if defined (WINDOWSNT)
> +  ok_to_call = !!fn_gcc_jit_version_major;
> +#else
> +  ok_to_call = !!dlsym (RTLD_DEFAULT, "gcc_jit_version_major");
> +#endif
> +
> +  return ok_to_call ? list3 (make_fixnum (gcc_jit_version_major ()),
> +                             make_fixnum (gcc_jit_version_minor ()),
> +                             make_fixnum (gcc_jit_version_patchlevel ()))
> +                    : Qnil;
>  #else
>    return Qnil;
>  #endif

First given is giving away two pragmas for adding three preprocessor
directives I'd say it is adding more kludge then what is removing.

Second this code would fail both link time and load time if the linker
cannot resolve one of these three functions making the test on the
result of dlsym in the run time pointless.  To work one needs to go
through function pointers as you are doing in Window, but some macrology
is requested otherwise would be a kludge^2.

  Andrea

-- 
akrl <at> sdf.org




This bug report was last modified 5 years and 41 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.