Skip to content

Commit d0f957a

Browse files
Haiyue Wangxiaoxiang781216
authored andcommitted
qemu-intel64: Fixes the linker 'noexecstack' warning
Fix the linker warning based on these two commits: ld: warning: fork.o: missing .note.GNU-stack section implies executable stack ld: NOTE: This behaviour is deprecated and will be removed in a future version of the linker commit 36ac812 ("sim: Fixes the following linker warning:"), commit b5d640a ("fix Cygwin/MSYS2 ld: unrecognized option '-z'")
1 parent da1ff4c commit d0f957a

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

arch/x86_64/src/cmake/Toolchain.cmake

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,10 @@ if(CONFIG_DEBUG_SYMBOLS)
8383
add_compile_options(${CONFIG_DEBUG_SYMBOLS_LEVEL})
8484
endif()
8585

86+
if(CONFIG_HOST_LINUX)
87+
add_link_options(-Wl,-z,noexecstack)
88+
endif()
89+
8690
# Architecture flags
8791

8892
add_link_options(-Wl,--entry=__pmode_entry)

arch/x86_64/src/common/Toolchain.defs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,10 @@ ifeq ($(CONFIG_DEBUG_LINK_WHOLE_ARCHIVE),y)
106106
LDFLAGS += --whole-archive
107107
endif
108108

109+
ifeq ($(CONFIG_HOST_LINUX),y)
110+
LDFLAGS += -z noexecstack
111+
endif
112+
109113
ifeq ($(CONFIG_LIBCXX),y)
110114
# Linux C++ ABI seems vary.
111115
# Probably __GLIBCXX__ is the best bet.

0 commit comments

Comments
 (0)