Skip to content
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

Perl 5.30.0 fails with LTO optimisation #17068

Open
p5pRT opened this issue Jun 30, 2019 · 8 comments
Open

Perl 5.30.0 fails with LTO optimisation #17068

p5pRT opened this issue Jun 30, 2019 · 8 comments

Comments

@p5pRT
Copy link

p5pRT commented Jun 30, 2019

Migrated from rt.perl.org#134241 (status was 'open')

Searchable as RT134241$

@p5pRT
Copy link
Author

p5pRT commented Jun 30, 2019

From kloczko.tomasz@gmail.com

Created by kloczko.tomasz@gmail.com

When Perl 5.30.0 is build with LTO optimisation linking of the
miniperl fails with​:

rm -rf mpdtrace
mkdir mpdtrace
cp opmini.o perlmini.o gv.o toke.o perly.o pad.o regcomp.o dump.o
util.o mg.o reentr.o mro_core.o keywords.o hv.o av.o run.o pp_hot.o
sv.o pp.o scope.o pp_ctl.o pp_sys.
CFLAGS="`sh cflags "optimize='-g'" dtrace_mini.o`" /usr/bin/dtrace
-G -s perldtrace.d -o dtrace_mini.o mpdtrace/opmini.o
mpdtrace/perlmini.o mpdtrace/gv.o mpdtrace
gcc -Wl,-z,relro -Wl,--as-needed -Wl,-z,now
-specs=/usr/lib/rpm/redhat/redhat-hardened-ld -flto
-fuse-linker-plugin -fstack-protector-strong -L/usr/local/lib -o
miniperl mpdtrace/opmini.o mpdtrace/perlmini.o mpdtrace/gv.o
mpdtrace/toke.o mpdtrace/perly.o mpdtrace/pad.o mpdtrace/regcomp.o
mpdtrace/dump.o mpdtrace/util.o mpdtrace/mg.o
perl.h​:7278​:19​: warning​: type of 'PL_nan' does not match original
declaration [-Wlto-type-mismatch]
7278 | INFNAN_NV_U8_DECL PL_nan;
  | ^
perl.h​:7248​:19​: note​: 'PL_nan' was previously declared here
7248 | INFNAN_U8_NV_DECL PL_nan = { { DOUBLENANBYTES } };
  | ^
perl.h​:7277​:19​: warning​: type of 'PL_inf' does not match original
declaration [-Wlto-type-mismatch]
7277 | INFNAN_NV_U8_DECL PL_inf;
  | ^
perl.h​:7212​:19​: note​: 'PL_inf' was previously declared here
7212 | INFNAN_U8_NV_DECL PL_inf = { { DOUBLEINFBYTES } };
  | ^
/usr/bin/ld​: /tmp/miniperl.bCBaN7.ltrans19.ltrans.o​:(.note.stapsdt+0x24)​:
undefined reference to `perl_phase__change_semaphore'
/usr/bin/ld​: /tmp/miniperl.bCBaN7.ltrans19.ltrans.o​:(.note.stapsdt+0x120)​:
undefined reference to `perl_sub__return_semaphore'
/usr/bin/ld​: /tmp/miniperl.bCBaN7.ltrans2.ltrans.o​:(.note.stapsdt+0x24)​:
undefined reference to `perl_loading__file_semaphore'
/usr/bin/ld​: /tmp/miniperl.bCBaN7.ltrans2.ltrans.o​:(.note.stapsdt+0x6c)​:
undefined reference to `perl_loaded__file_semaphore'
collect2​: error​: ld returned 1 exit status
make​: *** [makefile​:398​: lib/buildcustomize.pl] Error 1
error​: Bad exit status from /var/tmp/rpm-tmp.Mv5rO5 (%build)

Perl Info

Flags:
    category=core
    severity=high

Site configuration information for perl 5.30.0:

Configured by Red Hat, Inc. at Tue Jun 25 15:54:28 UTC 2019.

Summary of my perl5 (revision 5 version 30 subversion 0) configuration:

  Platform:
    osname=linux
    osvers=5.1.11-200.fc29.x86_64
    archname=x86_64-linux-thread-multi
    uname='linux buildhw-09.phx2.fedoraproject.org
5.1.11-200.fc29.x86_64 #1 smp mon jun 17 19:30:44 utc 2019 x86_64
x86_64 x86_64 gnulinux '
    config_args='-des -Doptimize=none -Dccflags=-O2 -g -pipe -Wall
