--enable-perlinterp=dynamic against Perl 5.36readelf -d revealing a DT_NEEDED entry for libperl.soThe vim binary should not be linked to libperl so it can be dynamically loaded at runtime.
Comparing the readelf -Ws vim | grep UND output between Perl 5.34 and 5.36 shows a new symbol reference: PL_current_context
8.2.5046
Arch Linux x86_64
No response
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
Is this a problem specific for Perl 5.36 or for Arch Linux?
It appears to be specific to Perl 5.36 because it was fine with Perl 5.34 on Arch Linux too.
As far as I can tell, the PL_current_context symbol is new in Perl 5.36 and was introduced by Perl/perl5@3683a9e.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
Vim does not use PL_current_context, I'm not sure if we can do anything about this.
You could ask the Perl maintainers about this.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
As far as I can see, including perl.h brings in Perl's thread.h which in turn contains a reference to PL_current_context.
A code comment added as part of Perl/perl5@3683a9e has this to say about it:
* This is not a regular "global" in that we don't know whether it needs to
* exist until we include threads.h, and we don't want it as part of any
* global struct (if that or something similar is re-introduced.
This feels similar to how previous major Perl upgrades have required changes in Vim to accommodate them, even though Vim's code didn't change in regard to its Perl usage.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
This following change prevents Vim from linking to libperl (without breaking the test suite):
diff --git a/src/if_perl.xs b/src/if_perl.xs index 1afb1d4cf..8aab5337b 100644 --- a/src/if_perl.xs +++ b/src/if_perl.xs @@ -168,6 +168,10 @@ typedef int XSUBADDR_t; typedef int perl_key; # endif +#if defined(USE_ITHREADS) && defined(PERL_THREAD_LOCAL) +PERL_THREAD_LOCAL void *PL_current_context; +#endif + # ifndef MSWIN # include <dlfcn.h> # define HANDLE void*
However, I am not sure if this is the correct approach or how it interacts with the same symbol in libperl:
$ readelf -Ws src/vim | grep PL_current_context
1184: 0000000000000000 8 TLS GLOBAL DEFAULT 17 PL_current_context
$ readelf -Ws /usr/lib/perl5/5.36/core_perl/CORE/libperl.so | grep PL_current_context
1452: 0000000000000000 8 TLS GLOBAL DEFAULT 15 PL_current_context
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
At a face value, resolving this is trivial - just add the extra symbol to be dlsym-ed (just like PL_thr_key) can call it a day. Although looking deeper things are a bit more convoluted:
The symbol is annotated as _Thread_local and fetched once in the early startup stage. Then the symbol is used with perl when spawning threads and boom. If the created was created first and then the symbol was fetched the standard runtime would provide separate truly thread-local symbols.
So there's on obvious solution for this atm ... at least not without some proper digging.
Although this bug has highlighted another bug - when --enable-perlintero=dynamic is used the link command is not updated to exclude the library - filed as #12827
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
just add the extra symbol to be dlsym-ed (just like PL_thr_key) can call it a day
can you create a PR for this please 🙏 ?
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
This should have been fixed in 9.0.1700. Closing.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
Closed #10512 as completed.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
Cannot see the new symbol being added to the codebase so I'm not sure how that can be fixed.
Regardless, just gave this a try and it's still broken - see objdump -CtT .../vim | grep PL_current_context
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
As mentioned in my earlier reply - fixing this isn't particularly straightforward, since the symbol is annotated as _Thread_local.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()