Support read-only section for curve25519_x25519base_byte.S#247
Conversation
The attached patch permits the read-only section to be enabled. Tested via aws-lc-sys -> deno on OpenBSD 7.7-current.
|
Absolutely, please do! As a side note: enabling the read-only section on the amd64 equivalent works without modification in the same setup. |
|
|
||
| adr x10, curve25519_x25519base_byte_edwards25519_0g | ||
| adr x11, curve25519_x25519base_byte_edwards25519_8g | ||
| adrp x10, curve25519_x25519base_byte_edwards25519_0g |
There was a problem hiding this comment.
AIUI page-level relocations for mach-o require @PAGE on the end of this, and @PAGEOFF on the end of the add operand (which also needs to lose the ELF-specific :lo12: relocation designation.)
There was a problem hiding this comment.
The other possibility is just requiring these to be page-aligned, which means we can lose the add adjustments and only need to support one kind of relocation specifier. That's what I did over here (macro def for reference).
There was a problem hiding this comment.
Yes, indeed Mach-O is a bit different. I think, after a bit of testing, that the following works with both Linux generating ELF and Mac OS generating Mach-O. (I just use ..._data since I think it will simplify the proof if we just have a single relocated symbol for the start of the data.) I'm confident we can prove this since I've prototyped something similar. But I suspect it needs a bit more refinement for other platforms. I'm hoping that if we delete the linux part of the ifdef it would work on OpenBSD and indeed other BSDs - does that look reasonable? (tab is just cpp'd to a register).
#if defined(__linux__) && defined(__ELF__)
adrp tab, curve25519_x25519base_byte_data
add tab, tab, :lo12:curve25519_x25519base_byte_data
#else
adrp tab, curve25519_x25519base_byte_data@PAGE
add tab, tab, curve25519_x25519base_byte_data@PAGEOFF
#endif
The attached patch permits the read-only section to be enabled. Tested via aws-lc-sys -> deno on OpenBSD 7.7-current.
Related to: #174 #207
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.