develooper Front page | perl.perl5.porters | Postings from July 2019

Re: [perl #134241] Perl 5.30.0 fails with LTO optimisation

Thread Previous | Thread Next
From:
=?UTF-8?Q?Tomasz_K=C5=82oczko?=
Date:
July 4, 2019 02:21
Subject:
Re: [perl #134241] Perl 5.30.0 fails with LTO optimisation
Message ID:
CABB28CyNLDw--YmzLkTVX8OfQYPS+eSqRch=jc4bEcPRAmMawg@mail.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

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About