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

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

Thread Next
From:
Steffen Hau
Date:
May 7, 2015 16:01
Subject:
Re: [perl #125096] perl 5.20.2 fails to compile with gcc 5.1.0 -flto-O2
Message ID:
554B410C.4050006@hauihau.de


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.

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