Move constants in perl generated BoringSSL assembly from .text to
.rodata.  This fixes the build (and only the build) on x-only amd64.
I'll look into fixes for the aarch64 perlasm later. There the build
succeeds, but runtime failures are likely.

Similar fixes will be needed by anything that embeds BoringSSL sources
such as the chromium derivatives and the ring crate.

I edited the .S files directly instead of the .pl files since the .pl
files seem to be unused by the build system (also in chromium).


As mentioned, this is unfortunately only good enough to fix the build.
Runtime testing shows that there are other x-only violation in this code
base. Apparently V8 (also used by chrome & friends) has an assembly
generator. When using otter-browser QtWebEngineProcess segfaults with
things such as:

Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x00000c8392f76fa5 in 
v8::internal::EmbeddedData::InstructionStartOfBuiltin(int) const ()
   from /usr/local/lib/qt5/libQt5WebEngineCore.so.1.0

otter-browser works fine when qtwebengine is built with USE_NOEXECONLY.
One step at a time.

Index: Makefile
===================================================================
RCS file: /cvs/ports/x11/qt5/qtwebengine/Makefile,v
retrieving revision 1.29
diff -u -p -r1.29 Makefile
--- Makefile    5 Nov 2022 17:07:33 -0000       1.29
+++ Makefile    16 Jan 2023 13:31:22 -0000
@@ -15,7 +15,7 @@ VERSION =             ${QT5_WEBENGINE_VERSION}
 DIST_VERSION =         ${QT5_WEBENGINE_VERSION}
 DISTNAME =             ${QT5NAME:L}-everywhere-src-${DIST_VERSION}
 PKGNAME ?=             
