[llvm] 182ab1c - [Support] Adjust .note.GNU-stack guard in Support/BLAKE3/blake3_*_x86-64_unix.S (#76229)

via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 24 05:33:49 PST 2024


Author: Rainer Orth
Date: 2024-01-24T14:33:45+01:00
New Revision: 182ab1c7034b951433fb8831b67e7758fe61d4e8

URL: https://github.com/llvm/llvm-project/commit/182ab1c7034b951433fb8831b67e7758fe61d4e8
DIFF: https://github.com/llvm/llvm-project/commit/182ab1c7034b951433fb8831b67e7758fe61d4e8.diff

LOG: [Support] Adjust .note.GNU-stack guard in Support/BLAKE3/blake3_*_x86-64_unix.S (#76229)

When using GNU ld 2.41 on FreeBSD 14.0/amd64, there are linker warnings
like
```
/vol/gcc/bin/gld-2.41: warning: blake3_avx512_x86-64_unix.S.o: missing .note.GNU-stack section implies executable stack
/vol/gcc/bin/gld-2.41: NOTE: This behaviour is deprecated and will be removed in a future version of the linker
```
This can be fixed by adjusting the guard of the `.note.GNU-stack`
sections in `blake3_*_x86-64_unix.S` to match `llvm/lib/MC/MCAsmInfoELF.cpp:MCAsmInfoELF::getNonexecutableStackSection` which emits the section on all ELF targets
but Solaris.

Tested on `amd64-pc-freebsd14.0`.

Added: 
    

Modified: 
    llvm/lib/Support/BLAKE3/blake3_avx2_x86-64_unix.S
    llvm/lib/Support/BLAKE3/blake3_avx512_x86-64_unix.S
    llvm/lib/Support/BLAKE3/blake3_sse2_x86-64_unix.S
    llvm/lib/Support/BLAKE3/blake3_sse41_x86-64_unix.S

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Support/BLAKE3/blake3_avx2_x86-64_unix.S b/llvm/lib/Support/BLAKE3/blake3_avx2_x86-64_unix.S
index 69fc0936d73c567..e98893c7ef8b8f5 100644
--- a/llvm/lib/Support/BLAKE3/blake3_avx2_x86-64_unix.S
+++ b/llvm/lib/Support/BLAKE3/blake3_avx2_x86-64_unix.S
@@ -2,7 +2,7 @@
 
 #include "llvm_blake3_prefix.h"
 
-#if defined(__ELF__) && defined(__linux__)
+#if defined(__ELF__) && !(defined(__sun__) && defined(__svr4__))
 .section .note.GNU-stack,"",%progbits
 #endif
 

diff  --git a/llvm/lib/Support/BLAKE3/blake3_avx512_x86-64_unix.S b/llvm/lib/Support/BLAKE3/blake3_avx512_x86-64_unix.S
index f04a135dd1bc48e..224605147c3d7dd 100644
--- a/llvm/lib/Support/BLAKE3/blake3_avx512_x86-64_unix.S
+++ b/llvm/lib/Support/BLAKE3/blake3_avx512_x86-64_unix.S
@@ -2,7 +2,7 @@
 
 #include "llvm_blake3_prefix.h"
 
-#if defined(__ELF__) && defined(__linux__)
+#if defined(__ELF__) && !(defined(__sun__) && defined(__svr4__))
 .section .note.GNU-stack,"",%progbits
 #endif
 

diff  --git a/llvm/lib/Support/BLAKE3/blake3_sse2_x86-64_unix.S b/llvm/lib/Support/BLAKE3/blake3_sse2_x86-64_unix.S
index 9a4f5eb7318bf97..d69a1706fefe77f 100644
--- a/llvm/lib/Support/BLAKE3/blake3_sse2_x86-64_unix.S
+++ b/llvm/lib/Support/BLAKE3/blake3_sse2_x86-64_unix.S
@@ -2,7 +2,7 @@
 
 #include "llvm_blake3_prefix.h"
 
-#if defined(__ELF__) && defined(__linux__)
+#if defined(__ELF__) && !(defined(__sun__) && defined(__svr4__))
 .section .note.GNU-stack,"",%progbits
 #endif
 

diff  --git a/llvm/lib/Support/BLAKE3/blake3_sse41_x86-64_unix.S b/llvm/lib/Support/BLAKE3/blake3_sse41_x86-64_unix.S
index 1be4ed744426b0b..c5b103af61c4fdc 100644
--- a/llvm/lib/Support/BLAKE3/blake3_sse41_x86-64_unix.S
+++ b/llvm/lib/Support/BLAKE3/blake3_sse41_x86-64_unix.S
@@ -2,7 +2,7 @@
 
 #include "llvm_blake3_prefix.h"
 
-#if defined(__ELF__) && defined(__linux__)
+#if defined(__ELF__) && !(defined(__sun__) && defined(__svr4__))
 .section .note.GNU-stack,"",%progbits
 #endif
 


        


More information about the llvm-commits mailing list