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

[perl #125096] perl 5.20.2 fails to compile with gcc 5.1.0 -flto -O2

From:
Tony Cook via RT
Date:
July 10, 2019 04:26
Subject:
[perl #125096] perl 5.20.2 fails to compile with gcc 5.1.0 -flto -O2
Message ID:
rt-4.0.24-28295-1562732766-1132.125096-15-0@perl.org
On Wed, 09 Dec 2015 15:53:32 -0800, jkeenan wrote:
> On Thu May 07 09:01:57 2015, steffen@hauihau.de wrote:
> >
> >
> > Am 07.05.2015 um 02:49 schrieb Tony Cook via RT:
> > > On Mon May 04 03:02:16 2015, steffen@hauihau.de wrote:
> > >> Compiling perl 5.20.2 with GCC 5.1.0 reintroduced the issue
> > >> reported
> > >> in bug #113022. I was told, that you should use "__attribute__
> > >> ((used))" to check for the availability of functions. This small
> > >> patch
> > >> fixes the issue:
> > >>
> > >> --- a/Configure.orig    2015-05-04 11:51:34.170517546 +0200
> > >> +++ b/Configure 2015-05-04 11:51:58.025516693 +0200
> > >> @@ -7954,13 +7954,13 @@
> > >>                  if $contains $tlook $tf >/dev/null 2>&1; then
> > >>                          tval=true;
> > >>                  elif $test "$mistrustnm" = compile -o
> > >> "$mistrustnm"
> > >> =
> > >> run; then
> > >> -                       echo "$extern_C void *$1$tdc; void
> > >> *(*(p()))$tdc { return &$1; } int main() { if(p() && p() != (void
> > >> *)main) return(0); else return(1); }"> try.c;
> > >> +                       echo "$extern_C void *$1$tdc;
> > >> __attribute__
> > >> ((used)) void *(*(p()))$tdc { return &$1; } int main() { if(p() &&
> > >> p()
> > >> != (void *)main) return(0); else return(1); }"> try.c;
> > >>                          $cc -o try $optimize $ccflags $ldflags
> > >> try.c
> > >>> /dev/null 2>&1 $libs && tval=true;
> > >> $test "$mistrustnm" = run -a -x try && { $run
> > >> ./try$_exe >/dev/null 2>&1 || tval=false; };
> > >> $rm_try;
> > >> fi;
> > >> else
> > >> -               echo "$extern_C void *$1$tdc; void *(*(p()))$tdc {
> > >> return &$1; } int main() { if(p() && p() != (void *)main)
> > >> return(0);
> > >> else return(1); }"> try.c;
> > >> +               echo "$extern_C void *$1$tdc; __attribute__
> > >> ((used))
> > >> void *(*(p()))$tdc { return &$1; } int main() { if(p() && p() !=
> > >> (void
> > >> *)main) return(0); else return(1); }"> try.c;
> > >> $cc -o try $optimize $ccflags $ldflags try.c $libs
> > >>> /dev/null 2>&1 && tval=true;
> > >> $rm_try;
> > >> fi;
> > >
> > > Not every compiler supports gcc's extensions, so we need to probe
> > > for
> > > __attribute__ ((used)) before we use it.
> > >
> > > The attached patch is against bleadperl, detected
> > > __attribute__((used)), and if
> > > found uses it in the csym code.
> > >
> > > If you want to test this againt 5.20 you should be able to copy
> > > Configure from blead and apply that patch to it, or copy Configure
> > > from:
> > >
> > > http://perl5.git.perl.org/perl.git/blob_plain/refs/heads/tonyc/attribute-
> > > used:/Configure
> > >
> > > I couldn't reproduce the problem you were having however - with
> > > your
> > > options with gcc 5.1.0 malloc_size wasn't being detected (Debian
> > > oldstable.)
> > >
> > > Tony
> > >
> >
> > Hi Tony,
> >
> > your patch does not cleanly apply (hunk #4 must be after #1). After
> > adjusting this, the functions are still found. You forgot to patch
> > the
> > else section, which gets executed when $runnm is false (which was the
> > case on my system). After I fixed this as well, your patch makes perl
> > compile successfully.
> 
> Tony:  Could we get an update on the status of this ticket?
> 
> Thank you very much.

I believe this was fixed in a different way by adec5bbf0b66ee5ebc2ba80eda2389bb68e23d86.

Tony


---
via perlbug:  queue: perl5 status: open
https://rt.perl.org/Ticket/Display.html?id=125096



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