Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions crates/common/crypto/blake2f/x86_64.s
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@
.endm


# Be explicit about the section: `global_asm!` blocks inherit the assembler's
# current section from whatever block was emitted before them in this codegen
# unit. See issue #7246.
.text
.global _blake2b_f
.type _blake2b_f, @function
_blake2b_f:
Expand Down
7 changes: 6 additions & 1 deletion crates/common/crypto/keccak/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,12 @@ $ ./keccak1600-armv8.pl linux64 keccak1600-armv8.s
$ cd ../x86_64
$ ./keccak1600-x86_64.pl linux64 keccak1600-x86_64.s
```
- The x86 can be directly imported by the Rust compiler with the current options, but the ARM code requires a few changes, commented at the top of the `keccak1600-armv8.s` file.
- Both the x86 and the ARM code need a few changes before the Rust compiler can import them. Each file lists its
own changes in a `Modified:` comment at the top; the ARM code needs the most of them.
- One change applies to every file: each `global_asm!` block must both start in `.text` and leave `.text`
current when it ends. Blocks in the same codegen unit share the assembler's section state, so a block that
finishes in some other section makes the *next* block emit its functions there instead of in `.text`.
This is why the trailing `.note.gnu.property` block uses `.pushsection`/`.popsection` rather than `.section`.

## Copyright Notice

Expand Down
5 changes: 5 additions & 0 deletions crates/common/crypto/keccak/keccak1600-armv8-elf.s
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,15 @@
// Reason: `.L` local labels are ELF-specific.
// - Replaced instance of `adr x??,label` by `adrp x??,label` followed by
// `add x??,x??,:lo12:label`.
// - Added an explicit `.text`.
// Reason: `global_asm!` blocks inherit the assembler's current section from
// whatever block was emitted before them in the same codegen unit.
//
// TODO: this is probably a matter of selecting the right parameter
// for the translator.

.text

.align 8 // strategic alignment and padding that allows to use
// address value as loop termination condition...
.quad 0,0,0,0,0,0,0,0
Expand Down
5 changes: 5 additions & 0 deletions crates/common/crypto/keccak/keccak1600-armv8-macho.s
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,15 @@
// Reason: `.L` local labels are ELF-specific.
// - Replaced instance of `adr x??,label` by `adrp x??,label@PAGE` followed by
// `add x??,x??,label@PAGEOFF`.
// - Added an explicit `.text`.
// Reason: `global_asm!` blocks inherit the assembler's current section from
// whatever block was emitted before them in the same codegen unit.
//
// TODO: this is probably a matter of selecting the right parameter
// for the translator.

.text

.align 8 // strategic alignment and padding that allows to use
// address value as loop termination condition...
.quad 0,0,0,0,0,0,0,0
Expand Down
9 changes: 8 additions & 1 deletion crates/common/crypto/keccak/keccak1600-x86_64.s
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# Modified:
# - Wrapped the trailing `.note.gnu.property` block in `.pushsection`/`.popsection`.
# Reason: `global_asm!` blocks share the assembler's section state within a codegen
# unit, so leaving the note section current made a *following* `global_asm!` emit its
# functions into `.note.gnu.property` instead of `.text`. See issue #7246.

.text

.type __KeccakF1600,@function
Expand Down Expand Up @@ -528,9 +534,10 @@ iotas:
.size iotas,.-iotas
.byte 75,101,99,99,97,107,45,49,54,48,48,32,97,98,115,111,114,98,32,97,110,100,32,115,113,117,101,101,122,101,32,102,111,114,32,120,56,54,95,54,52,44,32,67,82,89,80,84,79,71,65,77,83,32,98,121,32,60,97,112,112,114,111,64,111,112,101,110,115,115,108,46,111,114,103,62,0

.section .note.gnu.property,"a",@note
.pushsection .note.gnu.property,"a",@note
.long 4,2f-1f,5
.byte 0x47,0x4E,0x55,0
1: .long 0xc0000002,4,3
.align 8
2:
.popsection
Loading