mirror of
https://github.com/openssl/openssl.git
synced 2024-11-21 01:15:20 +08:00
1aa89a7a3a
They now generally conform to the following argument sequence: script.pl "$(PERLASM_SCHEME)" [ C preprocessor arguments ... ] \ $(PROCESSOR) <output file> However, in the spirit of being able to use these scripts manually, they also allow for no argument, or for only the flavour, or for only the output file. This is done by only using the last argument as output file if it's a file (it has an extension), and only using the first argument as flavour if it isn't a file (it doesn't have an extension). While we're at it, we make all $xlate calls the same, i.e. the $output argument is always quoted, and we always die on error when trying to start $xlate. There's a perl lesson in this, regarding operator priority... This will always succeed, even when it fails: open FOO, "something" || die "ERR: $!"; The reason is that '||' has higher priority than list operators (a function is essentially a list operator and gobbles up everything following it that isn't lower priority), and since a non-empty string is always true, so that ends up being exactly the same as: open FOO, "something"; This, however, will fail if "something" can't be opened: open FOO, "something" or die "ERR: $!"; The reason is that 'or' has lower priority that list operators, i.e. it's performed after the 'open' call. Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/9884)
75 lines
1.7 KiB
Raku
Executable File
75 lines
1.7 KiB
Raku
Executable File
#! /usr/bin/env perl
|
|
# Copyright 2008-2016 The OpenSSL Project Authors. All Rights Reserved.
|
|
#
|
|
# Licensed under the Apache License 2.0 (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
|
|
|
|
# $output is the last argument if it looks like a file (it has an extension)
|
|
$output = $#ARGV >= 0 && $ARGV[$#ARGV] =~ m|\.\w+$| ? pop : undef;
|
|
|
|
$0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1;
|
|
open OUT,"| \"$^X\" \"${dir}../crypto/perlasm/x86_64-xlate.pl\" \"$output\""
|
|
or die "can't call ${dir}../crypto/perlasm/x86_64-xlate.pl: $!";
|
|
*STDOUT=*OUT;
|
|
push(@INC,"${dir}.");
|
|
|
|
require "uplink-common.pl";
|
|
|
|
$prefix="_lazy";
|
|
|
|
print <<___;
|
|
.text
|
|
.extern OPENSSL_Uplink
|
|
.globl OPENSSL_UplinkTable
|
|
___
|
|
for ($i=1;$i<=$N;$i++) {
|
|
print <<___;
|
|
.type $prefix${i},\@abi-omnipotent
|
|
.align 16
|
|
$prefix${i}:
|
|
.byte 0x48,0x83,0xEC,0x28 # sub rsp,40
|
|
mov %rcx,48(%rsp)
|
|
mov %rdx,56(%rsp)
|
|
mov %r8,64(%rsp)
|
|
mov %r9,72(%rsp)
|
|
lea OPENSSL_UplinkTable(%rip),%rcx
|
|
mov \$$i,%rdx
|
|
call OPENSSL_Uplink
|
|
mov 48(%rsp),%rcx
|
|
mov 56(%rsp),%rdx
|
|
mov 64(%rsp),%r8
|
|
mov 72(%rsp),%r9
|
|
lea OPENSSL_UplinkTable(%rip),%rax
|
|
add \$40,%rsp
|
|
jmp *8*$i(%rax)
|
|
$prefix${i}_end:
|
|
.size $prefix${i},.-$prefix${i}
|
|
___
|
|
}
|
|
print <<___;
|
|
.data
|
|
OPENSSL_UplinkTable:
|
|
.quad $N
|
|
___
|
|
for ($i=1;$i<=$N;$i++) { print " .quad $prefix$i\n"; }
|
|
print <<___;
|
|
.section .pdata,"r"
|
|
.align 4
|
|
___
|
|
for ($i=1;$i<=$N;$i++) {
|
|
print <<___;
|
|
.rva $prefix${i},$prefix${i}_end,${prefix}_unwind_info
|
|
___
|
|
}
|
|
print <<___;
|
|
.section .xdata,"r"
|
|
.align 8
|
|
${prefix}_unwind_info:
|
|
.byte 0x01,0x04,0x01,0x00
|
|
.byte 0x04,0x42,0x00,0x00
|
|
___
|
|
|
|
close STDOUT;
|