${DISTNAME:C/-everywhere-src//:C/-${DIST_VERSION}/-${VERSION}/}
-REVISION =             8
+REVISION =             9
 
 MASTER_SITES ?=                
https://download.qt.io/official_releases/qt/${QT5_WEBENGINE_VERSION:R}/${QT5_WEBENGINE_VERSION}/submodules/
 \
                        
https://mirrors.ocf.berkeley.edu/qt/official_releases/qt/${QT5_WEBENGINE_VERSION:R}/${QT5_WEBENGINE_VERSION}/submodules/
Index: 
patches/patch-src_3rdparty_chromium_third_party_boringssl_linux-x86_64_crypto_chacha_chacha-x86_64_S
===================================================================
RCS file: 
patches/patch-src_3rdparty_chromium_third_party_boringssl_linux-x86_64_crypto_chacha_chacha-x86_64_S
diff -N 
patches/patch-src_3rdparty_chromium_third_party_boringssl_linux-x86_64_crypto_chacha_chacha-x86_64_S
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ 
patches/patch-src_3rdparty_chromium_third_party_boringssl_linux-x86_64_crypto_chacha_chacha-x86_64_S
        16 Jan 2023 09:04:33 -0000
@@ -0,0 +1,19 @@
+Index: 
src/3rdparty/chromium/third_party/boringssl/linux-x86_64/crypto/chacha/chacha-x86_64.S
+--- 
src/3rdparty/chromium/third_party/boringssl/linux-x86_64/crypto/chacha/chacha-x86_64.S.orig
++++ 
src/3rdparty/chromium/third_party/boringssl/linux-x86_64/crypto/chacha/chacha-x86_64.S
+@@ -16,6 +16,7 @@
+ .extern       OPENSSL_ia32cap_P
+ .hidden OPENSSL_ia32cap_P
+ 
++.rodata
+ .align        64
+ .Lzero:
+ .long 0,0,0,0
+@@ -45,6 +46,7 @@
+ .Lsixteen:
+ .long 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16
+ .byte 
67,104,97,67,104,97,50,48,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
++.previous
+ .globl        ChaCha20_ctr32
+ .hidden ChaCha20_ctr32
+ .type ChaCha20_ctr32,@function
Index: 
patches/patch-src_3rdparty_chromium_third_party_boringssl_linux-x86_64_crypto_fipsmodule_aesni-gcm-x86_64_S
===================================================================
RCS file: 
patches/patch-src_3rdparty_chromium_third_party_boringssl_linux-x86_64_crypto_fipsmodule_aesni-gcm-x86_64_S
diff -N 
patches/patch-src_3rdparty_chromium_third_party_boringssl_linux-x86_64_crypto_fipsmodule_aesni-gcm-x86_64_S
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ 
patches/patch-src_3rdparty_chromium_third_party_boringssl_linux-x86_64_crypto_fipsmodule_aesni-gcm-x86_64_S
 16 Jan 2023 09:04:33 -0000
@@ -0,0 +1,19 @@
+Index: 
src/3rdparty/chromium/third_party/boringssl/linux-x86_64/crypto/fipsmodule/aesni-gcm-x86_64.S
+--- 
src/3rdparty/chromium/third_party/boringssl/linux-x86_64/crypto/fipsmodule/aesni-gcm-x86_64.S.orig
++++ 
src/3rdparty/chromium/third_party/boringssl/linux-x86_64/crypto/fipsmodule/aesni-gcm-x86_64.S
+@@ -835,6 +835,7 @@ aesni_gcm_encrypt:
+       .byte   0xf3,0xc3
+ .cfi_endproc  
+ .size aesni_gcm_encrypt,.-aesni_gcm_encrypt
++.rodata
+ .align        64
+ .Lbswap_mask:
+ .byte 15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0
+@@ -847,6 +848,7 @@ aesni_gcm_encrypt:
+ .Lone_lsb:
+ .byte 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
+ .byte 
65,69,83,45,78,73,32,71,67,77,32,109,111,100,117,108,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
++.previous
+ .align        64
+ #endif
+ .section      .note.GNU-stack,"",@progbits
Index: 
patches/patch-src_3rdparty_chromium_third_party_boringssl_linux-x86_64_crypto_fipsmodule_aesni-x86_64_S
===================================================================
RCS file: 
patches/patch-src_3rdparty_chromium_third_party_boringssl_linux-x86_64_crypto_fipsmodule_aesni-x86_64_S
diff -N 
patches/patch-src_3rdparty_chromium_third_party_boringssl_linux-x86_64_crypto_fipsmodule_aesni-x86_64_S
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ 
patches/patch-src_3rdparty_chromium_third_party_boringssl_linux-x86_64_crypto_fipsmodule_aesni-x86_64_S
     16 Jan 2023 09:04:33 -0000
@@ -0,0 +1,18 @@
+Index: 
src/3rdparty/chromium/third_party/boringssl/linux-x86_64/crypto/fipsmodule/aesni-x86_64.S
+--- 
src/3rdparty/chromium/third_party/boringssl/linux-x86_64/crypto/fipsmodule/aesni-x86_64.S.orig
++++ 
src/3rdparty/chromium/third_party/boringssl/linux-x86_64/crypto/fipsmodule/aesni-x86_64.S
+@@ -2480,6 +2480,7 @@ __aesni_set_encrypt_key:
+       .byte   0xf3,0xc3
+ .size aes_hw_set_encrypt_key,.-aes_hw_set_encrypt_key
+ .size __aesni_set_encrypt_key,.-__aesni_set_encrypt_key
++.rodata
+ .align        64
+ .Lbswap_mask:
+ .byte 15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0
+@@ -2502,5 +2503,6 @@ __aesni_set_encrypt_key:
+ 
+ .byte 
65,69,83,32,102,111,114,32,73,110,116,101,108,32,65,69,83,45,78,73,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
+ .align        64
++.previous
+ #endif
+ .section      .note.GNU-stack,"",@progbits
Index: 
patches/patch-src_3rdparty_chromium_third_party_boringssl_linux-x86_64_crypto_fipsmodule_ghash-ssse3-x86_64_S
===================================================================
RCS file: 
patches/patch-src_3rdparty_chromium_third_party_boringssl_linux-x86_64_crypto_fipsmodule_ghash-ssse3-x86_64_S
diff -N 
patches/patch-src_3rdparty_chromium_third_party_boringssl_linux-x86_64_crypto_fipsmodule_ghash-ssse3-x86_64_S
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ 
patches/patch-src_3rdparty_chromium_third_party_boringssl_linux-x86_64_crypto_fipsmodule_ghash-ssse3-x86_64_S
       16 Jan 2023 09:04:33 -0000
@@ -0,0 +1,12 @@
+Index: 
src/3rdparty/chromium/third_party/boringssl/linux-x86_64/crypto/fipsmodule/ghash-ssse3-x86_64.S
+--- 
src/3rdparty/chromium/third_party/boringssl/linux-x86_64/crypto/fipsmodule/ghash-ssse3-x86_64.S.orig
++++ 
src/3rdparty/chromium/third_party/boringssl/linux-x86_64/crypto/fipsmodule/ghash-ssse3-x86_64.S
+@@ -417,7 +417,7 @@ gcm_ghash_ssse3:
+ 
+ .align        16
+ 
+-
++.rodata
+ .Lreverse_bytes:
+ .byte 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0
+ 
Index: 
patches/patch-src_3rdparty_chromium_third_party_boringssl_linux-x86_64_crypto_fipsmodule_ghash-x86_64_S
===================================================================
RCS file: 
patches/patch-src_3rdparty_chromium_third_party_boringssl_linux-x86_64_crypto_fipsmodule_ghash-x86_64_S
diff -N 
patches/patch-src_3rdparty_chromium_third_party_boringssl_linux-x86_64_crypto_fipsmodule_ghash-x86_64_S
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ 
patches/patch-src_3rdparty_chromium_third_party_boringssl_linux-x86_64_crypto_fipsmodule_ghash-x86_64_S
     16 Jan 2023 09:04:33 -0000
@@ -0,0 +1,11 @@
+Index: 
src/3rdparty/chromium/third_party/boringssl/linux-x86_64/crypto/fipsmodule/ghash-x86_64.S
+--- 
src/3rdparty/chromium/third_party/boringssl/linux-x86_64/crypto/fipsmodule/ghash-x86_64.S.orig
++++ 
src/3rdparty/chromium/third_party/boringssl/linux-x86_64/crypto/fipsmodule/ghash-x86_64.S
+@@ -1112,6 +1112,7 @@ gcm_ghash_avx:
+       .byte   0xf3,0xc3
+ .cfi_endproc  
+ .size gcm_ghash_avx,.-gcm_ghash_avx
++.rodata
+ .align        64
+ .Lbswap_mask:
+ .byte 15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0
Index: 
patches/patch-src_3rdparty_chromium_third_party_boringssl_linux-x86_64_crypto_fipsmodule_sha1-x86_64_S
===================================================================
RCS file: 
patches/patch-src_3rdparty_chromium_third_party_boringssl_linux-x86_64_crypto_fipsmodule_sha1-x86_64_S
diff -N 
patches/patch-src_3rdparty_chromium_third_party_boringssl_linux-x86_64_crypto_fipsmodule_sha1-x86_64_S
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ 
patches/patch-src_3rdparty_chromium_third_party_boringssl_linux-x86_64_crypto_fipsmodule_sha1-x86_64_S
      16 Jan 2023 09:04:33 -0000
@@ -0,0 +1,11 @@
+Index: 
src/3rdparty/chromium/third_party/boringssl/linux-x86_64/crypto/fipsmodule/sha1-x86_64.S
+--- 
src/3rdparty/chromium/third_party/boringssl/linux-x86_64/crypto/fipsmodule/sha1-x86_64.S.orig
++++ 
src/3rdparty/chromium/third_party/boringssl/linux-x86_64/crypto/fipsmodule/sha1-x86_64.S
+@@ -3582,6 +3582,7 @@ _avx_shortcut:
+       .byte   0xf3,0xc3
+ .cfi_endproc  
+ .size sha1_block_data_order_avx,.-sha1_block_data_order_avx
++.rodata
+ .align        64
+ K_XX_XX:
+ .long 0x5a827999,0x5a827999,0x5a827999,0x5a827999
Index: 
patches/patch-src_3rdparty_chromium_third_party_boringssl_linux-x86_64_crypto_fipsmodule_sha256-x86_64_S
===================================================================
RCS file: 
patches/patch-src_3rdparty_chromium_third_party_boringssl_linux-x86_64_crypto_fipsmodule_sha256-x86_64_S
diff -N 
patches/patch-src_3rdparty_chromium_third_party_boringssl_linux-x86_64_crypto_fipsmodule_sha256-x86_64_S
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ 
patches/patch-src_3rdparty_chromium_third_party_boringssl_linux-x86_64_crypto_fipsmodule_sha256-x86_64_S
    16 Jan 2023 09:04:33 -0000
@@ -0,0 +1,19 @@
+Index: 
src/3rdparty/chromium/third_party/boringssl/linux-x86_64/crypto/fipsmodule/sha256-x86_64.S
+--- 
src/3rdparty/chromium/third_party/boringssl/linux-x86_64/crypto/fipsmodule/sha256-x86_64.S.orig
++++ 
src/3rdparty/chromium/third_party/boringssl/linux-x86_64/crypto/fipsmodule/sha256-x86_64.S
+@@ -1738,6 +1738,7 @@ sha256_block_data_order:
+       .byte   0xf3,0xc3
+ .cfi_endproc  
+ .size sha256_block_data_order,.-sha256_block_data_order
++.rodata
+ .align        64
+ .type K256,@object
+ K256:
+@@ -1781,6 +1782,7 @@ K256:
+ .long 0xffffffff,0xffffffff,0x03020100,0x0b0a0908
+ .long 0xffffffff,0xffffffff,0x03020100,0x0b0a0908
+ .byte 
83,72,65,50,53,54,32,98,108,111,99,107,32,116,114,97,110,115,102,111,114,109,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
++.previous
+ .type sha256_block_data_order_ssse3,@function
+ .align        64
+ sha256_block_data_order_ssse3:
Index: 
patches/patch-src_3rdparty_chromium_third_party_boringssl_linux-x86_64_crypto_fipsmodule_sha512-x86_64_S
===================================================================
RCS file: 
patches/patch-src_3rdparty_chromium_third_party_boringssl_linux-x86_64_crypto_fipsmodule_sha512-x86_64_S
diff -N 
patches/patch-src_3rdparty_chromium_third_party_boringssl_linux-x86_64_crypto_fipsmodule_sha512-x86_64_S
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ 
patches/patch-src_3rdparty_chromium_third_party_boringssl_linux-x86_64_crypto_fipsmodule_sha512-x86_64_S
    16 Jan 2023 09:04:33 -0000
@@ -0,0 +1,19 @@
+Index: 
src/3rdparty/chromium/third_party/boringssl/linux-x86_64/crypto/fipsmodule/sha512-x86_64.S
+--- 
src/3rdparty/chromium/third_party/boringssl/linux-x86_64/crypto/fipsmodule/sha512-x86_64.S.orig
++++ 
src/3rdparty/chromium/third_party/boringssl/linux-x86_64/crypto/fipsmodule/sha512-x86_64.S
+@@ -1736,6 +1736,7 @@ sha512_block_data_order:
+       .byte   0xf3,0xc3
+ .cfi_endproc  
+ .size sha512_block_data_order,.-sha512_block_data_order
++.rodata
+ .align        64
+ .type K512,@object
+ K512:
+@@ -1823,6 +1824,7 @@ K512:
+ .quad 0x0001020304050607,0x08090a0b0c0d0e0f
+ .quad 0x0001020304050607,0x08090a0b0c0d0e0f
+ .byte 
83,72,65,53,49,50,32,98,108,111,99,107,32,116,114,97,110,115,102,111,114,109,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
++.previous
+ .type sha512_block_data_order_avx,@function
+ .align        64
+ sha512_block_data_order_avx:

Reply via email to