-Werror=format-security -Wp,-D_FORTIFY_SOURCE=2
-Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong
-grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1
-specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic
-fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection
-Dldflags=-Wl,-z,relro -Wl,--as-needed -Wl,-z,now
-specs=/usr/lib/rpm/redhat/redhat-hardened-ld
-Dccdlflags=-Wl,--enable-new-dtags -Wl,-z,relro -Wl,--as-needed
-Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld
-Dlddlflags=-shared -Wl,-z,relro -Wl,--as-needed  -Wl,-z,now
-specs=/usr/lib/rpm/redhat/redhat-hardened-ld -Dshrpdir=/usr/lib64
-DDEBUGGING=-g -Dversion=5.30.0 -Dmyhostname=localhost
-Dperladmin=root@localhost -Dcc=gcc -Dcf_by=Red Hat, Inc.
-Dprefix=/usr -Dvendorprefix=/usr
-Dsiteprefix=/usr/local -Dsitelib=/usr/local/share/perl5/5.30
-Dsitearch=/usr/local/lib64/perl5/5.30 -Dprivlib=/usr/share/perl5
-Dvendorlib=/usr/share/perl5/vendor_perl -Darchlib=/usr/lib64/perl5
-Dvendorarch=/usr/lib64/perl5/vendor_perl
-Darchname=x86_64-linux-thread-multi -Dlibpth=/usr/local/lib64 /lib64
/usr/lib64 -Duseshrplib -Dusethreads -Duseithreads
-Dusedtrace=/usr/bin/dtrace -Duselargefiles -Dd_semctl_semun -Di_db
-Ui_ndbm -Di_gdbm -Di_shadow -Di_syslog -Dman3ext=3pm -Duseperlio
-Dinstallusrbinperl=n -Ubincompat5005 -Uversiononly
-Dpager=/usr/bin/less -isr -Dd_gethostent_r_proto
-Ud_endhostent_r_proto -Ud_sethostent_r_proto -Ud_endprotoent_r_proto
-Ud_setprotoent_r_proto -Ud_endservent_r_proto -Ud_setservent_r_proto
-Dscriptdir=/usr/bin -Dusesitecustomize -Duse64bitint'
    hint=recommended
    useposix=true
    d_sigaction=define
    useithreads=define
    usemultiplicity=define
    use64bitint=define
    use64bitall=define
    uselongdouble=undef
    usemymalloc=n
    default_inc_excludes_dot=define
    bincompat5005=undef
  Compiler:
    cc='gcc'
    ccflags ='-D_REENTRANT -D_GNU_SOURCE -O2 -g -pipe -Wall
-Werror=format-security -Wp,-D_FORTIFY_SOURCE=2
-Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong
-grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1
-specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic
-fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection
-fwrapv -fno-strict-aliasing -I/usr/local/include -D_LARGEFILE_SOURCE
-D_FILE_OFFSET_BITS=64'
    optimize=' -g'
    cppflags='-D_REENTRANT -D_GNU_SOURCE -O2 -g -pipe -Wall
-Werror=format-security -Wp,-D_FORTIFY_SOURCE=2
-Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong
-grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1
-specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic
-fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection
-fwrapv -fno-strict-aliasing -I/usr/local/include'
    ccversion=''
    gccversion='9.1.1 20190605 (Red Hat 9.1.1-2)'
    gccosandvers=''
    intsize=4
    longsize=8
    ptrsize=8
    doublesize=8
    byteorder=12345678
    doublekind=3
    d_longlong=define
    longlongsize=8
    d_longdbl=define
    longdblsize=16
    longdblkind=3
    ivtype='long'
    ivsize=8
    nvtype='double'
    nvsize=8
    Off_t='off_t'
    lseeksize=8
    alignbytes=8
    prototype=define
  Linker and Libraries:
    ld='gcc'
    ldflags ='-Wl,-z,relro -Wl,--as-needed -Wl,-z,now
-specs=/usr/lib/rpm/redhat/redhat-hardened-ld -fstack-protector-strong
-L/usr/local/lib'
    libpth=/usr/local/lib64 /lib64 /usr/lib64 /usr/local/lib /usr/lib
/lib/../lib64 /usr/lib/../lib64 /lib
    libs=-lpthread -lresolv -lgdbm -ldb -ldl -lm -lcrypt -lutil -lc
-lgdbm_compat
    perllibs=-lpthread -lresolv -ldl -lm -lcrypt -lutil -lc
    libc=libc-2.29.9000.so
    so=so
    useshrplib=true
    libperl=libperl.so
    gnulibc_version='2.29.9000'
  Dynamic Linking:
    dlsrc=dl_dlopen.xs
    dlext=so
    d_dlsymun=undef
    ccdlflags='-Wl,--enable-new-dtags -Wl,-z,relro -Wl,--as-needed
-Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld'
    cccdlflags='-fPIC'
    lddlflags='-lpthread -shared -Wl,-z,relro -Wl,--as-needed
-Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld
-L/usr/local/lib -fstack-protector-strong'

