]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
RISC-V: Emit .note.GNU-stack for non-linux target as well
authorKito Cheng <kito.cheng@sifive.com>
Wed, 30 Aug 2023 07:10:44 +0000 (15:10 +0800)
committerKito Cheng <kito.cheng@sifive.com>
Tue, 5 Sep 2023 12:12:22 +0000 (20:12 +0800)
We only emit that on linux target before, that not problem before,
however Qemu has fix a bug to make qemu user mode honor PT_GNU_STACK[1],
that will cause problem when we test baremetal with qemu.

So the straightforward is enable that as well for non-linux toolchian,
the price is that will increase few bytes for each binary.

[1] https://github.com/qemu/qemu/commit/872f3d046f2381e3f416519e82df96bd60818311

gcc/ChangeLog:

* config/riscv/linux.h (TARGET_ASM_FILE_END): Move ...
* config/riscv/riscv.cc (TARGET_ASM_FILE_END): to here.

gcc/config/riscv/linux.h
gcc/config/riscv/riscv.cc

index 3e625e0f8676bcb7b874090ed67a603ab7b07710..7323ff30f70304e8586dbdc0dafdb1b4586c2270 100644 (file)
@@ -59,8 +59,6 @@ along with GCC; see the file COPYING3.  If not see
       -dynamic-linker " GNU_USER_DYNAMIC_LINKER "} \
     %{static:-static}}"
 
-#define TARGET_ASM_FILE_END file_end_indicate_exec_stack
-
 #define STARTFILE_PREFIX_SPEC                  \
    "/lib" XLEN_SPEC "/" ABI_SPEC "/ "          \
    "/usr/lib" XLEN_SPEC "/" ABI_SPEC "/ "      \
index 8d8f7b4f16ed6b9d2e465f130885f3161219d636..2db9c81ac8b0df14e524fe3cb9cec4f6ad93449c 100644 (file)
@@ -9109,6 +9109,8 @@ riscv_vectorize_create_costs (vec_info *vinfo, bool costing_for_scalar)
 #define TARGET_ASM_FILE_START riscv_file_start
 #undef TARGET_ASM_FILE_START_FILE_DIRECTIVE
 #define TARGET_ASM_FILE_START_FILE_DIRECTIVE true
+#undef TARGET_ASM_FILE_END
+#define TARGET_ASM_FILE_END file_end_indicate_exec_stack
 
 #undef TARGET_EXPAND_BUILTIN_VA_START
 #define TARGET_EXPAND_BUILTIN_VA_START riscv_va_start