Skip to content

openbsd: ensure we link to the built libperl.a, not the system libperl.a #23265

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

Open
wants to merge 3 commits into
base: blead
Choose a base branch
from

Conversation

tonycoz
Copy link
Contributor

@tonycoz tonycoz commented May 7, 2025

When building with gcc, lib/ExtUtils/t/Embed.t would link against the system libperl.a rather than the newly built libperl.a.

Due to the limited API used by the sample code this typically didn't crash, but some configuration changes could result in a crash or a link error.

For OpenBSD, change the link options to more closely match those used when building the perl executable, which results in linking against the correct library.

Fixes #22125

Also adds a test to ensure we are linking against the correct libperl.

Smoke reports from before a trivial rebase at https://perl.develop-help.com/?b=smoke-me%2Ftonyc%2F22125-openbsd-embed


  • This set of changes requires a perldelta entry, and it is included.

tonycoz added 3 commits May 7, 2025 13:09
Issue Perl#22125 detected that we weren't linking the correct library with
the embedded test with gcc on OpenBSD, so add an API to perform a
sanity check by comparing the size of the perl interpreter
structure (or its size if it was a structure) and expected perl API
version between those seen in the binary and those compiled into
libperl.
When building with gcc, lib/ExtUtils/t/Embed.t would link against
the system libperl.a rather than the newly built libperl.a.

Due to the limited API used by the sample code this typically didn't
crash, but some configuration changes could result in a crash or a
link error.

For OpenBSD, change the link options to more closely match those
used when building the perl executable, which results in linking
against the correct library.

Fixes Perl#22125
@jkeenan
Copy link
Contributor

jkeenan commented May 7, 2025

@tonycoz, thanks for continuing to investigate this. Could you rebase your smoke-me branch and push this new code to that branch? That way, @cjg-cguevara's smoker will pick up the branch.

@afresh1, can you take a look at this p.r.? Thanks.

@jkeenan
Copy link
Contributor

jkeenan commented May 7, 2025

@tonycoz: I fetched your p.r. and built a perl locally per the following:

$ uname -mrs
OpenBSD 6.9 amd64
$ gcc --version
gcc (GCC) 4.2.1 20070719 
$ gitcurr
gh-23265-tonycoz-22125-openbsd-embed-20250507
$ ./perl -Ilib -V:config_args
config_args='-des -Dusedevel -Dcc=gcc -Accflags=-DPERL_RC_STACK -DDEBUG_LEAKING_SCALARS';
$ ./perl -Ilib -v | head -2 | tail -1
This is perl 5, version 41, subversion 13 (v5.41.13 (v5.41.12-41-g060adda81e)) built for OpenBSD.amd64-openbsd

This configuration was the first one I discussed in #22125. All tests PASSed. So that's a very good sign. I will want to re-test this with clang10 and g++. However, as previously reported my OpenBSD-VM version is obsolete, so we'll need feedback from people who have more up-to-date versions of the platform and its C-compilers. Having your p.r. code in the smoke-me branch will be very helpful for this.

@tonycoz
Copy link
Contributor Author

tonycoz commented May 7, 2025

Having your p.r. code in the smoke-me branch will be very helpful for this.

I pushed it to the smoke-me, https://perl.develop-help.com/?b=smoke-me%2Ftonyc%2F22125-openbsd-embed we're just waiting for results now.

@jkeenan
Copy link
Contributor

jkeenan commented May 7, 2025

I've also gotten a PASS with the following configuration:

$ ./perl -Ilib -V:config_args
config_args='-des -Dusedevel -Dcc=clang -Accflags=-DPERL_RC_STACK -DDEBUG_LEAKING_SCALARS';

Am beginning a smoke-test run with my customary configurations. That will take several hours. Note that I haven't looked at the code changes at all -- only the test results.

@afresh1
Copy link
Contributor

afresh1 commented May 7, 2025

I should be able to run tests with this. Will have to remember which architectures I have that still use gcc :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

lib/ExtUtils/t/Embed.t: failures on OpenBSD when compiling with gcc but not with clang
3 participants