Locally applied patches:
    Fedora Patch1: Removes date check, Fedora/RHEL specific
    Fedora Patch2: support for libdir64
    Fedora Patch3: use libresolv instead of libbind
    Fedora Patch4: USE_MM_LD_RUN_PATH
    Fedora Patch5: Provide MM::maybe_command independently (bug #1129443)
    Fedora Patch6: Dont run one io test due to random builder failures
    Fedora Patch8: Define SONAME for libperl.so
    Fedora Patch9: Install libperl.so to -Dshrpdir value
    Fedora Patch10: Make *DBM_File desctructors thread-safe (RT#61912)
    Fedora Patch11: Replace EU::MakeMaker dependency with
EU::MM::Utils in IPC::Cmd (bug #1129443)
    Fedora Patch12: Link XS modules to pthread library to fix linking
with -z defs
    Fedora Patch13: Pass the correct CFLAGS to dtrace
    Fedora Patch14: Fix an out-of-buffer read while parsing a Unicode
property name (RT#134134)
    Fedora Patch15: Do not panic when outputting a warning (RT#134059)
    Fedora Patch16: Fix memory handling when parsing string literals
    Fedora Patch17: Fix an undefined behavior in shifting IV variables
    Fedora Patch18: Fix an undefined behavior in shifting IV variables
    Fedora Patch19: Fix an undefined behavior in shifting IV variables
    Fedora Patch20: Fix stacking file test operators (CPAN RT#127073)
    Fedora Patch21: Fix a crash in SIGALARM handler when waiting on a
child process to be closed (RT#122112)
    Fedora Patch22: Fix a crash in SIGALARM handler when waiting on a
child process to be closed (RT#122112)
    Fedora Patch23: Fix a crash in SIGALARM handler when waiting on a
child process to be closed (RT#122112)
    Fedora Patch24: Fix a crash with a negative precision in sprintf
function (RT#134008)
    Fedora Patch25: Fix a crash with a negative precision in sprintf
function (RT#134008)
    Fedora Patch26: Fix an erroneous assertion on OP_SCALAR (RT#134048)
    Fedora Patch27: Prevent from wrapping a width in a numeric format
string (RT#133913)
    Fedora Patch28: Fix subroutine protypes to track reference aliases
(RT#134072)
    Fedora Patch29: Improve retrieving a scalar value of a variable
modified in a signal handler (RT#134035)
    Fedora Patch30: Fix changing packet destination sent from a UDP
IO::Socket object (RT#133936)
    Fedora Patch31: Fix changing packet destination sent from a UDP
IO::Socket object (RT#133936)
    Fedora Patch32: Fix changing packet destination sent from a UDP
IO::Socket object (RT#133936)
    Fedora Patch33: Fix a stack underflow in readline() if passed an
empty array as an argument (#RT133989)
    Fedora Patch34: Fix setting supplementar group IDs (RT#134169)
    Fedora Patch35: Fix setting supplementar group IDs (RT#134169)
    Fedora Patch36: Fix setting supplementar group IDs (RT#134169)
    Fedora Patch37: Fix %{^CAPTURE_ALL} to be an alias for %- variable
(RT#131867)
    Fedora Patch38: Fix %{^CAPTURE} value when used after @{^CAPTURE}
(RT#134193)
    Fedora Patch39: Fix %{^CAPTURE} value when used after @{^CAPTURE}
(RT#134193)
    Fedora Patch200: Link XS modules to libperl.so with EU::CBuilder on Linux
    Fedora Patch201: Link XS modules to libperl.so with EU::MM on Linux


@INC for perl 5.30.0:
    /usr/local/lib64/perl5/5.30
    /usr/local/share/perl5/5.30
    /usr/lib64/perl5/vendor_perl
    /usr/share/perl5/vendor_perl
    /usr/lib64/perl5
    /usr/share/perl5


Environment for perl 5.30.0:
    HOME=/home/tkloczko
    LANG=en_GB.UTF-8
    LANGUAGE (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=/home/tkloczko/.local/bin:/home/tkloczko/bin:/usr/share/Modules/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin
    PERL_BADLANG (unset)
    SHELL=/bin/bash

@p5pRT
Copy link
Author

p5pRT commented Jun 30, 2019

From @jkeenan

On Sun, 30 Jun 2019 23​:00​:02 GMT, kloczko.tomasz@​gmail.com wrote​:

This is a bug report for perl from kloczko.tomasz@​gmail.com,
generated with the help of perlbug 1.41 running under perl 5.30.0.

-----------------------------------------------------------------
[Please describe your issue here]
When Perl 5.30.0 is build with LTO optimisation linking of the
miniperl fails with​:

rm -rf mpdtrace
mkdir mpdtrace
cp opmini.o perlmini.o gv.o toke.o perly.o pad.o regcomp.o dump.o
util.o mg.o reentr.o mro_core.o keywords.o hv.o av.o run.o pp_hot.o
sv.o pp.o scope.o pp_ctl.o pp_sys.
CFLAGS="`sh cflags "optimize='-g'" dtrace_mini.o`" /usr/bin/dtrace
-G -s perldtrace.d -o dtrace_mini.o mpdtrace/opmini.o
mpdtrace/perlmini.o mpdtrace/gv.o mpdtrace
gcc -Wl,-z,relro -Wl,--as-needed -Wl,-z,now
-specs=/usr/lib/rpm/redhat/redhat-hardened-ld -flto
-fuse-linker-plugin -fstack-protector-strong -L/usr/local/lib -o
miniperl mpdtrace/opmini.o mpdtrace/perlmini.o mpdtrace/gv.o
mpdtrace/toke.o mpdtrace/perly.o mpdtrace/pad.o mpdtrace/regcomp.o
mpdtrace/dump.o mpdtrace/util.o mpdtrace/mg.o
perl.h​:7278​:19​: warning​: type of 'PL_nan' does not match original
declaration [-Wlto-type-mismatch]
7278 | INFNAN_NV_U8_DECL PL_nan;
| ^
perl.h​:7248​:19​: note​: 'PL_nan' was previously declared here
7248 | INFNAN_U8_NV_DECL PL_nan = { { DOUBLENANBYTES } };
| ^
perl.h​:7277​:19​: warning​: type of 'PL_inf' does not match original
declaration [-Wlto-type-mismatch]
7277 | INFNAN_NV_U8_DECL PL_inf;
| ^
perl.h​:7212​:19​: note​: 'PL_inf' was previously declared here
7212 | INFNAN_U8_NV_DECL PL_inf = { { DOUBLEINFBYTES } };
| ^
/usr/bin/ld​:
/tmp/miniperl.bCBaN7.ltrans19.ltrans.o​:(.note.stapsdt+0x24)​:
undefined reference to `perl_phase__change_semaphore'
/usr/bin/ld​:
/tmp/miniperl.bCBaN7.ltrans19.ltrans.o​:(.note.stapsdt+0x120)​:
undefined reference to `perl_sub__return_semaphore'
/usr/bin/ld​:
/tmp/miniperl.bCBaN7.ltrans2.ltrans.o​:(.note.stapsdt+0x24)​:
undefined reference to `perl_loading__file_semaphore'
/usr/bin/ld​:
/tmp/miniperl.bCBaN7.ltrans2.ltrans.o​:(.note.stapsdt+0x6c)​:
undefined reference to `perl_loaded__file_semaphore'
collect2​: error​: ld returned 1 exit status
make​: *** [makefile​:398​: lib/buildcustomize.pl] Error 1
error​: Bad exit status from /var/tmp/rpm-tmp.Mv5rO5 (%build)

Can you supply the full ./Configure command you used in this attempt to build perl?

What is meant by LTO optimization?

--
James E Keenan (jkeenan@​cpan.org)

@p5pRT
Copy link
Author

p5pRT commented Jun 30, 2019

The RT System itself - Status changed from 'new' to 'open'

@p5pRT
Copy link
Author

p5pRT commented Jul 2, 2019

From @tonycoz

On Sun, 30 Jun 2019 16​:00​:02 -0700, kloczko.tomasz@​gmail.com wrote​:

When Perl 5.30.0 is build with LTO optimisation linking of the
miniperl fails with​:

rm -rf mpdtrace
mkdir mpdtrace
cp opmini.o perlmini.o gv.o toke.o perly.o pad.o regcomp.o dump.o
util.o mg.o reentr.o mro_core.o keywords.o hv.o av.o run.o pp_hot.o
sv.o pp.o scope.o pp_ctl.o pp_sys.
CFLAGS="`sh cflags "optimize='-g'" dtrace_mini.o`" /usr/bin/dtrace
-G -s perldtrace.d -o dtrace_mini.o mpdtrace/opmini.o
mpdtrace/perlmini.o mpdtrace/gv.o mpdtrace
gcc -Wl,-z,relro -Wl,--as-needed -Wl,-z,now
-specs=/usr/lib/rpm/redhat/redhat-hardened-ld -flto
-fuse-linker-plugin -fstack-protector-strong -L/usr/local/lib -o
miniperl mpdtrace/opmini.o mpdtrace/perlmini.o mpdtrace/gv.o
mpdtrace/toke.o mpdtrace/perly.o mpdtrace/pad.o mpdtrace/regcomp.o
mpdtrace/dump.o mpdtrace/util.o mpdtrace/mg.o
perl.h​:7278​:19​: warning​: type of 'PL_nan' does not match original
declaration [-Wlto-type-mismatch]
7278 | INFNAN_NV_U8_DECL PL_nan;
| ^
perl.h​:7248​:19​: note​: 'PL_nan' was previously declared here
7248 | INFNAN_U8_NV_DECL PL_nan = { { DOUBLENANBYTES } };
| ^
perl.h​:7277​:19​: warning​: type of 'PL_inf' does not match original
declaration [-Wlto-type-mismatch]
7277 | INFNAN_NV_U8_DECL PL_inf;
| ^
perl.h​:7212​:19​: note​: 'PL_inf' was previously declared here
7212 | INFNAN_U8_NV_DECL PL_inf = { { DOUBLEINFBYTES } };
| ^
/usr/bin/ld​:
/tmp/miniperl.bCBaN7.ltrans19.ltrans.o​:(.note.stapsdt+0x24)​:
undefined reference to `perl_phase__change_semaphore'
/usr/bin/ld​:
/tmp/miniperl.bCBaN7.ltrans19.ltrans.o​:(.note.stapsdt+0x120)​:
undefined reference to `perl_sub__return_semaphore'
/usr/bin/ld​:
/tmp/miniperl.bCBaN7.ltrans2.ltrans.o​:(.note.stapsdt+0x24)​:
undefined reference to `perl_loading__file_semaphore'
/usr/bin/ld​:
/tmp/miniperl.bCBaN7.ltrans2.ltrans.o​:(.note.stapsdt+0x6c)​:
undefined reference to `perl_loaded__file_semaphore'
collect2​: error​: ld returned 1 exit status
make​: *** [makefile​:398​: lib/buildcustomize.pl] Error 1
error​: Bad exit status from /var/tmp/rpm-tmp.Mv5rO5 (%build)

Please provide the options you supplied to Configure.

I tried a simple

./Configure -des -Dusedevel -Dusedtrace -Doptimize='-O2 -g -flto' -Dusethreads && make miniperl
 
which successfully built miniperl (which is where your build failed.)

I did get the type mismatch warnings, which I'll look into.

Tony

@p5pRT
Copy link
Author

p5pRT commented Jul 2, 2019

From @craigberry

On Sun, Jun 30, 2019 at 6​:57 PM James E Keenan via RT
<perlbug-followup@​perl.org> wrote​:

What is meant by LTO optimization?

https://www.llvm.org/docs/LinkTimeOptimization.html

@p5pRT
Copy link
Author

p5pRT commented Jul 3, 2019

From @tonycoz

On Mon, 01 Jul 2019 23​:17​:21 -0700, tonyc wrote​:

On Sun, 30 Jun 2019 16​:00​:02 -0700, kloczko.tomasz@​gmail.com wrote​:

When Perl 5.30.0 is build with LTO optimisation linking of the
miniperl fails with​:

rm -rf mpdtrace
mkdir mpdtrace
cp opmini.o perlmini.o gv.o toke.o perly.o pad.o regcomp.o dump.o
util.o mg.o reentr.o mro_core.o keywords.o hv.o av.o run.o pp_hot.o
sv.o pp.o scope.o pp_ctl.o pp_sys.
CFLAGS="`sh cflags "optimize='-g'" dtrace_mini.o`" /usr/bin/dtrace
-G -s perldtrace.d -o dtrace_mini.o mpdtrace/opmini.o
mpdtrace/perlmini.o mpdtrace/gv.o mpdtrace
gcc -Wl,-z,relro -Wl,--as-needed -Wl,-z,now
-specs=/usr/lib/rpm/redhat/redhat-hardened-ld -flto
-fuse-linker-plugin -fstack-protector-strong -L/usr/local/lib -o
miniperl mpdtrace/opmini.o mpdtrace/perlmini.o mpdtrace/gv.o
mpdtrace/toke.o mpdtrace/perly.o mpdtrace/pad.o mpdtrace/regcomp.o
mpdtrace/dump.o mpdtrace/util.o mpdtrace/mg.o
perl.h​:7278​:19​: warning​: type of 'PL_nan' does not match original
declaration [-Wlto-type-mismatch]
7278 | INFNAN_NV_U8_DECL PL_nan;
| ^
perl.h​:7248​:19​: note​: 'PL_nan' was previously declared here
7248 | INFNAN_U8_NV_DECL PL_nan = { { DOUBLENANBYTES } };
| ^
perl.h​:7277​:19​: warning​: type of 'PL_inf' does not match original
declaration [-Wlto-type-mismatch]
7277 | INFNAN_NV_U8_DECL PL_inf;
| ^
perl.h​:7212​:19​: note​: 'PL_inf' was previously declared here
7212 | INFNAN_U8_NV_DECL PL_inf = { { DOUBLEINFBYTES } };
| ^
/usr/bin/ld​:
/tmp/miniperl.bCBaN7.ltrans19.ltrans.o​:(.note.stapsdt+0x24)​:
undefined reference to `perl_phase__change_semaphore'
/usr/bin/ld​:
/tmp/miniperl.bCBaN7.ltrans19.ltrans.o​:(.note.stapsdt+0x120)​:
undefined reference to `perl_sub__return_semaphore'
/usr/bin/ld​:
/tmp/miniperl.bCBaN7.ltrans2.ltrans.o​:(.note.stapsdt+0x24)​:
undefined reference to `perl_loading__file_semaphore'
/usr/bin/ld​:
/tmp/miniperl.bCBaN7.ltrans2.ltrans.o​:(.note.stapsdt+0x6c)​:
undefined reference to `perl_loaded__file_semaphore'
collect2​: error​: ld returned 1 exit status
make​: *** [makefile​:398​: lib/buildcustomize.pl] Error 1
error​: Bad exit status from /var/tmp/rpm-tmp.Mv5rO5 (%build)

Please provide the options you supplied to Configure.

I managed to reproduce some missing symbols (but not these) with​:

./Configure -des -Dusedevel -Dusedtrace -Doptimize='-O1 -g -flto' -Dusethreads -Dusequadmath && make test-prep

Adding​:

-Dar=gcc-ar

fixed them, but there are some test failures, of which there seem to be five basic causes​:

1) goto fails in some way, or crashes (op/eval.t, op/goto.t, lib/croak.t)

2) libperl.t fails because it insists on using /usr/bin/nm rather than $Config{nm} if you set -Dnm=gcc-nm, if you fix that...

3) libperl.t doesn't handle some constants being moved to the text segment

4) PL_ppaddr despite not being constant is moved to the text segment, which libperl.t correctly complains about

5) cpan/ExtUtils-MakeMaker/t/03-xsstatic.t fails its staticmulti test

@p5pRT
Copy link
Author

p5pRT commented Jul 4, 2019

From kloczko.tomasz@gmail.com

On Mon, 1 Jul 2019 at 00​:56, James E Keenan via RT
<perlbug-followup@​perl.org> wrote​:

On Sun, 30 Jun 2019 23​:00​:02 GMT, kloczko.tomasz@​gmail.com wrote​:

This is a bug report for perl from kloczko.tomasz@​gmail.com,
generated with the help of perlbug 1.41 running under perl 5.30.0.

-----------------------------------------------------------------
[Please describe your issue here]
When Perl 5.30.0 is build with LTO optimisation linking of the
miniperl fails with​:

rm -rf mpdtrace
mkdir mpdtrace
cp opmini.o perlmini.o gv.o toke.o perly.o pad.o regcomp.o dump.o
util.o mg.o reentr.o mro_core.o keywords.o hv.o av.o run.o pp_hot.o
sv.o pp.o scope.o pp_ctl.o pp_sys.
CFLAGS="`sh cflags "optimize='-g'" dtrace_mini.o`" /usr/bin/dtrace
-G -s perldtrace.d -o dtrace_mini.o mpdtrace/opmini.o
mpdtrace/perlmini.o mpdtrace/gv.o mpdtrace
gcc -Wl,-z,relro -Wl,--as-needed -Wl,-z,now
-specs=/usr/lib/rpm/redhat/redhat-hardened-ld -flto
-fuse-linker-plugin -fstack-protector-strong -L/usr/local/lib -o
miniperl mpdtrace/opmini.o mpdtrace/perlmini.o mpdtrace/gv.o
mpdtrace/toke.o mpdtrace/perly.o mpdtrace/pad.o mpdtrace/regcomp.o
mpdtrace/dump.o mpdtrace/util.o mpdtrace/mg.o
perl.h​:7278​:19​: warning​: type of 'PL_nan' does not match original
declaration [-Wlto-type-mismatch]
7278 | INFNAN_NV_U8_DECL PL_nan;
| ^
perl.h​:7248​:19​: note​: 'PL_nan' was previously declared here
7248 | INFNAN_U8_NV_DECL PL_nan = { { DOUBLENANBYTES } };
| ^
perl.h​:7277​:19​: warning​: type of 'PL_inf' does not match original
declaration [-Wlto-type-mismatch]
7277 | INFNAN_NV_U8_DECL PL_inf;
| ^
perl.h​:7212​:19​: note​: 'PL_inf' was previously declared here
7212 | INFNAN_U8_NV_DECL PL_inf = { { DOUBLEINFBYTES } };
| ^
/usr/bin/ld​:
/tmp/miniperl.bCBaN7.ltrans19.ltrans.o​:(.note.stapsdt+0x24)​:
undefined reference to `perl_phase__change_semaphore'
/usr/bin/ld​:
/tmp/miniperl.bCBaN7.ltrans19.ltrans.o​:(.note.stapsdt+0x120)​:
undefined reference to `perl_sub__return_semaphore'
/usr/bin/ld​:
/tmp/miniperl.bCBaN7.ltrans2.ltrans.o​:(.note.stapsdt+0x24)​:
undefined reference to `perl_loading__file_semaphore'
/usr/bin/ld​:
/tmp/miniperl.bCBaN7.ltrans2.ltrans.o​:(.note.stapsdt+0x6c)​:
undefined reference to `perl_loaded__file_semaphore'
collect2​: error​: ld returned 1 exit status
make​: *** [makefile​:398​: lib/buildcustomize.pl] Error 1
error​: Bad exit status from /var/tmp/rpm-tmp.Mv5rO5 (%build)

Can you supply the full ./Configure command you used in this attempt to build perl?

What is meant by LTO optimization?

Here is begin of my rpm package build log​:

Executing(%build)​: /bin/sh -e /var/tmp/rpm-tmp.zhL6ji
+ umask 022
+ cd /home/tkloczko/rpmbuild/BUILD
+ cd perl-5.30.0
+ export 'CFLAGS=-O2 -g -pipe -Wall -Werror=format-security
-Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS
-fstack-protector-strong -grecord-gcc-switches
-specs=/usr/lib/rpm/redhat/redhat-hardened-cc1
-specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic
-fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection
-flto'
+ CFLAGS='-O2 -g -pipe -Wall -Werror=format-security
-Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS
-fstack-protector-strong -grecord-gcc-switches
-specs=/usr/lib/rpm/redhat/redhat-hardened-cc1
-specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic
-fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection
-flto'
+ export 'CXXFLAGS=-O2 -g -pipe -Wall -Werror=format-security
-Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS
-fstack-protector-strong -grecord-gcc-switches
-specs=/usr/lib/rpm/redhat/redhat-hardened-cc1
-specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic
-fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection
-flto'
+ CXXFLAGS='-O2 -g -pipe -Wall -Werror=format-security
-Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS
-fstack-protector-strong -grecord-gcc-switches
-specs=/usr/lib/rpm/redhat/redhat-hardened-cc1
-specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic
-fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection
-flto'
+ export 'FFLAGS=-O2 -g -pipe -Wall -Werror=format-security
-Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS
-fstack-protector-strong -grecord-gcc-switches
-specs=/usr/lib/rpm/redhat/redhat-hardened-cc1
-specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic
-fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection
-I/usr/lib64/gfortran/modules -flto'
+ FFLAGS='-O2 -g -pipe -Wall -Werror=format-security
-Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS
-fstack-protector-strong -grecord-gcc-switches
-specs=/usr/lib/rpm/redhat/redhat-hardened-cc1
-specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic
-fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection
-I/usr/lib64/gfortran/modules -flto'
+ export 'FCFLAGS=-O2 -g -pipe -Wall -Werror=format-security
-Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS
-fstack-protector-strong -grecord-gcc-switches
-specs=/usr/lib/rpm/redhat/redhat-hardened-cc1
-specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic
-fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection
-I/usr/lib64/gfortran/modules -flto'
+ FCFLAGS='-O2 -g -pipe -Wall -Werror=format-security
-Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS
-fstack-protector-strong -grecord-gcc-switches
-specs=/usr/lib/rpm/redhat/redhat-hardened-cc1
-specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic
-fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection
-I/usr/lib64/gfortran/modules -flto'
+ export 'LDFLAGS=-Wl,-z,relro -Wl,--as-needed -Wl,-z,now
-specs=/usr/lib/rpm/redhat/redhat-hardened-ld -flto
-fuse-linker-plugin'
+ LDFLAGS='-Wl,-z,relro -Wl,--as-needed -Wl,-z,now
-specs=/usr/lib/rpm/redhat/redhat-hardened-ld -flto
-fuse-linker-plugin'
+ export AR=gcc-ar RANLIB=gcc-ranlib NM=gcc-nm
+ AR=gcc-ar
+ RANLIB=gcc-ranlib
+ NM=gcc-nm
+ export CC=gcc CXX=g++
+ CC=gcc
+ CXX=g++
+ /bin/sh Configure -des -Darchlib=/usr/lib64/perl5
-Darchname=x86_64-linux-thread-multi -Dcc=gcc
'-Dccdlflags=-Wl,--enable-new-dtags -Wl,-z,relro -Wl,--as-needed
-Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -flto
-fuse-linker-plugin' '-Dccflags=-O2 -g -pipe -Wall
-Werror=format-security -Wp,-D_FORTIFY_SOURCE=2
-Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong
-grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1
-specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic
-fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection
-flto' '-Dcf_by=Red Hat, Inc.' -DDEBUGGING=-g -Dd_gethostent_r_proto
-Dd_semctl_semun -Dfull_ar=gcc-ar -Dfull_ranlib=gcc-ranlib -Dar=gcc-ar
-Dranlib=gcc-ranlib -Di_db -Dinstallusrbinperl=n -Di_shadow -Di_syslog
'-Dlddlflags=-shared -Wl,-z,relro -Wl,--as-needed -Wl,-z,now
-specs=/usr/lib/rpm/redhat/redhat-hardened-ld -flto
-fuse-linker-plugin' '-Dldflags=-Wl,-z,relro -Wl,--as-needed
-Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -flto
-fuse-linker-plugin' -Dlibpth=/usr/lib64 -Dlibspath= -Dlocincpth=
-Dloclibpth= -Dman1dir=/usr/share/man/man1
-Dman3dir=/usr/share/man/man3 -Dman3ext=3pm -Dmyhostname=localhost
-Doptimize=none '-Dpager=/usr/bin/less -isr'
-Dperladmin=root@​localhost -Dprefix=/usr -Dprivlib=/usr/share/perl5
-Dscriptdir=/usr/bin -Dshrpdir=/usr/lib64
-Dsitearch=/usr/local/lib64/perl5/5.30
-Dsitelib=/usr/local/share/perl5/5.30 -Dsiteprefix=/usr/local
-Duse64bitint -Duseithreads -Duselargefiles -Duseperlio -Duseshrplib
-Dusesitecustomize -Dusethreads
-Dvendorarch=/usr/lib64/perl5/vendor_perl
-Dvendorlib=/usr/share/perl5/vendor_perl -Dvendorprefix=/usr
-Dversion=1.33 -Ubincompat5005 -Ud_endhostent_r_proto
-Ud_endprotoent_r_proto -Ud_endservent_r_proto -Ud_sethostent_r_proto
-Ud_setprotoent_r_proto -Ud_setservent_r_proto -Uversiononly
-Uusedtrace

Above is working.
Actually after few more tries I found that LTO optimisation is *not
working* and is failing as I've originaly reported when
systemtap/dtrace support is enabled.
So to reproduce what I found you need to
s,-Uusedtrace,-Dusedtrace='/usr/bin/dtrace', in above.

Tomasz
--
Tomasz KÅ�oczko | LinkedIn​: http​://lnkd.in/FXPWxH

@p5pRT
Copy link
Author

p5pRT commented Jul 4, 2019

From kloczko.tomasz@gmail.com

On Tue, 2 Jul 2019 at 07​:17, Tony Cook via RT <perlbug-followup@​perl.org> wrote​:

On Sun, 30 Jun 2019 16​:00​:02 -0700, kloczko.tomasz@​gmail.com wrote​:

When Perl 5.30.0 is build with LTO optimisation linking of the
miniperl fails with​:

rm -rf mpdtrace
mkdir mpdtrace
cp opmini.o perlmini.o gv.o toke.o perly.o pad.o regcomp.o dump.o
util.o mg.o reentr.o mro_core.o keywords.o hv.o av.o run.o pp_hot.o
sv.o pp.o scope.o pp_ctl.o pp_sys.
CFLAGS="`sh cflags "optimize='-g'" dtrace_mini.o`" /usr/bin/dtrace
-G -s perldtrace.d -o dtrace_mini.o mpdtrace/opmini.o
mpdtrace/perlmini.o mpdtrace/gv.o mpdtrace
gcc -Wl,-z,relro -Wl,--as-needed -Wl,-z,now
-specs=/usr/lib/rpm/redhat/redhat-hardened-ld -flto
-fuse-linker-plugin -fstack-protector-strong -L/usr/local/lib -o
miniperl mpdtrace/opmini.o mpdtrace/perlmini.o mpdtrace/gv.o
mpdtrace/toke.o mpdtrace/perly.o mpdtrace/pad.o mpdtrace/regcomp.o
mpdtrace/dump.o mpdtrace/util.o mpdtrace/mg.o
perl.h​:7278​:19​: warning​: type of 'PL_nan' does not match original
declaration [-Wlto-type-mismatch]
7278 | INFNAN_NV_U8_DECL PL_nan;
| ^
perl.h​:7248​:19​: note​: 'PL_nan' was previously declared here
7248 | INFNAN_U8_NV_DECL PL_nan = { { DOUBLENANBYTES } };
| ^
perl.h​:7277​:19​: warning​: type of 'PL_inf' does not match original
declaration [-Wlto-type-mismatch]
7277 | INFNAN_NV_U8_DECL PL_inf;
| ^
perl.h​:7212​:19​: note​: 'PL_inf' was previously declared here
7212 | INFNAN_U8_NV_DECL PL_inf = { { DOUBLEINFBYTES } };
| ^
/usr/bin/ld​:
/tmp/miniperl.bCBaN7.ltrans19.ltrans.o​:(.note.stapsdt+0x24)​:
undefined reference to `perl_phase__change_semaphore'
/usr/bin/ld​:
/tmp/miniperl.bCBaN7.ltrans19.ltrans.o​:(.note.stapsdt+0x120)​:
undefined reference to `perl_sub__return_semaphore'
/usr/bin/ld​:
/tmp/miniperl.bCBaN7.ltrans2.ltrans.o​:(.note.stapsdt+0x24)​:
undefined reference to `perl_loading__file_semaphore'
/usr/bin/ld​:
/tmp/miniperl.bCBaN7.ltrans2.ltrans.o​:(.note.stapsdt+0x6c)​:
undefined reference to `perl_loaded__file_semaphore'
collect2​: error​: ld returned 1 exit status
make​: *** [makefile​:398​: lib/buildcustomize.pl] Error 1
error​: Bad exit status from /var/tmp/rpm-tmp.Mv5rO5 (%build)

Please provide the options you supplied to Configure.

I tried a simple

./Configure -des -Dusedevel -Dusedtrace -Doptimize='-O2 -g -flto' -Dusethreads && make miniperl

which successfully built miniperl (which is where your build failed.)

I did get the type mismatch warnings, which I'll look into.

Did you combine that with -Wl,--as-needed?

--
Tomasz KÅ�oczko | LinkedIn​: http​://lnkd.in/FXPWxH

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

No branches or pull requests

2 participants