Skip to content

U32 alignment on 64-bit arch [rt.cpan.org #77919] #8

@toddr

Description

@toddr

Migrated from rt.cpan.org#77919 (status was 'open')

Requestors:

Attachments:

diff -ur Digest-MD5-2.52.orig/Makefile.PL Digest-MD5-2.52.mod0/Makefile.PL
--- Digest-MD5-2.52.orig/Makefile.PL	2012-06-07 23:16:21.000000000 +0100
+++ Digest-MD5-2.52.mod0/Makefile.PL	2012-06-20 12:10:18.693705783 +0100
@@ -79,7 +79,7 @@
 
 int main(int argc, char** argv, char** env)
 {
-#if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
+#if BYTEORDER == 0x1234 || BYTEORDER == 0x4321 || BYTEORDER == 0x12345678 || BYTEORDER == 0x87654321
     volatile U8 buf[] = "\0\0\0\1\0\0\0\0";
     volatile U32 *up;
     int i;

From zefram@fysh.org on 2012-06-20 11:20:22
:

Digest-MD5's U32 alignment test perceives any 64-bit architecture as
an "unusual byte order", and unnecessarily plays safe, losing some
performance.  Attached patch fixes.

-zefram


From zefram@fysh.org on 2012-06-20 11:50:21
:

Second thoughts: some of the code in MD5.xs needs to be edited as well
to cope with a 64-bit BYTEORDER.  I'm somewhat amazed that this didn't
show up immediately in the test suite.

-zefram


From rurban@cpan.org on 2016-03-27 08:52:36
:

On Wed Jun 20 07:50:21 2012, zefram@fysh.org wrote:
> Second thoughts: some of the code in MD5.xs needs to be edited as well
> to cope with a 64-bit BYTEORDER.  I'm somewhat amazed that this didn't
> show up immediately in the test suite.

perl5 core took over the same wrong d_u32align probe which fails on all intel cpus,
unless the AC bit (alignment check) in EFLAGS is set. See http://orchistro.tistory.com/206
how to enforce a SIGBUS on intel also, e.g. when U32_ALIGNMENT_REQUIRED is wrongly set.
I do this to check on fast intel for possible SIGBUS errors for alignment strict platforms (mips,sparc,ppc).

See https://github.com/gisle/digest-md5/pull/13

It needs to link with -lperl
-- 
Reini Urban


Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions