Re: [pcre-dev] How do I support pcre1 JIT on all versions?

Página superior
Eliminar este mensaje
Autor: Zoltán Herczeg
Fecha:  
A: Ævar Arnfjörð Bjarmason
Cc: Philip Hazel, pcre-dev@exim.org
Asunto: Re: [pcre-dev] How do I support pcre1 JIT on all versions?
> > I would simply use the PCRE version number to detect jit_exec at compile
> > time:
> >
> > #if (PCRE_MAJOR > 8 || (PCRE_MAJOR == 8 && PCRE_MINOR >= 32))
> > #define PCRE_JIT_EXEC_AVAILABLE
> > #endif
> That'll only work if pcre isn't compiled with --disable-jit, if it is
> even on the latest svn trunk linking against it results in:
> libgit.a(grep.o): In function `pcre1match':
> /home/avar/g/git/grep.c:411: undefined reference to `pcre_jit_exec'
> If you look at pcre_jit_compile.c the whole structure of the file is:
> #if defined SUPPORT_JIT
> [...]
> #define SLJIT_CONFIG_AUTO 1 /* ...and other macros */
> int
> PRIV(jit_exec)(const PUBL(extra) *extra_data, const pcre_uchar *subject,
> [...]
> #else /* SUPPORT_JIT */
> [... no definition of pcre_jit_exec ...]
> #endif
> I.e. the pcre_jit_exec symbol won't be in the library, and thus
> linking to it fails, so I need a macro accessible from pcre.h that
> tells me whether it's going to be there, calling pcre_config() will be
> too late.

Oh... we have dummy functions for jit stack management, but jit_exec is missing from. This is a bug and bad news. Perhaps defining a weak symbol could help, but might be not portable enough. Falling back to pcre_exec is also an option.

Are the SLJIT macros visible outside? That is also something which shouldn't be :(

Regards,
Zoltan