diff options
author | H.J. Lu <hongjiu.lu@intel.com> | 2020-01-09 06:20:09 -0800 |
---|---|---|
committer | Tomas Mraz <tmraz@fedoraproject.org> | 2020-02-18 18:03:16 +0100 |
commit | 0d51cf3ccc0224def10c32b6defd4a77a1b4322a (patch) | |
tree | 989d96b36f3e257d2403c22275a6929447894d27 /crypto/perlasm | |
parent | 21542a48ab542dc4d687a15e19c11318df58f72e (diff) |
x86_64: Don't assume 8-byte pointer size
Since pointer in x32 is 4 bytes, add x86_64-support.pl to define
pointer_size and pointer_register based on flavour to support
stuctures like:
struct { void *ptr; int blocks; }
This fixes 90-test_sslapi.t on x32. Verified with
$ ./Configure shared linux-x86_64
$ make
$ make test
and
$ ./Configure shared linux-x32
$ make
$ make test
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org>
(Merged from https://github.com/openssl/openssl/pull/10988)
Diffstat (limited to 'crypto/perlasm')
-rw-r--r-- | crypto/perlasm/x86_64-support.pl | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/crypto/perlasm/x86_64-support.pl b/crypto/perlasm/x86_64-support.pl new file mode 100644 index 0000000000..66aeaedab4 --- /dev/null +++ b/crypto/perlasm/x86_64-support.pl @@ -0,0 +1,51 @@ +#! /usr/bin/env perl +# Copyright 2020 The OpenSSL Project Authors. All Rights Reserved. +# +# Licensed under the OpenSSL license (the "License"). You may not use +# this file except in compliance with the License. You can obtain a copy +# in the file LICENSE in the source distribution or at +# https://www.openssl.org/source/license.html + + +package x86_64support; + +# require "x86_64-support.pl"; +# $ptr_size=&pointer_size($flavour); +# $ptr_reg=&pointer_register($flavour,$reg); + +sub ::pointer_size +{ + my($flavour)=@_; + my $ptr_size=8; $ptr_size=4 if ($flavour eq "elf32"); + return $ptr_size; +} + +sub ::pointer_register +{ + my($flavour,$reg)=@_; + if ($flavour eq "elf32") { + if ($reg eq "%rax") { + return "%eax"; + } elsif ($reg eq "%rbx") { + return "%ebx"; + } elsif ($reg eq "%rcx") { + return "%ecx"; + } elsif ($reg eq "%rdx") { + return "%edx"; + } elsif ($reg eq "%rdi") { + return "%edi"; + } elsif ($reg eq "%rsi") { + return "%esi"; + } elsif ($reg eq "%rbp") { + return "%ebp"; + } elsif ($reg eq "%rsp") { + return "%esp"; + } else { + return $reg."d"; + } + } else { + return $reg; + } +} + +1; |