develooper Front page | perl.perl5.porters | Postings from May 2015

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

Thread Previous | Thread Next
From:
Tony Cook via RT
Date:
May 7, 2015 00:49
Subject:
[perl #125096] perl 5.20.2 fails to compile with gcc 5.1.0 -flto -O2
Message ID:
rt-4.0.18-1935-1430959767-1990.125096-15-0@perl.org
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

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

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