-
Notifications
You must be signed in to change notification settings - Fork 584
Fix static compilation regexp linking errors #21320
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
Conversation
Really wish you would list the main file changed on the subject line of your commits. Other than that I have fixed the PR with the last two patches I pushed into the branch. There are still some outstanding issues. 'make test_reonly' shouldnt throw its toys out of the pram. Also we produce a fair bit of warning noise during make test. |
I see that i onyl fixed it under DEBUGGING. I will dig more tomorrow. |
Ok, so that last patch fixes things with -Uusedl without -DEBUGGING, but apparently it breaks normal builds. I will have to pick it up again later. |
4c8ea0d
to
774e280
Compare
Third time lucky hopefully! |
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.
774e280
to
d1bb10e
Compare
This aims to fix #21319, but has some failing
use re 'strict'
tests that I can't quite explain.Possibly @demerphq needs to look at it since it seems to involve 85900e2