-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[Support] Adjust .note.GNU-stack guard in Support/BLAKE3/blake3_*_x86… #76229
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…-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/pr-subscribers-llvm-support Author: Rainer Orth (rorth) Changes…-64_unix.S When using GNU ld 2.41 on FreeBSD 14.0/amd64, there are linker warnings like
This can be fixed by adjusting the guard of the Tested on Full diff: https://github.com/llvm/llvm-project/pull/76229.diff 4 Files Affected:
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
|
@@ -2,7 +2,7 @@ | |||
|
|||
#include "llvm_blake3_prefix.h" | |||
|
|||
#if defined(__ELF__) && defined(__linux__) | |||
#if defined(__ELF__) && (defined(__linux__) || defined(__FreeBSD__) || defined(__Fuchsia__)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be defined for all ELF OSes except possibly Solaris which may use an alternative section syntax.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Solaris issue is not the different section syntax (which would only apply on SPARC if clang
supported /usr/bin/as
as external assembler, which it doesn't), but the fact that Solaris doesn't care about .note.GNU-stack
at all (cf. llvm/lib/MC/MCAsmInfoELF.cpp:MCAsmInfoELF::getNonexecutableStackSection
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've now changed the guards to match MCAsmInfoELF::getNonexecutableStackSection
. While we are consistent here now, the guards in BLAKE3
differ from every other instance in the LLVM codebase.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I forgot: tested on amd64-pc-freebsd14.0
and amd64-pc-solaris2.11
.
MCAsmInfoELF::getNonexecutableStackSection.
Ping? It's been two weeks. |
Did you propose this to https://github.com/BLAKE3-team/BLAKE3/tree/master/c ? The next upgrader will likely notice this local change. |
Not yet: I'd seen that there were many patches local to LLVM that seemed not to have gone upstream. I'll give it a try. |
…-64_unix.S
When using GNU ld 2.41 on FreeBSD 14.0/amd64, there are linker warnings like
This can be fixed by adjusting the guard of the
.note.GNU-stack
sections inblake3_*_x86-64_unix.S
to match other instances.Tested on
amd64-pc-freebsd14.0
.