pkgsrc-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: lang/perl5 broken Makefile



On Fri, 3 May 2019 13:27:12 +0200
Martin Husemann <martin%duskware.de@localhost> wrote:

> On Fri, May 03, 2019 at 12:22:13PM +0100, Sad Clouds wrote:
> > But it's not accessing characters in the usual way, what it tries
> > to do is access them as 32-bit integers and then do byte-swapping
> > on those integers, which fails on SPARC due to alignment
> > restrictions. 
> 
> No, it is accessing 16 bit and 32 bit values, not character (i.e. 8
> bit) values. I bet perl has other macros for that case.
> 
> Martin

Yes it is accessing 8-bit chars, and it is casting pointer to chars as
pointer to 32-bit integer and calling GCC __builtin_bswap32()

Core was generated by `./miniperl -Ilib autodoc.pl'.
Program terminated with signal 10, Bus error.
#0  zaphod32_hash_with_state (key_len=25, key=0xffbffa02 "ALLOW_VULNERABLE_PACKAGES=", state_ch=<optimized out>) at zaphod32_hash.h:280
280                 v1 -= U8TO32_LE(key+0);

(gdb) list
275         {
276     zaphod32_read8:
277             len = key_len & 0x7;
278             end = key + key_len - len;
279             do {
280                 v1 -= U8TO32_LE(key+0);
281                 v0 += U8TO32_LE(key+4);
282                 ZAPHOD32_MIX(v0,v1,v2,"MIX 2-WORDS A");
283                 key += 8;
284             } while ( key < end );

So "key" is a pointer to array of chars:
(gdb) p key
$1 = (const U8 *) 0xffbffa02 "ALLOW_VULNERABLE_PACKAGES="

Array is not aligned on 4-byte address, since result of % 4 is not 0:
(gdb) p 0xffbffa02 % 4
$2 = 2

Here is address in binary, 4-byte aligned should have the first two
LSBs as 00 but this one has 10:
(gdb) p /t 0xffbffa02
$3 = 11111111101111111111101000000010

I resolved this by manually editing config.h and uncommenting

#ifndef U32_ALIGNMENT_REQUIRED
/*#define U32_ALIGNMENT_REQUIRED        / **/
#endif

For some reason Perl Configure script is not correctly identifying
alignment requirements.


Home | Main Index | Thread Index | Old Index