From 25c59400a04e7301aaa6acb604b5ebef9d2f4cf1 Mon Sep 17 00:00:00 2001 From: miod <> Date: Fri, 13 Jan 2023 17:27:26 +0000 Subject: Move all data tables from .text section to .rodata, and update the code to fetch them correctly when building PIC. Also drop unused data, and remove --no-execute-only from linker flags. ok kettenis@ --- src/lib/libcrypto/modes/asm/ghash-sparcv9.pl | 35 ++++++++++++++++++++++------ 1 file changed, 28 insertions(+), 7 deletions(-) (limited to 'src/lib/libcrypto/modes') diff --git a/src/lib/libcrypto/modes/asm/ghash-sparcv9.pl b/src/lib/libcrypto/modes/asm/ghash-sparcv9.pl index 70e7b044a3..ce75045f09 100644 --- a/src/lib/libcrypto/modes/asm/ghash-sparcv9.pl +++ b/src/lib/libcrypto/modes/asm/ghash-sparcv9.pl @@ -67,7 +67,7 @@ $inp="%i2"; $len="%i3"; $code.=<<___; -.section ".text",#alloc,#execinstr +.section ".rodata",#alloc .align 64 rem_4bit: @@ -78,18 +78,30 @@ rem_4bit: .type rem_4bit,#object .size rem_4bit,(.-rem_4bit) +.section ".text",#alloc,#execinstr .globl gcm_ghash_4bit .align 32 gcm_ghash_4bit: save %sp,-$frame,%sp +#ifdef __PIC__ + sethi %hi(_GLOBAL_OFFSET_TABLE_-4), $tmp + rd %pc, $rem + or $tmp, %lo(_GLOBAL_OFFSET_TABLE_+4), $tmp + add $tmp, $rem, $tmp +#endif + ldub [$inp+15],$nlo ldub [$Xi+15],$xi0 ldub [$Xi+14],$xi1 add $len,$inp,$len add $Htbl,8,$Htblo -1: call .+8 - add %o7,rem_4bit-1b,$rem_4bit +#ifdef __PIC__ + set rem_4bit, $rem_4bit + ldx [$rem_4bit+$tmp], $rem_4bit +#else + set rem_4bit, $rem_4bit +#endif .Louter: xor $xi0,$nlo,$nlo @@ -223,11 +235,22 @@ $code.=<<___; .align 32 gcm_gmult_4bit: save %sp,-$frame,%sp +#ifdef __PIC__ + sethi %hi(_GLOBAL_OFFSET_TABLE_-4), $tmp + rd %pc, $rem + or $tmp, %lo(_GLOBAL_OFFSET_TABLE_+4), $tmp + add $tmp, $rem, $tmp +#endif + ldub [$Xi+15],$nlo add $Htbl,8,$Htblo -1: call .+8 - add %o7,rem_4bit-1b,$rem_4bit +#ifdef __PIC__ + set rem_4bit, $rem_4bit + ldx [$rem_4bit+$tmp], $rem_4bit +#else + set rem_4bit, $rem_4bit +#endif and $nlo,0xf0,$nhi and $nlo,0x0f,$nlo @@ -321,8 +344,6 @@ gcm_gmult_4bit: restore .type gcm_gmult_4bit,#function .size gcm_gmult_4bit,(.-gcm_gmult_4bit) -.asciz "GHASH for SPARCv9, CRYPTOGAMS by " -.align 4 ___ $code =~ s/\`([^\`]*)\`/eval $1/gem; -- cgit v1.2.3-55-g6feb