Repository navigation
boards: Remove the ELF and module flags that replace the arch values. - #20844
Merged
Merged
Conversation
The arch Toolchain.defs sets CELFFLAGS, CXXELFFLAGS, LDELFFLAGS, CMODULEFLAGS and LDMODULEFLAGS. 22 boards set them again with "=" after they include it, with old values: - 14 boards link an ELF program with a linker script that does not exist (binfmt/elf/gnu-elf.ld or binfmt/libelf/gnu-elf.ld). - The ELF programs link without crt0.o, with the entry point main and without -fvisibility=hidden, and they do not get the options that the arch adds for CONFIG_PIC, CONFIG_FDPIC and CONFIG_BINFMT_ELF_EXECUTABLE. - The module lines repeat the arch values without -fvisibility=hidden and with "-e module_initialize". The entry point has no effect: the loader calls a module through its init_array. Remove these lines, so that the boards use the arch values. esp32c6-devkitc and esp32c6-xiao keep -melf32lriscv with "+=", as esp32c6-devkitm does. esp32c3-legacy-devkit-rust-1 set LDMODULEFLAGS to -melf32lriscv with "=", which removed -r and the linker script; it now adds the option with "+=". Assisted-by: Claude Code:claude-opus-5-5 Signed-off-by: Marco Casaroli <marco.casaroli@gmail.com>
The notes of the elf, posix_spawn, module and sotest examples told the board to set CELFFLAGS, LDELFFLAGS, CMODULEFLAGS and LDMODULEFLAGS with "=", with the entry point main and with linker scripts that do not exist. The arch Toolchain.defs sets these flags. Say that a board can add an option with "+=", and that it must not set them again. Assisted-by: Claude Code:claude-opus-5-5 Signed-off-by: Marco Casaroli <marco.casaroli@gmail.com>
|
xiaoxiang781216
approved these changes
Oct 21, 2026
xiaoxiang781216
approved these changes
Oct 21, 2026
jerpelea
approved these changes
Oct 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The arch
Toolchain.defssetsCELFFLAGS,CXXELFFLAGS,LDELFFLAGS,CMODULEFLAGSandLDMODULEFLAGS. 22 boards set them again with=after they include it, with old copies of these values.binfmt/elf/gnu-elf.ldorbinfmt/libelf/gnu-elf.ld), soCONFIG_ELFdoes not build on them.crt0.o, with the entry pointmainand without-fvisibility=hidden, and they do not get the options that the arch adds forCONFIG_PIC,CONFIG_FDPICandCONFIG_BINFMT_ELF_EXECUTABLE.-fvisibility=hiddenand with-e module_initialize. The entry point has no effect:libelf_insert()calls a module through itsinit_array.This PR removes these lines, so the boards use the arch values. esp32c6-devkitc and esp32c6-xiao keep
-melf32lriscvwith+=, as esp32c6-devkitm does. esp32c3-legacy-devkit-rust-1 setLDMODULEFLAGS = -melf32lriscv, which removed-rand the linker script; it now uses+=.After this PR, an option that the arch
Toolchain.defsadds reaches every board of the arch (asked for in apache/nuttx-apps#3882, apache/nuttx-apps#3884 and apache/nuttx-apps#3886).The second commit updates the notes of the elf, posix_spawn, module and sotest examples. They told the board to set these flags with
=, with the entry pointmainand with linker scripts that do not exist.Impact
CONFIG_ELForCONFIG_MODULE(sama5d3-xplained:knshhas its ownconfigs/knsh/Make.defs,samv71-xult:moduleusesscripts/Make.defs, which this PR does not change).Toolchain.defs, so the board file is the only definition.Testing
For each of the 22 boards, one defconfig, configured on master and on this branch, with the six variables printed from the configured
Make.defs:LDELFFLAGSbinfmt/elf/gnu-elf.ldorbinfmt/libelf/gnu-elf.ld, missinglibs/libc/elf/gnu-elf.ldcrt0.o,-e main, no-fvisibility=hidden)nucleo-h743zi:nsh,esp32s3-devkit:nsh,esp32c6-devkitm:nsh)Build with ELF programs:
openh743i:nshplus the ELF options ofnucleo-h743zi:elf(CONFIG_ELF,CONFIG_EXAMPLES_ELF,CONFIG_FS_ROMFS,CONFIG_NSH_FILE_APPS, the symbol table options), Arm GNU 15.3:makearm-none-eabi-ld: cannot open linker script file .../binfmt/elf/gnu-elf.ld: No such file or directorycrt0.o -e _start -T .../libs/libc/elf/gnu-elf.ldtools/checkpatch.sh -c -u -m -gpasses.