diff options
author | H.Merijn Brand <h.m.brand@xs4all.nl> | 2011-08-04 09:20:32 +0200 |
---|---|---|
committer | H.Merijn Brand <h.m.brand@xs4all.nl> | 2011-08-04 09:20:32 +0200 |
commit | 9cfd094e6d0a842551c1c58e998eb057cd8425e3 (patch) | |
tree | 35d80f75ece1586fbedb1593c4b82bdd8cf4fa74 | |
parent | 4eb81ef27984510df69d5b65e3f5cfa0bd218069 (diff) | |
download | perl-9cfd094e6d0a842551c1c58e998eb057cd8425e3.tar.gz |
Support gcc-4.x on HP-UX PA-RISC/64
Correct the socketsize. Probably due to big-endian versus
little-endian, this has always worked on Intel CPUs. This
is a very very old problem, and it has been the reason I
never used gcc-4 on PA-RISC, because perl would not pass
the test suite in 64bitall.
Noticeable effects of wrong "$socksizetype" are return codes
of 0 (pass) from functions like getpeername (), but invalid
(or none) data in the returned structures or a return length
of 0 or 256. In the latter case, the length is stored in the
second part of the 64bit long and the 32bit first part is 0.
This might be true on Intel-like machines too, but the tests
will pass, as the significant part of the returned length is
in the first 32bits and a pointer to int will still see that
correct. Mind that in that case the 32bits after that might
have been overridden => can of worms.
-rw-r--r-- | ext/Socket/t/getaddrinfo.t | 14 | ||||
-rw-r--r-- | hints/hpux.sh | 10 | ||||
-rw-r--r-- | pod/perldelta.pod | 9 |
3 files changed, 29 insertions, 4 deletions
diff --git a/ext/Socket/t/getaddrinfo.t b/ext/Socket/t/getaddrinfo.t index 5c8d1539d7..b85af38254 100644 --- a/ext/Socket/t/getaddrinfo.t +++ b/ext/Socket/t/getaddrinfo.t @@ -1,6 +1,6 @@ use strict; use warnings; -use Test::More tests => 29; +use Test::More tests => 30; use Socket qw( AI_NUMERICHOST AF_INET SOCK_STREAM IPPROTO_TCP @@ -21,9 +21,15 @@ is( $res[0]->{socktype}, SOCK_STREAM, '$res[0] socktype is SOCK_STREAM' ); ok( $res[0]->{protocol} == 0 || $res[0]->{protocol} == IPPROTO_TCP, '$res[0] protocol is 0 or IPPROTO_TCP' ); -is_deeply( [ unpack_sockaddr_in $res[0]->{addr} ], - [ 80, inet_aton( "127.0.0.1" ) ], - '$res[0] addr is {"127.0.0.1", 80}' ); +ok( defined $res[0]->{addr}, + '$res[0] addr is defined' ); +if (length $res[0]->{addr}) { + is_deeply( [ unpack_sockaddr_in $res[0]->{addr} ], + [ 80, inet_aton( "127.0.0.1" ) ], + '$res[0] addr is {"127.0.0.1", 80}' ); +} else { + fail( '$res[0] addr is empty: check $socksizetype' ); +} # Check actual IV integers work just as well as PV strings ( $err, @res ) = getaddrinfo( "127.0.0.1", 80, { socktype => SOCK_STREAM } ); diff --git a/hints/hpux.sh b/hints/hpux.sh index cb1718478e..be6c1fddb8 100644 --- a/hints/hpux.sh +++ b/hints/hpux.sh @@ -263,6 +263,16 @@ EOM case "$ccisgcc" in $define|true|[Yy]) + # The fixed socket.h header file is wrong for gcc-4.x + # on PA-RISC2.0W, so Sock_type_t is size_t which is + # unsigned long which is 64bit which is too long + case "$gccversion" in + 4*) case "$archname" in + PA-RISC*) socksizetype=int ;; + esac + ;; + esac + # For the moment, don't care that it ain't supported (yet) # by gcc (up to and including 2.95.3), cause it'll crash # anyway. Expect auto-detection of 64-bit enabled gcc on diff --git a/pod/perldelta.pod b/pod/perldelta.pod index 07f5dd31f8..0f83b03fef 100644 --- a/pod/perldelta.pod +++ b/pod/perldelta.pod @@ -339,6 +339,15 @@ XXX Any changes to platform support should be listed in the sections below. [ Within the sections, list each platform as a =item entry with specific changes as paragraphs below it. ] +=over 4 + +=item HP-UX PA-RISC/64 now supports gcc-4.x + +A fix to correct the socketsize now makes the test suite pass on HP-UX +PA-RISC for 64bitall builds. + +=back + =head2 New Platforms XXX List any platforms that this version of perl compiles on, that previous |