Skip to content

Commit

Permalink
qemu-intel64: Fixes the linker 'noexecstack' warning
Browse files Browse the repository at this point in the history
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'")
  • Loading branch information
haiyuewa authored and xiaoxiang781216 committed Oct 26, 2024
1 parent da1ff4c commit d0f957a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions arch/x86_64/src/cmake/Toolchain.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ if(CONFIG_DEBUG_SYMBOLS)
add_compile_options(${CONFIG_DEBUG_SYMBOLS_LEVEL})
endif()

if(CONFIG_HOST_LINUX)
add_link_options(-Wl,-z,noexecstack)
endif()

# Architecture flags

add_link_options(-Wl,--entry=__pmode_entry)
Expand Down
4 changes: 4 additions & 0 deletions arch/x86_64/src/common/Toolchain.defs
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,10 @@ ifeq ($(CONFIG_DEBUG_LINK_WHOLE_ARCHIVE),y)
LDFLAGS += --whole-archive
endif

ifeq ($(CONFIG_HOST_LINUX),y)
LDFLAGS += -z noexecstack
endif

ifeq ($(CONFIG_LIBCXX),y)
# Linux C++ ABI seems vary.
# Probably __GLIBCXX__ is the best bet.
Expand Down

0 comments on commit d0f957a

Please sign in to comment.