casaroli opened a new pull request, #20844:
URL: https://github.com/apache/nuttx/pull/20844

   ## Summary
   
   The arch `Toolchain.defs` sets `CELFFLAGS`, `CXXELFFLAGS`, `LDELFFLAGS`, 
`CMODULEFLAGS` and `LDMODULEFLAGS`. 22 boards set them again with `=` after 
they include it, with old copies of these 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`), so `CONFIG_ELF` does 
not build on them.
   - Their 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: `libelf_insert()` 
calls a module through its `init_array`.
   
   This PR removes these lines, so 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 = 
-melf32lriscv`, which removed `-r` and the linker script; it now uses `+=`.
   
   After this PR, an option that the arch `Toolchain.defs` adds 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 point `main` and with linker scripts that do not exist.
   
   ## Impact
   
   - The 22 boards get the same ELF and module flags as the other boards of 
their arch.
   - No CI defconfig of these boards uses the changed lines with `CONFIG_ELF` 
or `CONFIG_MODULE` (`sama5d3-xplained:knsh` has its own 
`configs/knsh/Make.defs`, `samv71-xult:module` uses `scripts/Make.defs`, which 
this PR does not change).
   - sim and the rx65n boards keep their lines: their arch has no 
`Toolchain.defs`, so the board file is the only definition.
   - No code change. The documentation is updated in this PR.
   
   ## 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`:
   
   | | master | this PR |
   |---|---|---|
   | 14 boards: linker script in `LDELFFLAGS` | `binfmt/elf/gnu-elf.ld` or 
`binfmt/libelf/gnu-elf.ld`, missing | `libs/libc/elf/gnu-elf.ld` |
   | all 22 boards | old copies (no `crt0.o`, `-e main`, no 
`-fvisibility=hidden`) | the same values as a board of the same arch without 
these lines (`nucleo-h743zi:nsh`, `esp32s3-devkit:nsh`, `esp32c6-devkitm:nsh`) |
   
   Build with ELF programs: `openh743i:nsh` plus the ELF options of 
`nucleo-h743zi:elf` (`CONFIG_ELF`, `CONFIG_EXAMPLES_ELF`, `CONFIG_FS_ROMFS`, 
`CONFIG_NSH_FILE_APPS`, the symbol table options), Arm GNU 15.3:
   
   | | master | this PR |
   |---|---|---|
   | `make` | `arm-none-eabi-ld: cannot open linker script file 
.../binfmt/elf/gnu-elf.ld: No such file or directory` | builds without 
warnings; the 10 test programs link with `crt0.o -e _start -T 
.../libs/libc/elf/gnu-elf.ld` |
   
   `tools/checkpatch.sh -c -u -m -g` passes.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to