diff options
| author | Frédéric Desbiens <[email protected]> | 2026-08-15 16:58:59 -0400 |
|---|---|---|
| committer | GitHub <[email protected]> | 2026-08-15 16:58:59 -0400 |
| commit | 358e7a9ea537dff49d970c8b684eef229f40bc53 (patch) | |
| tree | 5726f42ad3ecbb3922854e882b68143895beda0d | |
| parent | 20d4b977f204651075d08695d841c787ac69c636 (diff) | |
Stopped the remaining example scripts naming archives that were deleted (#620)
#618 fixed the arm9 and arm11 shell scripts, but not their .bat counterparts,
and did not look at cortex_r4 and cortex_r5 at all. An audit of every build
script against the files actually present in its directory found the rest.
The .bat scripts for arm9, arm11, cortex_r4 and cortex_r5 still linked libc.a,
libgcc.a and, for arm11, libnosys.a from their own example_build directories,
and the cortex_r4 and cortex_r5 shell scripts did too. Those archives went in
6.1.10 under "Removal of unneeded files", so on Windows all four examples failed
exactly as the shell versions did before #618, and on Linux the two R-profile
ones still did.
Link through the compiler driver, as the other examples have since #594.
This does not make the examples link, and the change stops there deliberately.
All four now fail the same way,
undefined reference to `_fini'
because their linker scripts define the .init and .fini sections but not the
_init and _fini symbols, which live in crti.o and crtn.o and are omitted by
-nostartfiles. Reviving four very old cores is separate work.
Correct the comment on EXAMPLES_EXPECTED_TO_FAIL again. It had cortex_r4 and
cortex_r5 failing for want of newlib multilib variants; they do not. All four
share the single cause above, and the multilib explanation was wrong for the
R-profile pair just as it was for arm9 and arm11.
Verified by running each shell script: cortex_r4 and cortex_r5 fail on _fini
rather than on missing files, matching arm9 and arm11. The .bat changes mirror
link lines proven that way in the same directories; they cannot be run here.
Three scripts are left alone and reported instead, because a blind edit could not
be verified: ports_module/cortex_m3 and cortex_m4 have Windows-only .bat scripts
that also name sources which are absent or differ in case, and
ports_smp/mips32_interaptiv_smp needs a MIPS toolchain.
Assisted-by: Claude Code (Opus 5) <[email protected]>
7 files changed, 18 insertions, 13 deletions
diff --git a/ports/arm11/gnu/example_build/build_threadx_sample.bat b/ports/arm11/gnu/example_build/build_threadx_sample.bat index e67e3c20..1515eb27 100644 --- a/ports/arm11/gnu/example_build/build_threadx_sample.bat +++ b/ports/arm11/gnu/example_build/build_threadx_sample.bat @@ -2,5 +2,5 @@ arm-none-eabi-gcc -c -g -mcpu=arm1136j-s reset.S arm-none-eabi-gcc -c -g -mcpu=arm1136j-s crt0.S arm-none-eabi-gcc -c -g -mcpu=arm1136j-s tx_initialize_low_level.S arm-none-eabi-gcc -c -g -mcpu=arm1136j-s -I../../../../common/inc -I../inc sample_threadx.c -arm-none-eabi-ld -A arm1136j-s -T sample_threadx.ld reset.o crt0.o tx_initialize_low_level.o sample_threadx.o tx.a libc.a libnosys.a libgcc.a -o sample_threadx.out -M > sample_threadx.map +arm-none-eabi-gcc -g -nostartfiles -mcpu=arm1136j-s -T sample_threadx.ld --specs=nosys.specs -o sample_threadx.out -Wl,-Map=sample_threadx.map reset.o crt0.o tx_initialize_low_level.o sample_threadx.o tx.a diff --git a/ports/arm9/gnu/example_build/build_threadx_sample.bat b/ports/arm9/gnu/example_build/build_threadx_sample.bat index c35d2bc6..5c9347f4 100644 --- a/ports/arm9/gnu/example_build/build_threadx_sample.bat +++ b/ports/arm9/gnu/example_build/build_threadx_sample.bat @@ -2,5 +2,5 @@ arm-none-eabi-gcc -c -g -mcpu=arm9 reset.S arm-none-eabi-gcc -c -g -mcpu=arm9 crt0.S arm-none-eabi-gcc -c -g -mcpu=arm9 tx_initialize_low_level.S arm-none-eabi-gcc -c -g -mcpu=arm9 -I../../../../common/inc -I../inc sample_threadx.c -arm-none-eabi-ld -A arm9 -T sample_threadx.ld reset.o crt0.o tx_initialize_low_level.o sample_threadx.o tx.a libc.a libgcc.a -o sample_threadx.out -M > sample_threadx.map +arm-none-eabi-gcc -g -nostartfiles -mcpu=arm9 -T sample_threadx.ld --specs=nosys.specs -o sample_threadx.out -Wl,-Map=sample_threadx.map reset.o crt0.o tx_initialize_low_level.o sample_threadx.o tx.a diff --git a/ports/cortex_r4/gnu/example_build/build_threadx_sample.bat b/ports/cortex_r4/gnu/example_build/build_threadx_sample.bat index 517b6d62..72444e4b 100644 --- a/ports/cortex_r4/gnu/example_build/build_threadx_sample.bat +++ b/ports/cortex_r4/gnu/example_build/build_threadx_sample.bat @@ -2,5 +2,5 @@ arm-none-eabi-gcc -c -g -mcpu=cortex-r4 reset.S arm-none-eabi-gcc -c -g -mcpu=cortex-r4 crt0.S arm-none-eabi-gcc -c -g -mcpu=cortex-r4 tx_initialize_low_level.S arm-none-eabi-gcc -c -g -mcpu=cortex-r4 -I../../../../common/inc -I../inc sample_threadx.c -arm-none-eabi-ld -A cortex-r4 -T sample_threadx.ld reset.o crt0.o tx_initialize_low_level.o sample_threadx.o tx.a libc.a libgcc.a -o sample_threadx.out -M > sample_threadx.map +arm-none-eabi-gcc -g -nostartfiles -mcpu=cortex-r4 -T sample_threadx.ld --specs=nosys.specs -o sample_threadx.out -Wl,-Map=sample_threadx.map reset.o crt0.o tx_initialize_low_level.o sample_threadx.o tx.a diff --git a/ports/cortex_r4/gnu/example_build/build_threadx_sample.sh b/ports/cortex_r4/gnu/example_build/build_threadx_sample.sh index 0d8dbcd5..1f0e2709 100755 --- a/ports/cortex_r4/gnu/example_build/build_threadx_sample.sh +++ b/ports/cortex_r4/gnu/example_build/build_threadx_sample.sh @@ -61,5 +61,5 @@ esac "${CC}" ${TARGET_FLAGS} -c -g -mcpu=cortex-r4 crt0.S "${CC}" ${TARGET_FLAGS} -c -g -mcpu=cortex-r4 tx_initialize_low_level.S "${CC}" ${TARGET_FLAGS} -c -g -mcpu=cortex-r4 -I../../../../common/inc -I../inc sample_threadx.c -arm-none-eabi-ld -A cortex-r4 -T sample_threadx.ld reset.o crt0.o tx_initialize_low_level.o sample_threadx.o tx.a libc.a libgcc.a -o sample_threadx.out -M > sample_threadx.map +"${CC}" ${TARGET_FLAGS} -g -nostartfiles -mcpu=cortex-r4 -T sample_threadx.ld ${SYSCALL_LIB} -o sample_threadx.out -Wl,-Map=sample_threadx.map reset.o crt0.o tx_initialize_low_level.o sample_threadx.o tx.a diff --git a/ports/cortex_r5/gnu/example_build/build_threadx_sample.bat b/ports/cortex_r5/gnu/example_build/build_threadx_sample.bat index 2ded427d..f2de17cd 100644 --- a/ports/cortex_r5/gnu/example_build/build_threadx_sample.bat +++ b/ports/cortex_r5/gnu/example_build/build_threadx_sample.bat @@ -2,5 +2,5 @@ arm-none-eabi-gcc -c -g -mcpu=cortex-r5 reset.S arm-none-eabi-gcc -c -g -mcpu=cortex-r5 crt0.S arm-none-eabi-gcc -c -g -mcpu=cortex-r5 tx_initialize_low_level.S arm-none-eabi-gcc -c -g -mcpu=cortex-r5 -I../../../../common/inc -I../inc sample_threadx.c -arm-none-eabi-ld -A cortex-r5 -T sample_threadx.ld reset.o crt0.o tx_initialize_low_level.o sample_threadx.o tx.a libc.a libgcc.a -o sample_threadx.out -M > sample_threadx.map +arm-none-eabi-gcc -g -nostartfiles -mcpu=cortex-r5 -T sample_threadx.ld --specs=nosys.specs -o sample_threadx.out -Wl,-Map=sample_threadx.map reset.o crt0.o tx_initialize_low_level.o sample_threadx.o tx.a diff --git a/ports/cortex_r5/gnu/example_build/build_threadx_sample.sh b/ports/cortex_r5/gnu/example_build/build_threadx_sample.sh index e3e133d6..2b3e4d55 100755 --- a/ports/cortex_r5/gnu/example_build/build_threadx_sample.sh +++ b/ports/cortex_r5/gnu/example_build/build_threadx_sample.sh @@ -61,5 +61,5 @@ esac "${CC}" ${TARGET_FLAGS} -c -g -mcpu=cortex-r5 crt0.S "${CC}" ${TARGET_FLAGS} -c -g -mcpu=cortex-r5 tx_initialize_low_level.S "${CC}" ${TARGET_FLAGS} -c -g -mcpu=cortex-r5 -I../../../../common/inc -I../inc sample_threadx.c -arm-none-eabi-ld -A cortex-r5 -T sample_threadx.ld reset.o crt0.o tx_initialize_low_level.o sample_threadx.o tx.a libc.a libgcc.a -o sample_threadx.out -M > sample_threadx.map +"${CC}" ${TARGET_FLAGS} -g -nostartfiles -mcpu=cortex-r5 -T sample_threadx.ld ${SYSCALL_LIB} -o sample_threadx.out -Wl,-Map=sample_threadx.map reset.o crt0.o tx_initialize_low_level.o sample_threadx.o tx.a diff --git a/scripts/check_clang.sh b/scripts/check_clang.sh index 3c4faee3..5f13c491 100755 --- a/scripts/check_clang.sh +++ b/scripts/check_clang.sh @@ -188,13 +188,18 @@ CMAKE_EXAMPLE_CORES="cortex_r52" # their port directory, which covers both ports/ and ports_smp/. Listed # explicitly rather than silently skipped, so the gaps stay visible. # -# These fail with the GNU toolchain too, so they are not LLVM problems: -# arm9 arm11 their linker scripts do not define _init and _fini. -# Those symbols come from crti.o and crtn.o, which -# -nostartfiles leaves out, so newlib's fini.c fails to -# link. Reproduced with arm-none-eabi-gcc 13.2.1. -# cortex_r4 cortex_r5 need newlib multilib variants for those CPUs, which are -# not present in every GNU toolchain packaging. +# These fail with the GNU toolchain too, so they are not LLVM problems. All four +# fail the same way, for the same reason: +# +# their linker scripts define the .init and .fini sections but not the _init +# and _fini symbols. Those come from crti.o and crtn.o, which -nostartfiles +# leaves out, so newlib's fini.c cannot resolve them and the link ends with +# "undefined reference to `_fini'". Reproduced with arm-none-eabi-gcc 13.2.1. +# +# Until 6.1.10 the four linked libc.a and libgcc.a checked in beside them, which +# supplied those symbols. That sweep removed the archives without updating the +# link lines, so for years the examples failed earlier still, on the missing +# files themselves. Fixing the link lines exposed the _fini gap underneath. EXAMPLES_EXPECTED_TO_FAIL="arm9 arm11 cortex_r4 cortex_r5" failures=0 |
