Branch: refs/heads/leont/regcomp_static Home: https://github.com/Perl/perl5 Commit: d1bb10ec24093377f8bcabe597ce4fd89c742d59 https://github.com/Perl/perl5/commit/d1bb10ec24093377f8bcabe597ce4fd89c742d59 Author: Yves Orton <demer...@gmail.com> Date: 2023-08-03 (Thu, 03 Aug 2023)
Changed paths: M regcomp.c M regcomp.h M regcomp_debug.c M regcomp_invlist.c M regexec.c Log Message: ----------- regcomp*.c, regexec.c - fixup regex engine build under -Uusedl The regex engine is built a bit different from most of the perl codebase. It is compiled as part of the main libperl.so and it is also compiled (with DEBUGGING enabled) as part of the re extension. When perl itself is compiled with DEBUGGING enabled then the code in the re.so extension and the code in libperl.so is the same. This all works fine and dandy until you have a static build where the re.so is linked into libperl.so, which results in duplicate symbols being defined. These symbols come in two flaviours: "auxiliary" and "debugging" related symbols. We have basically three cases: 1. USE_DYNAMIC_LOADING is defined. In this case we are doing a dynamic build and re.so will be separate from libperl.so, so it even if this is a DEBUGGING enabled build debug and auxiliary functions can be compiled into *both* re.so and libperl.so. This is basically the "standard build". 2. USE_DYNAMIC_LOADING is not defined, and DEBUGGING is not defined either. In this case auxiliary functions should only be compiled in libperl.so, and the debug functions should only be compiled into re.so 3. USE_DYNAMIC_LOADING is not defined, and DEBUGGING *is* defined. In this case auxiliary functions AND debug functions should only be compiled into libperl.so It is possible to detect the different build options by looking at the defines 'USE_DYNAMIC_LOADING', 'PERL_EXT_RE_DEBUG' and 'DEBUGGING_RE_ONLY'. 'USE_DYNAMIC_LOADING' is NOT defined when we are building a static perl. 'PERL_EXT_RE_DEBUG' is defined only when we are building re.so, and 'DEBUGGING_RE_ONLY' is defined only when we are building re.so in a perl that is not itself already a DEBUGGING enabled perl. The file ext/re/re_top.h responsible for setting up DEBUGGING_RE_ONLY. This patch uses 'PERL_EXT_RE_DEBUG', 'DEBUGGING_RE_ONLY' and 'USE_DYNAMIC_LOADING' to define in regcomp.h two further define flags 'PERL_RE_BUILD_DEBUG' and 'PERL_RE_BUILD_AUX'. The 'PERL_RE_BUILD_DEBUG' flag determines if the debugging functions should be compiled into libperl.so or re.so or both. The 'PERL_RE_BUILD_AUX' flag determines if the auxiliary functions should be compiled into just libperl.so or into it and re.so. We then use these flags to guard the different types of functions so that we can build in all three modes without duplicate symbols.