[llvm] [Support] Adjust .note.GNU-stack guard in Support/BLAKE3/blake3_*_x86… (PR #76229)

Rainer Orth via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 22 02:44:34 PST 2023


https://github.com/rorth created https://github.com/llvm/llvm-project/pull/76229

…-64_unix.S

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 other instances.

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

>From 70b35e17bfdc5a5fced2a06fc97b982a7a850cdf Mon Sep 17 00:00:00 2001
From: Rainer Orth <ro at gcc.gnu.org>
Date: Fri, 22 Dec 2023 10:52:13 +0100
Subject: [PATCH] [Support] Adjust .note.GNU-stack guard in
 Support/BLAKE3/blake3_*_x86-64_unix.S

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 other instances.

Tested on `amd64-pc-freebsd14.0`.
---
 llvm/lib/Support/BLAKE3/blake3_avx2_x86-64_unix.S   | 2 +-
 llvm/lib/Support/BLAKE3/blake3_avx512_x86-64_unix.S | 2 +-
 llvm/lib/Support/BLAKE3/blake3_sse2_x86-64_unix.S   | 2 +-
 llvm/lib/Support/BLAKE3/blake3_sse41_x86-64_unix.S  | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

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 69fc0936d73c56..a1210f98d5fa99 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(__linux__) || defined(__FreeBSD__) || defined(__Fuchsia__))
 .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 f04a135dd1bc48..877359de93c085 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(__linux__) || defined(__FreeBSD__) || defined(__Fuchsia__))
 .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 9a4f5eb7318bf9..bd8cb8e888e6fe 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(__linux__) || defined(__FreeBSD__) || defined(__Fuchsia__))
 .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 1be4ed744426b0..b273047630883a 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(__linux__) || defined(__FreeBSD__) || defined(__Fuchsia__))
 .section .note.GNU-stack,"",%progbits
 #endif
 



More information about the llvm-commits mailing list