-
Notifications
You must be signed in to change notification settings - Fork 559
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
t/porting/libperl.t failure with GCC 12 and -flto #20518
Comments
I haven't tested if this is GCC 12 specific. It was reported quite a while ago so it might well happen with earlier GCC versions too. |
I was able to reproduce these failures on Linux (Debian 11) using
And, for what it's worth, I tried this with
(I've never tried those 2 switches myself, so I don't know what to expect.) |
Can you describe, in lay person's terms, what |
On Linux (Debian 11), using gcc-10 as the C-compiler, I checked out various tags and built with this configuration:
As was the case with HEAD and v5.36.0, I got two failures in So that leads me to ask: What evidence do you have that these configuration switches ever built and tested successfully? |
On Wed, 16 Nov 2022 15:26:22 -0800, James E Keenan wrote:
Can you describe, in lay person's terms, what `-flto` is intended
to accomplish? I can't recall seeing that used in any of our
smoke-testing, nor can I recall previous bug reports with that.
I'm sure that @ntyni can explain this in a better way, but for
starters, the announcement at
<https://lists.debian.org/debian-devel/2022/06/msg00092.html>
and the wiki link there might be helpful.
Cheers,
gregor
…--
.''`. https://info.comodo.priv.at -- Debian Developer https://www.debian.org
: :' : OpenPGP fingerprint D1E1 316E 93A7 60A8 104D 85FA BB3A 6801 8649 AA06
`. `' Member VIBE!AT & SPI Inc. -- Supporter Free Software Foundation Europe
`- BOFH excuse #11: magnetic interference from money/credit cards
|
On Wed, Nov 16, 2022 at 12:17:18PM -0800, Niko Tyni wrote:
$ ./Configure -des -Dusedevel -Dccflags=-flto -Dldflags=-flto && make -j4 && make test
[...]
t/porting/libperl ................................................ # Failed test 3 - has data const symbols at porting/libperl.t line 322
# Failed test 4 - has PL_no_mem at porting/libperl.t line 323
FAILED at test 3
[...]
Failed 1 test out of 2502, 99.96% okay.
porting/libperl.t
not ok 3 - has data const symbols
# Failed test 3 - has data const symbols at t/porting/libperl.t line 322
not ok 4 - has PL_no_mem
# Failed test 4 - has PL_no_mem at t/porting/libperl.t line 323
# nocommon = 0
The proximate cause of these two failures is a lack of readonly symbols in
libperl.a.
In a normal build:
$ /usr/bin/nm libperl.a | grep ' [Rr] '
0000000000000e00 r array_passed_to_stat
00000000000003e0 r bodies_by_type
00000000000087c0 r custom_op_register_vtbl
...
$ /usr/bin/nm libperl.a | grep PL_no_mem
U PL_no_mem
0000000000000850 R PL_no_mem
$
In a -flto build:
$ /usr/bin/nm libperl.a | grep ' [Rr] '
$
$ /usr/bin/nm libperl.a | grep PL_no_mem
U PL_no_mem
00000000 D PL_no_mem
$
(Note that PL_no_mem has changed from R to D.)
I don't know enough about LTO to know whether not having such symbols is
to be expected and thus whether libperl.t should just skip those two tests
when perl is configured with -flto.
…--
More than any other time in history, mankind faces a crossroads. One path
leads to despair and utter hopelessness. The other, to total extinction.
Let us pray we have the wisdom to choose correctly.
-- Woody Allen
|
@gregoa, thank you very much for those URLs. Here is my summary/paraphrase of what they say: Link time optimizations are an optimization that helps with a single digit percent number optimizing both for smaller size, and better speed. ... The proposal is to turn on LTO by default on most 64bit release architectures. In test rebuilds, there were 373 packages (dd-list in the wiki page) found not to build with link time optimizations for various reasons. [Perl is one of those with test failures.] The idea is to fix as many of these as possible, and then change the packaging for the others to just turn off LTO in the package build. So this ticket is only incidentally a report of test failures. It's actually a request for a new functionality, i.e., build Until reading this ticket I had never heard of link-time optimizations, so I don't know how we should proceed. @ntyni, @gregoa, @jmdh, could one of you write up a post for the perl5-porters mailing list about Debian's move to LTO? That list has much wider visibility than these GH issues and it would be good for our readership to learn more about this new initiative. Thank you very much. |
Indeed. Apologies for the misunderstanding.
Okay; mail sent. Niko |
I think we should change the test. We should not make assumptions about in which section the compiler puts that variable. |
Could you explain what these "sections" are? Also, would it be possible to get a p.r. for skipping the tests? |
They're the different parts of the ELF binary format for executables and libraries. There is one section that is readonly and pre-initialized at compile time and the test expects a the variable to be put in there. Apparently when using link-time optimization it shows up in the "initialized data section" (used for static writable variables) for the library, even if it ends up read-only in the resulting executable. I don't know if this is a bug in nm or a side-effect of this decision being made at link time. In either case, we should either:
|
For lto builds with gcc and clang the PL_no_mem symbol as listed by nm is flagged as "D" (writable data) and "T" (text, aka code) respectively. Looking at the final generated executable PL_no_mem does end up in the .rodata (read only data) section, so it might be worth adding a separate test for that. Fixes Perl#20518
I can see it being useful as a "does the toolchain work as we expect" test, but maybe not a test that we run in the released perl. |
Do we currently have any porting tests in the core distribution which are for the purpose of verifying "that the toolchain works as we expect"? If not, how (and where) would we implement such a test? |
libperl.t is the only one that I can see that specifically tests the build toolchain. Several tests end up testing the underlying operating system, and have caused problems when the OS had bugs (the recent Solaris PERLIO=stdio bug, and DragonflyBSD error reporting for tty functions for example). |
I suspect the failing test is the sort of test that is much more likely to fail due to this sort of fragility than because of an actual toolchain failure. A lot of these things are much harder to check for reliably than one may think. |
For LTO builds with gcc and clang the PL_no_mem symbol as listed by nm is flagged as "D" (writable data) and "T" (text, aka code) respectively. Looking at the final generated executable PL_no_mem does end up in the .rodata (read only data) section, so it might be worth adding a separate test for that. Fixes Perl#20518
For LTO builds with gcc and clang the PL_no_mem symbol as listed by nm is flagged as "D" (writable data) and "T" (text, aka code) respectively. Looking at the final generated executable PL_no_mem does end up in the .rodata (read only data) section, so it might be worth adding a separate test for that. Fixes Perl#20518
For LTO builds with gcc and clang the PL_no_mem symbol as listed by nm is flagged as "D" (writable data) and "T" (text, aka code) respectively. Looking at the final generated executable PL_no_mem does end up in the .rodata (read only data) section, so it might be worth adding a separate test for that. Fixes #20518
For LTO builds with gcc and clang the PL_no_mem symbol as listed by nm is flagged as "D" (writable data) and "T" (text, aka code) respectively. Looking at the final generated executable PL_no_mem does end up in the .rodata (read only data) section, so it might be worth adding a separate test for that. Fixes #20518
For LTO builds with gcc and clang the PL_no_mem symbol as listed by nm is flagged as "D" (writable data) and "T" (text, aka code) respectively. Looking at the final generated executable PL_no_mem does end up in the .rodata (read only data) section, so it might be worth adding a separate test for that. Fixes Perl#20518
For LTO builds with gcc and clang the PL_no_mem symbol as listed by nm is flagged as "D" (writable data) and "T" (text, aka code) respectively. Looking at the final generated executable PL_no_mem does end up in the .rodata (read only data) section, so it might be worth adding a separate test for that. Fixes Perl#20518
This is a bug report for perl from [email protected],
generated with the help of perlbug 1.43 running under perl 5.37.6.
Description
As reported by Matthias Klose in https://bugs.debian.org/985884
t/porting/libperl.t fails when perl is built with link time optimization
(LTO).
Steps to Reproduce
On current Debian unstable, with gcc (Debian 12.2.0-9) 12.2.0
and perl v5.37.5-162-g52917b368f
Ubuntu is currently disabling the failing tests FWIW.
Flags
Perl configuration
The text was updated successfully, but these errors were encountered: