mirror of
https://github.com/apache/nuttx.git
synced 2026-10-07 22:35:22 +00:00
arch/arm: Pass --fdpic to the assembler for an FDPIC module.
GCC before 14 does not pass --fdpic to the assembler when it compiles with -mfdpic. The assembler then rejects every FDPIC relocation with "Relocation supported only in FDPIC mode". The NuttX CI image has GCC 13.2, so the crt0.o of an FDPIC configuration does not build there. Pass -Wa,--fdpic with -mfdpic, in the make build and the CMake build. A newer GCC passes the same option itself. Assisted-by: Claude Code:claude-opus-5-5 Signed-off-by: Marco Casaroli <marco.casaroli@gmail.com>
This commit is contained in:
parent
1a18646375
commit
00e51b847a
2 changed files with 12 additions and 6 deletions
|
|
@ -56,14 +56,17 @@ if(CONFIG_FDPIC)
|
|||
"${FDPIC_LD}"
|
||||
CACHE INTERNAL "Linker for FDPIC modules")
|
||||
|
||||
nuttx_elf_compile_options(-mfdpic -fPIC -Wa,--noexecstack)
|
||||
# GCC before 14 does not pass --fdpic to the assembler for -mfdpic, and the
|
||||
# assembler then rejects the FDPIC relocations, so pass it here.
|
||||
|
||||
nuttx_elf_compile_options(-mfdpic -fPIC -Wa,--noexecstack -Wa,--fdpic)
|
||||
|
||||
nuttx_elf_link_options(-m armelf_linux_fdpiceabi -shared -z now)
|
||||
|
||||
# A shared library is an FDPIC shared object too, as LDMODULEFLAGS makes it in
|
||||
# common/Toolchain.defs
|
||||
|
||||
nuttx_mod_compile_options(-mfdpic -fPIC -Wa,--noexecstack)
|
||||
nuttx_mod_compile_options(-mfdpic -fPIC -Wa,--noexecstack -Wa,--fdpic)
|
||||
|
||||
nuttx_mod_link_options(-m armelf_linux_fdpiceabi -shared -z now)
|
||||
|
||||
|
|
|
|||
|
|
@ -684,8 +684,11 @@ ifeq ($(CONFIG_FDPIC),y)
|
|||
MODULELD = $(SHELL) -c 'echo "ERROR: $(FDPIC_NO_LD_MSG)" 1>&2; exit 1' --
|
||||
endif
|
||||
|
||||
CELFFLAGS += -mfdpic -fPIC -Wa,--noexecstack
|
||||
CXXELFFLAGS += -mfdpic -fPIC -Wa,--noexecstack
|
||||
# GCC before 14 does not pass --fdpic to the assembler for -mfdpic, and the
|
||||
# assembler then rejects the FDPIC relocations, so pass it here.
|
||||
|
||||
CELFFLAGS += -mfdpic -fPIC -Wa,--noexecstack -Wa,--fdpic
|
||||
CXXELFFLAGS += -mfdpic -fPIC -Wa,--noexecstack -Wa,--fdpic
|
||||
|
||||
LDELFFLAGS += -m armelf_linux_fdpiceabi -shared -z now
|
||||
|
||||
|
|
@ -697,8 +700,8 @@ ifeq ($(CONFIG_FDPIC),y)
|
|||
# The entry point is left to the caller: a module is entered at _start,
|
||||
# a library is only called into.
|
||||
|
||||
CMODULEFLAGS += -mfdpic -fPIC -Wa,--noexecstack
|
||||
CXXMODULEFLAGS += -mfdpic -fPIC -Wa,--noexecstack
|
||||
CMODULEFLAGS += -mfdpic -fPIC -Wa,--noexecstack -Wa,--fdpic
|
||||
CXXMODULEFLAGS += -mfdpic -fPIC -Wa,--noexecstack -Wa,--fdpic
|
||||
|
||||
LDMODULEFLAGS = -m armelf_linux_fdpiceabi -shared -z now \
|
||||
-T $(call CONVERT_PATH,$(TOPDIR)/libs/libc/elf/gnu-elf.ld)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue