Fixed the AArch64 samples, none of which had ever linked with GCC (#673)

Every AArch64 gnu example build failed at the sample link, all 27 of them --
13 under ports/ and 14 under ports_smp/:

  libg.a(libc_a-init.o): in function `__libc_init_array':
      undefined reference to `_init'
      relocation truncated to fit: R_AARCH64_CALL26 against undefined
          symbol `_init'
  libg.a(libc_a-fini.o): in function `__libc_fini_array':
      undefined reference to `_fini'

build_threadx_sample.sh links with -nostartfiles, which is correct for a port
carrying its own reset path, and that drops crti.o and crtn.o along with
everything else. startup.S calls __libc_init_array by design, and newlib's
implementation calls _init, which crti.o is what defines. The AArch32 scripts
are unaffected: they use nosys.specs and never reach __libc_init_array.

The fix links crti.o and crtn.o explicitly, bracketing the object list -- the
first must precede every .init contribution and the second must follow all of
them, so their position is load-bearing rather than stylistic. Both paths come
from the compiler's own -print-file-name, so nothing here hard-codes a
toolchain layout.

The atfe branch sets both to empty, deliberately: picolibc's __libc_init_array
does not call _init, those 27 images link today, and adding crti.o would change
a working link for no reason. That is also why check_clang.sh is green on these
and does not list them as expected to fail -- the LLVM path never reached the
gap, so nothing has ever linked them and failed.

Fixed in ports_arch/ARMv8-A/threadx/ports/gnu/example_build, which is the
single source for both the ports/ and ports_smp/ copies, then regenerated with
update.sh --port-sets tx,tx_smp. The 27 generated copies are in this commit
because ports_arch_check compares them.

Verified: all 27 link with arm-gnu-toolchain 14.3.rel1 aarch64-none-elf, where
0 of 27 did before; _init and _fini disassemble to the expected crti prologue
and crtn epilogue over a ret; check_clang.sh with ATfE 22.1.0 is still green on
all five stages, including the 42 script-driven example builds; check_ports.sh
is green including the reproducibility check.

No regression test: these are link-only example images that no host test
executes. What guards them is check_clang.sh's example stage today, and
check_gcc.sh's, which is the next change and is the reason this was found.

Assisted-by: Claude Code (Opus 5) <noreply@anthropic.com>
This commit is contained in:
Frédéric Desbiens
2026-08-28 09:26:12 -04:00
committed by GitHub
parent 9c32abb17d
commit 5b94bad6a2
28 changed files with 644 additions and 28 deletions
@@ -44,6 +44,23 @@ case "${TOOLCHAIN}" in
# initialise_monitor_handles that startup.S calls.
SYSCALL_LIB="--specs=rdimon.specs"
SEMIHOST_STUB=""
# crti.o defines _init and _fini; crtn.o closes them. The link below
# passes -nostartfiles, which is right for a port with its own reset
# path but also drops these two, and startup.S calls
# __libc_init_array, whose newlib implementation calls _init. Without
# them every AArch64 sample failed to link:
#
# libg.a(libc_a-init.o): in function `__libc_init_array':
# undefined reference to `_init'
# relocation truncated to fit: R_AARCH64_CALL26 against undefined
# symbol `_init'
#
# crti.o must precede every other .init contribution and crtn.o must
# follow all of them, which is why they bracket the object list rather
# than sitting with the other flags. The AArch32 scripts need none of
# this: they use nosys.specs and never reach __libc_init_array.
CRT_BEGIN="$("${CC}" -mcpu="${cpu}" -print-file-name=crti.o)"
CRT_END="$("${CC}" -mcpu="${cpu}" -print-file-name=crtn.o)"
;;
atfe)
CC="${ATFE_CLANG:-clang}"
@@ -52,6 +69,11 @@ case "${TOOLCHAIN}" in
# picolibc has no initialise_monitor_handles, and neither does the
# toolchain's semihosting library, so the weak stub stands in for it.
SEMIHOST_STUB="sample_threadx/semihost_stub.S"
# Deliberately empty. picolibc's __libc_init_array does not call _init,
# so these images link today and adding crti.o would change a working
# link for no reason.
CRT_BEGIN=""
CRT_END=""
;;
*)
echo "Unknown TOOLCHAIN '${TOOLCHAIN}'; expected gnu or atfe" >&2
@@ -80,7 +102,7 @@ done
"${CC}" ${TARGET_FLAGS} -g -mcpu="${cpu}" -nostartfiles \
-T sample_threadx/sample_threadx.ld ${SYSCALL_LIB} \
-o sample_threadx.out -Wl,-Map=sample_threadx.map \
${objects} tx.a
${CRT_BEGIN} ${objects} tx.a ${CRT_END}
rm -f ${objects}
@@ -44,6 +44,23 @@ case "${TOOLCHAIN}" in
# initialise_monitor_handles that startup.S calls.
SYSCALL_LIB="--specs=rdimon.specs"
SEMIHOST_STUB=""
# crti.o defines _init and _fini; crtn.o closes them. The link below
# passes -nostartfiles, which is right for a port with its own reset
# path but also drops these two, and startup.S calls
# __libc_init_array, whose newlib implementation calls _init. Without
# them every AArch64 sample failed to link:
#
# libg.a(libc_a-init.o): in function `__libc_init_array':
# undefined reference to `_init'
# relocation truncated to fit: R_AARCH64_CALL26 against undefined
# symbol `_init'
#
# crti.o must precede every other .init contribution and crtn.o must
# follow all of them, which is why they bracket the object list rather
# than sitting with the other flags. The AArch32 scripts need none of
# this: they use nosys.specs and never reach __libc_init_array.
CRT_BEGIN="$("${CC}" -mcpu="${cpu}" -print-file-name=crti.o)"
CRT_END="$("${CC}" -mcpu="${cpu}" -print-file-name=crtn.o)"
;;
atfe)
CC="${ATFE_CLANG:-clang}"
@@ -52,6 +69,11 @@ case "${TOOLCHAIN}" in
# picolibc has no initialise_monitor_handles, and neither does the
# toolchain's semihosting library, so the weak stub stands in for it.
SEMIHOST_STUB="sample_threadx/semihost_stub.S"
# Deliberately empty. picolibc's __libc_init_array does not call _init,
# so these images link today and adding crti.o would change a working
# link for no reason.
CRT_BEGIN=""
CRT_END=""
;;
*)
echo "Unknown TOOLCHAIN '${TOOLCHAIN}'; expected gnu or atfe" >&2
@@ -80,7 +102,7 @@ done
"${CC}" ${TARGET_FLAGS} -g -mcpu="${cpu}" -nostartfiles \
-T sample_threadx/sample_threadx.ld ${SYSCALL_LIB} \
-o sample_threadx.out -Wl,-Map=sample_threadx.map \
${objects} tx.a
${CRT_BEGIN} ${objects} tx.a ${CRT_END}
rm -f ${objects}
@@ -44,6 +44,23 @@ case "${TOOLCHAIN}" in
# initialise_monitor_handles that startup.S calls.
SYSCALL_LIB="--specs=rdimon.specs"
SEMIHOST_STUB=""
# crti.o defines _init and _fini; crtn.o closes them. The link below
# passes -nostartfiles, which is right for a port with its own reset
# path but also drops these two, and startup.S calls
# __libc_init_array, whose newlib implementation calls _init. Without
# them every AArch64 sample failed to link:
#
# libg.a(libc_a-init.o): in function `__libc_init_array':
# undefined reference to `_init'
# relocation truncated to fit: R_AARCH64_CALL26 against undefined
# symbol `_init'
#
# crti.o must precede every other .init contribution and crtn.o must
# follow all of them, which is why they bracket the object list rather
# than sitting with the other flags. The AArch32 scripts need none of
# this: they use nosys.specs and never reach __libc_init_array.
CRT_BEGIN="$("${CC}" -mcpu="${cpu}" -print-file-name=crti.o)"
CRT_END="$("${CC}" -mcpu="${cpu}" -print-file-name=crtn.o)"
;;
atfe)
CC="${ATFE_CLANG:-clang}"
@@ -52,6 +69,11 @@ case "${TOOLCHAIN}" in
# picolibc has no initialise_monitor_handles, and neither does the
# toolchain's semihosting library, so the weak stub stands in for it.
SEMIHOST_STUB="sample_threadx/semihost_stub.S"
# Deliberately empty. picolibc's __libc_init_array does not call _init,
# so these images link today and adding crti.o would change a working
# link for no reason.
CRT_BEGIN=""
CRT_END=""
;;
*)
echo "Unknown TOOLCHAIN '${TOOLCHAIN}'; expected gnu or atfe" >&2
@@ -80,7 +102,7 @@ done
"${CC}" ${TARGET_FLAGS} -g -mcpu="${cpu}" -nostartfiles \
-T sample_threadx/sample_threadx.ld ${SYSCALL_LIB} \
-o sample_threadx.out -Wl,-Map=sample_threadx.map \
${objects} tx.a
${CRT_BEGIN} ${objects} tx.a ${CRT_END}
rm -f ${objects}
@@ -44,6 +44,23 @@ case "${TOOLCHAIN}" in
# initialise_monitor_handles that startup.S calls.
SYSCALL_LIB="--specs=rdimon.specs"
SEMIHOST_STUB=""
# crti.o defines _init and _fini; crtn.o closes them. The link below
# passes -nostartfiles, which is right for a port with its own reset
# path but also drops these two, and startup.S calls
# __libc_init_array, whose newlib implementation calls _init. Without
# them every AArch64 sample failed to link:
#
# libg.a(libc_a-init.o): in function `__libc_init_array':
# undefined reference to `_init'
# relocation truncated to fit: R_AARCH64_CALL26 against undefined
# symbol `_init'
#
# crti.o must precede every other .init contribution and crtn.o must
# follow all of them, which is why they bracket the object list rather
# than sitting with the other flags. The AArch32 scripts need none of
# this: they use nosys.specs and never reach __libc_init_array.
CRT_BEGIN="$("${CC}" -mcpu="${cpu}" -print-file-name=crti.o)"
CRT_END="$("${CC}" -mcpu="${cpu}" -print-file-name=crtn.o)"
;;
atfe)
CC="${ATFE_CLANG:-clang}"
@@ -52,6 +69,11 @@ case "${TOOLCHAIN}" in
# picolibc has no initialise_monitor_handles, and neither does the
# toolchain's semihosting library, so the weak stub stands in for it.
SEMIHOST_STUB="sample_threadx/semihost_stub.S"
# Deliberately empty. picolibc's __libc_init_array does not call _init,
# so these images link today and adding crti.o would change a working
# link for no reason.
CRT_BEGIN=""
CRT_END=""
;;
*)
echo "Unknown TOOLCHAIN '${TOOLCHAIN}'; expected gnu or atfe" >&2
@@ -80,7 +102,7 @@ done
"${CC}" ${TARGET_FLAGS} -g -mcpu="${cpu}" -nostartfiles \
-T sample_threadx/sample_threadx.ld ${SYSCALL_LIB} \
-o sample_threadx.out -Wl,-Map=sample_threadx.map \
${objects} tx.a
${CRT_BEGIN} ${objects} tx.a ${CRT_END}
rm -f ${objects}
@@ -44,6 +44,23 @@ case "${TOOLCHAIN}" in
# initialise_monitor_handles that startup.S calls.
SYSCALL_LIB="--specs=rdimon.specs"
SEMIHOST_STUB=""
# crti.o defines _init and _fini; crtn.o closes them. The link below
# passes -nostartfiles, which is right for a port with its own reset
# path but also drops these two, and startup.S calls
# __libc_init_array, whose newlib implementation calls _init. Without
# them every AArch64 sample failed to link:
#
# libg.a(libc_a-init.o): in function `__libc_init_array':
# undefined reference to `_init'
# relocation truncated to fit: R_AARCH64_CALL26 against undefined
# symbol `_init'
#
# crti.o must precede every other .init contribution and crtn.o must
# follow all of them, which is why they bracket the object list rather
# than sitting with the other flags. The AArch32 scripts need none of
# this: they use nosys.specs and never reach __libc_init_array.
CRT_BEGIN="$("${CC}" -mcpu="${cpu}" -print-file-name=crti.o)"
CRT_END="$("${CC}" -mcpu="${cpu}" -print-file-name=crtn.o)"
;;
atfe)
CC="${ATFE_CLANG:-clang}"
@@ -52,6 +69,11 @@ case "${TOOLCHAIN}" in
# picolibc has no initialise_monitor_handles, and neither does the
# toolchain's semihosting library, so the weak stub stands in for it.
SEMIHOST_STUB="sample_threadx/semihost_stub.S"
# Deliberately empty. picolibc's __libc_init_array does not call _init,
# so these images link today and adding crti.o would change a working
# link for no reason.
CRT_BEGIN=""
CRT_END=""
;;
*)
echo "Unknown TOOLCHAIN '${TOOLCHAIN}'; expected gnu or atfe" >&2
@@ -80,7 +102,7 @@ done
"${CC}" ${TARGET_FLAGS} -g -mcpu="${cpu}" -nostartfiles \
-T sample_threadx/sample_threadx.ld ${SYSCALL_LIB} \
-o sample_threadx.out -Wl,-Map=sample_threadx.map \
${objects} tx.a
${CRT_BEGIN} ${objects} tx.a ${CRT_END}
rm -f ${objects}
@@ -44,6 +44,23 @@ case "${TOOLCHAIN}" in
# initialise_monitor_handles that startup.S calls.
SYSCALL_LIB="--specs=rdimon.specs"
SEMIHOST_STUB=""
# crti.o defines _init and _fini; crtn.o closes them. The link below
# passes -nostartfiles, which is right for a port with its own reset
# path but also drops these two, and startup.S calls
# __libc_init_array, whose newlib implementation calls _init. Without
# them every AArch64 sample failed to link:
#
# libg.a(libc_a-init.o): in function `__libc_init_array':
# undefined reference to `_init'
# relocation truncated to fit: R_AARCH64_CALL26 against undefined
# symbol `_init'
#
# crti.o must precede every other .init contribution and crtn.o must
# follow all of them, which is why they bracket the object list rather
# than sitting with the other flags. The AArch32 scripts need none of
# this: they use nosys.specs and never reach __libc_init_array.
CRT_BEGIN="$("${CC}" -mcpu="${cpu}" -print-file-name=crti.o)"
CRT_END="$("${CC}" -mcpu="${cpu}" -print-file-name=crtn.o)"
;;
atfe)
CC="${ATFE_CLANG:-clang}"
@@ -52,6 +69,11 @@ case "${TOOLCHAIN}" in
# picolibc has no initialise_monitor_handles, and neither does the
# toolchain's semihosting library, so the weak stub stands in for it.
SEMIHOST_STUB="sample_threadx/semihost_stub.S"
# Deliberately empty. picolibc's __libc_init_array does not call _init,
# so these images link today and adding crti.o would change a working
# link for no reason.
CRT_BEGIN=""
CRT_END=""
;;
*)
echo "Unknown TOOLCHAIN '${TOOLCHAIN}'; expected gnu or atfe" >&2
@@ -80,7 +102,7 @@ done
"${CC}" ${TARGET_FLAGS} -g -mcpu="${cpu}" -nostartfiles \
-T sample_threadx/sample_threadx.ld ${SYSCALL_LIB} \
-o sample_threadx.out -Wl,-Map=sample_threadx.map \
${objects} tx.a
${CRT_BEGIN} ${objects} tx.a ${CRT_END}
rm -f ${objects}
@@ -44,6 +44,23 @@ case "${TOOLCHAIN}" in
# initialise_monitor_handles that startup.S calls.
SYSCALL_LIB="--specs=rdimon.specs"
SEMIHOST_STUB=""
# crti.o defines _init and _fini; crtn.o closes them. The link below
# passes -nostartfiles, which is right for a port with its own reset
# path but also drops these two, and startup.S calls
# __libc_init_array, whose newlib implementation calls _init. Without
# them every AArch64 sample failed to link:
#
# libg.a(libc_a-init.o): in function `__libc_init_array':
# undefined reference to `_init'
# relocation truncated to fit: R_AARCH64_CALL26 against undefined
# symbol `_init'
#
# crti.o must precede every other .init contribution and crtn.o must
# follow all of them, which is why they bracket the object list rather
# than sitting with the other flags. The AArch32 scripts need none of
# this: they use nosys.specs and never reach __libc_init_array.
CRT_BEGIN="$("${CC}" -mcpu="${cpu}" -print-file-name=crti.o)"
CRT_END="$("${CC}" -mcpu="${cpu}" -print-file-name=crtn.o)"
;;
atfe)
CC="${ATFE_CLANG:-clang}"
@@ -52,6 +69,11 @@ case "${TOOLCHAIN}" in
# picolibc has no initialise_monitor_handles, and neither does the
# toolchain's semihosting library, so the weak stub stands in for it.
SEMIHOST_STUB="sample_threadx/semihost_stub.S"
# Deliberately empty. picolibc's __libc_init_array does not call _init,
# so these images link today and adding crti.o would change a working
# link for no reason.
CRT_BEGIN=""
CRT_END=""
;;
*)
echo "Unknown TOOLCHAIN '${TOOLCHAIN}'; expected gnu or atfe" >&2
@@ -80,7 +102,7 @@ done
"${CC}" ${TARGET_FLAGS} -g -mcpu="${cpu}" -nostartfiles \
-T sample_threadx/sample_threadx.ld ${SYSCALL_LIB} \
-o sample_threadx.out -Wl,-Map=sample_threadx.map \
${objects} tx.a
${CRT_BEGIN} ${objects} tx.a ${CRT_END}
rm -f ${objects}
@@ -44,6 +44,23 @@ case "${TOOLCHAIN}" in
# initialise_monitor_handles that startup.S calls.
SYSCALL_LIB="--specs=rdimon.specs"
SEMIHOST_STUB=""
# crti.o defines _init and _fini; crtn.o closes them. The link below
# passes -nostartfiles, which is right for a port with its own reset
# path but also drops these two, and startup.S calls
# __libc_init_array, whose newlib implementation calls _init. Without
# them every AArch64 sample failed to link:
#
# libg.a(libc_a-init.o): in function `__libc_init_array':
# undefined reference to `_init'
# relocation truncated to fit: R_AARCH64_CALL26 against undefined
# symbol `_init'
#
# crti.o must precede every other .init contribution and crtn.o must
# follow all of them, which is why they bracket the object list rather
# than sitting with the other flags. The AArch32 scripts need none of
# this: they use nosys.specs and never reach __libc_init_array.
CRT_BEGIN="$("${CC}" -mcpu="${cpu}" -print-file-name=crti.o)"
CRT_END="$("${CC}" -mcpu="${cpu}" -print-file-name=crtn.o)"
;;
atfe)
CC="${ATFE_CLANG:-clang}"
@@ -52,6 +69,11 @@ case "${TOOLCHAIN}" in
# picolibc has no initialise_monitor_handles, and neither does the
# toolchain's semihosting library, so the weak stub stands in for it.
SEMIHOST_STUB="sample_threadx/semihost_stub.S"
# Deliberately empty. picolibc's __libc_init_array does not call _init,
# so these images link today and adding crti.o would change a working
# link for no reason.
CRT_BEGIN=""
CRT_END=""
;;
*)
echo "Unknown TOOLCHAIN '${TOOLCHAIN}'; expected gnu or atfe" >&2
@@ -80,7 +102,7 @@ done
"${CC}" ${TARGET_FLAGS} -g -mcpu="${cpu}" -nostartfiles \
-T sample_threadx/sample_threadx.ld ${SYSCALL_LIB} \
-o sample_threadx.out -Wl,-Map=sample_threadx.map \
${objects} tx.a
${CRT_BEGIN} ${objects} tx.a ${CRT_END}
rm -f ${objects}
@@ -44,6 +44,23 @@ case "${TOOLCHAIN}" in
# initialise_monitor_handles that startup.S calls.
SYSCALL_LIB="--specs=rdimon.specs"
SEMIHOST_STUB=""
# crti.o defines _init and _fini; crtn.o closes them. The link below
# passes -nostartfiles, which is right for a port with its own reset
# path but also drops these two, and startup.S calls
# __libc_init_array, whose newlib implementation calls _init. Without
# them every AArch64 sample failed to link:
#
# libg.a(libc_a-init.o): in function `__libc_init_array':
# undefined reference to `_init'
# relocation truncated to fit: R_AARCH64_CALL26 against undefined
# symbol `_init'
#
# crti.o must precede every other .init contribution and crtn.o must
# follow all of them, which is why they bracket the object list rather
# than sitting with the other flags. The AArch32 scripts need none of
# this: they use nosys.specs and never reach __libc_init_array.
CRT_BEGIN="$("${CC}" -mcpu="${cpu}" -print-file-name=crti.o)"
CRT_END="$("${CC}" -mcpu="${cpu}" -print-file-name=crtn.o)"
;;
atfe)
CC="${ATFE_CLANG:-clang}"
@@ -52,6 +69,11 @@ case "${TOOLCHAIN}" in
# picolibc has no initialise_monitor_handles, and neither does the
# toolchain's semihosting library, so the weak stub stands in for it.
SEMIHOST_STUB="sample_threadx/semihost_stub.S"
# Deliberately empty. picolibc's __libc_init_array does not call _init,
# so these images link today and adding crti.o would change a working
# link for no reason.
CRT_BEGIN=""
CRT_END=""
;;
*)
echo "Unknown TOOLCHAIN '${TOOLCHAIN}'; expected gnu or atfe" >&2
@@ -80,7 +102,7 @@ done
"${CC}" ${TARGET_FLAGS} -g -mcpu="${cpu}" -nostartfiles \
-T sample_threadx/sample_threadx.ld ${SYSCALL_LIB} \
-o sample_threadx.out -Wl,-Map=sample_threadx.map \
${objects} tx.a
${CRT_BEGIN} ${objects} tx.a ${CRT_END}
rm -f ${objects}
@@ -44,6 +44,23 @@ case "${TOOLCHAIN}" in
# initialise_monitor_handles that startup.S calls.
SYSCALL_LIB="--specs=rdimon.specs"
SEMIHOST_STUB=""
# crti.o defines _init and _fini; crtn.o closes them. The link below
# passes -nostartfiles, which is right for a port with its own reset
# path but also drops these two, and startup.S calls
# __libc_init_array, whose newlib implementation calls _init. Without
# them every AArch64 sample failed to link:
#
# libg.a(libc_a-init.o): in function `__libc_init_array':
# undefined reference to `_init'
# relocation truncated to fit: R_AARCH64_CALL26 against undefined
# symbol `_init'
#
# crti.o must precede every other .init contribution and crtn.o must
# follow all of them, which is why they bracket the object list rather
# than sitting with the other flags. The AArch32 scripts need none of
# this: they use nosys.specs and never reach __libc_init_array.
CRT_BEGIN="$("${CC}" -mcpu="${cpu}" -print-file-name=crti.o)"
CRT_END="$("${CC}" -mcpu="${cpu}" -print-file-name=crtn.o)"
;;
atfe)
CC="${ATFE_CLANG:-clang}"
@@ -52,6 +69,11 @@ case "${TOOLCHAIN}" in
# picolibc has no initialise_monitor_handles, and neither does the
# toolchain's semihosting library, so the weak stub stands in for it.
SEMIHOST_STUB="sample_threadx/semihost_stub.S"
# Deliberately empty. picolibc's __libc_init_array does not call _init,
# so these images link today and adding crti.o would change a working
# link for no reason.
CRT_BEGIN=""
CRT_END=""
;;
*)
echo "Unknown TOOLCHAIN '${TOOLCHAIN}'; expected gnu or atfe" >&2
@@ -80,7 +102,7 @@ done
"${CC}" ${TARGET_FLAGS} -g -mcpu="${cpu}" -nostartfiles \
-T sample_threadx/sample_threadx.ld ${SYSCALL_LIB} \
-o sample_threadx.out -Wl,-Map=sample_threadx.map \
${objects} tx.a
${CRT_BEGIN} ${objects} tx.a ${CRT_END}
rm -f ${objects}
@@ -44,6 +44,23 @@ case "${TOOLCHAIN}" in
# initialise_monitor_handles that startup.S calls.
SYSCALL_LIB="--specs=rdimon.specs"
SEMIHOST_STUB=""
# crti.o defines _init and _fini; crtn.o closes them. The link below
# passes -nostartfiles, which is right for a port with its own reset
# path but also drops these two, and startup.S calls
# __libc_init_array, whose newlib implementation calls _init. Without
# them every AArch64 sample failed to link:
#
# libg.a(libc_a-init.o): in function `__libc_init_array':
# undefined reference to `_init'
# relocation truncated to fit: R_AARCH64_CALL26 against undefined
# symbol `_init'
#
# crti.o must precede every other .init contribution and crtn.o must
# follow all of them, which is why they bracket the object list rather
# than sitting with the other flags. The AArch32 scripts need none of
# this: they use nosys.specs and never reach __libc_init_array.
CRT_BEGIN="$("${CC}" -mcpu="${cpu}" -print-file-name=crti.o)"
CRT_END="$("${CC}" -mcpu="${cpu}" -print-file-name=crtn.o)"
;;
atfe)
CC="${ATFE_CLANG:-clang}"
@@ -52,6 +69,11 @@ case "${TOOLCHAIN}" in
# picolibc has no initialise_monitor_handles, and neither does the
# toolchain's semihosting library, so the weak stub stands in for it.
SEMIHOST_STUB="sample_threadx/semihost_stub.S"
# Deliberately empty. picolibc's __libc_init_array does not call _init,
# so these images link today and adding crti.o would change a working
# link for no reason.
CRT_BEGIN=""
CRT_END=""
;;
*)
echo "Unknown TOOLCHAIN '${TOOLCHAIN}'; expected gnu or atfe" >&2
@@ -80,7 +102,7 @@ done
"${CC}" ${TARGET_FLAGS} -g -mcpu="${cpu}" -nostartfiles \
-T sample_threadx/sample_threadx.ld ${SYSCALL_LIB} \
-o sample_threadx.out -Wl,-Map=sample_threadx.map \
${objects} tx.a
${CRT_BEGIN} ${objects} tx.a ${CRT_END}
rm -f ${objects}
@@ -44,6 +44,23 @@ case "${TOOLCHAIN}" in
# initialise_monitor_handles that startup.S calls.
SYSCALL_LIB="--specs=rdimon.specs"
SEMIHOST_STUB=""
# crti.o defines _init and _fini; crtn.o closes them. The link below
# passes -nostartfiles, which is right for a port with its own reset
# path but also drops these two, and startup.S calls
# __libc_init_array, whose newlib implementation calls _init. Without
# them every AArch64 sample failed to link:
#
# libg.a(libc_a-init.o): in function `__libc_init_array':
# undefined reference to `_init'
# relocation truncated to fit: R_AARCH64_CALL26 against undefined
# symbol `_init'
#
# crti.o must precede every other .init contribution and crtn.o must
# follow all of them, which is why they bracket the object list rather
# than sitting with the other flags. The AArch32 scripts need none of
# this: they use nosys.specs and never reach __libc_init_array.
CRT_BEGIN="$("${CC}" -mcpu="${cpu}" -print-file-name=crti.o)"
CRT_END="$("${CC}" -mcpu="${cpu}" -print-file-name=crtn.o)"
;;
atfe)
CC="${ATFE_CLANG:-clang}"
@@ -52,6 +69,11 @@ case "${TOOLCHAIN}" in
# picolibc has no initialise_monitor_handles, and neither does the
# toolchain's semihosting library, so the weak stub stands in for it.
SEMIHOST_STUB="sample_threadx/semihost_stub.S"
# Deliberately empty. picolibc's __libc_init_array does not call _init,
# so these images link today and adding crti.o would change a working
# link for no reason.
CRT_BEGIN=""
CRT_END=""
;;
*)
echo "Unknown TOOLCHAIN '${TOOLCHAIN}'; expected gnu or atfe" >&2
@@ -80,7 +102,7 @@ done
"${CC}" ${TARGET_FLAGS} -g -mcpu="${cpu}" -nostartfiles \
-T sample_threadx/sample_threadx.ld ${SYSCALL_LIB} \
-o sample_threadx.out -Wl,-Map=sample_threadx.map \
${objects} tx.a
${CRT_BEGIN} ${objects} tx.a ${CRT_END}
rm -f ${objects}
@@ -44,6 +44,23 @@ case "${TOOLCHAIN}" in
# initialise_monitor_handles that startup.S calls.
SYSCALL_LIB="--specs=rdimon.specs"
SEMIHOST_STUB=""
# crti.o defines _init and _fini; crtn.o closes them. The link below
# passes -nostartfiles, which is right for a port with its own reset
# path but also drops these two, and startup.S calls
# __libc_init_array, whose newlib implementation calls _init. Without
# them every AArch64 sample failed to link:
#
# libg.a(libc_a-init.o): in function `__libc_init_array':
# undefined reference to `_init'
# relocation truncated to fit: R_AARCH64_CALL26 against undefined
# symbol `_init'
#
# crti.o must precede every other .init contribution and crtn.o must
# follow all of them, which is why they bracket the object list rather
# than sitting with the other flags. The AArch32 scripts need none of
# this: they use nosys.specs and never reach __libc_init_array.
CRT_BEGIN="$("${CC}" -mcpu="${cpu}" -print-file-name=crti.o)"
CRT_END="$("${CC}" -mcpu="${cpu}" -print-file-name=crtn.o)"
;;
atfe)
CC="${ATFE_CLANG:-clang}"
@@ -52,6 +69,11 @@ case "${TOOLCHAIN}" in
# picolibc has no initialise_monitor_handles, and neither does the
# toolchain's semihosting library, so the weak stub stands in for it.
SEMIHOST_STUB="sample_threadx/semihost_stub.S"
# Deliberately empty. picolibc's __libc_init_array does not call _init,
# so these images link today and adding crti.o would change a working
# link for no reason.
CRT_BEGIN=""
CRT_END=""
;;
*)
echo "Unknown TOOLCHAIN '${TOOLCHAIN}'; expected gnu or atfe" >&2
@@ -80,7 +102,7 @@ done
"${CC}" ${TARGET_FLAGS} -g -mcpu="${cpu}" -nostartfiles \
-T sample_threadx/sample_threadx.ld ${SYSCALL_LIB} \
-o sample_threadx.out -Wl,-Map=sample_threadx.map \
${objects} tx.a
${CRT_BEGIN} ${objects} tx.a ${CRT_END}
rm -f ${objects}
@@ -44,6 +44,23 @@ case "${TOOLCHAIN}" in
# initialise_monitor_handles that startup.S calls.
SYSCALL_LIB="--specs=rdimon.specs"
SEMIHOST_STUB=""
# crti.o defines _init and _fini; crtn.o closes them. The link below
# passes -nostartfiles, which is right for a port with its own reset
# path but also drops these two, and startup.S calls
# __libc_init_array, whose newlib implementation calls _init. Without
# them every AArch64 sample failed to link:
#
# libg.a(libc_a-init.o): in function `__libc_init_array':
# undefined reference to `_init'
# relocation truncated to fit: R_AARCH64_CALL26 against undefined
# symbol `_init'
#
# crti.o must precede every other .init contribution and crtn.o must
# follow all of them, which is why they bracket the object list rather
# than sitting with the other flags. The AArch32 scripts need none of
# this: they use nosys.specs and never reach __libc_init_array.
CRT_BEGIN="$("${CC}" -mcpu="${cpu}" -print-file-name=crti.o)"
CRT_END="$("${CC}" -mcpu="${cpu}" -print-file-name=crtn.o)"
;;
atfe)
CC="${ATFE_CLANG:-clang}"
@@ -52,6 +69,11 @@ case "${TOOLCHAIN}" in
# picolibc has no initialise_monitor_handles, and neither does the
# toolchain's semihosting library, so the weak stub stands in for it.
SEMIHOST_STUB="sample_threadx/semihost_stub.S"
# Deliberately empty. picolibc's __libc_init_array does not call _init,
# so these images link today and adding crti.o would change a working
# link for no reason.
CRT_BEGIN=""
CRT_END=""
;;
*)
echo "Unknown TOOLCHAIN '${TOOLCHAIN}'; expected gnu or atfe" >&2
@@ -80,7 +102,7 @@ done
"${CC}" ${TARGET_FLAGS} -g -mcpu="${cpu}" -nostartfiles \
-T sample_threadx/sample_threadx.ld ${SYSCALL_LIB} \
-o sample_threadx.out -Wl,-Map=sample_threadx.map \
${objects} tx.a
${CRT_BEGIN} ${objects} tx.a ${CRT_END}
rm -f ${objects}
@@ -44,6 +44,23 @@ case "${TOOLCHAIN}" in
# initialise_monitor_handles that startup.S calls.
SYSCALL_LIB="--specs=rdimon.specs"
SEMIHOST_STUB=""
# crti.o defines _init and _fini; crtn.o closes them. The link below
# passes -nostartfiles, which is right for a port with its own reset
# path but also drops these two, and startup.S calls
# __libc_init_array, whose newlib implementation calls _init. Without
# them every AArch64 sample failed to link:
#
# libg.a(libc_a-init.o): in function `__libc_init_array':
# undefined reference to `_init'
# relocation truncated to fit: R_AARCH64_CALL26 against undefined
# symbol `_init'
#
# crti.o must precede every other .init contribution and crtn.o must
# follow all of them, which is why they bracket the object list rather
# than sitting with the other flags. The AArch32 scripts need none of
# this: they use nosys.specs and never reach __libc_init_array.
CRT_BEGIN="$("${CC}" -mcpu="${cpu}" -print-file-name=crti.o)"
CRT_END="$("${CC}" -mcpu="${cpu}" -print-file-name=crtn.o)"
;;
atfe)
CC="${ATFE_CLANG:-clang}"
@@ -52,6 +69,11 @@ case "${TOOLCHAIN}" in
# picolibc has no initialise_monitor_handles, and neither does the
# toolchain's semihosting library, so the weak stub stands in for it.
SEMIHOST_STUB="sample_threadx/semihost_stub.S"
# Deliberately empty. picolibc's __libc_init_array does not call _init,
# so these images link today and adding crti.o would change a working
# link for no reason.
CRT_BEGIN=""
CRT_END=""
;;
*)
echo "Unknown TOOLCHAIN '${TOOLCHAIN}'; expected gnu or atfe" >&2
@@ -80,7 +102,7 @@ done
"${CC}" ${TARGET_FLAGS} -g -mcpu="${cpu}" -nostartfiles \
-T sample_threadx/sample_threadx.ld ${SYSCALL_LIB} \
-o sample_threadx.out -Wl,-Map=sample_threadx.map \
${objects} tx.a
${CRT_BEGIN} ${objects} tx.a ${CRT_END}
rm -f ${objects}
@@ -44,6 +44,23 @@ case "${TOOLCHAIN}" in
# initialise_monitor_handles that startup.S calls.
SYSCALL_LIB="--specs=rdimon.specs"
SEMIHOST_STUB=""
# crti.o defines _init and _fini; crtn.o closes them. The link below
# passes -nostartfiles, which is right for a port with its own reset
# path but also drops these two, and startup.S calls
# __libc_init_array, whose newlib implementation calls _init. Without
# them every AArch64 sample failed to link:
#
# libg.a(libc_a-init.o): in function `__libc_init_array':
# undefined reference to `_init'
# relocation truncated to fit: R_AARCH64_CALL26 against undefined
# symbol `_init'
#
# crti.o must precede every other .init contribution and crtn.o must
# follow all of them, which is why they bracket the object list rather
# than sitting with the other flags. The AArch32 scripts need none of
# this: they use nosys.specs and never reach __libc_init_array.
CRT_BEGIN="$("${CC}" -mcpu="${cpu}" -print-file-name=crti.o)"
CRT_END="$("${CC}" -mcpu="${cpu}" -print-file-name=crtn.o)"
;;
atfe)
CC="${ATFE_CLANG:-clang}"
@@ -52,6 +69,11 @@ case "${TOOLCHAIN}" in
# picolibc has no initialise_monitor_handles, and neither does the
# toolchain's semihosting library, so the weak stub stands in for it.
SEMIHOST_STUB="sample_threadx/semihost_stub.S"
# Deliberately empty. picolibc's __libc_init_array does not call _init,
# so these images link today and adding crti.o would change a working
# link for no reason.
CRT_BEGIN=""
CRT_END=""
;;
*)
echo "Unknown TOOLCHAIN '${TOOLCHAIN}'; expected gnu or atfe" >&2
@@ -80,7 +102,7 @@ done
"${CC}" ${TARGET_FLAGS} -g -mcpu="${cpu}" -nostartfiles \
-T sample_threadx/sample_threadx.ld ${SYSCALL_LIB} \
-o sample_threadx.out -Wl,-Map=sample_threadx.map \
${objects} tx.a
${CRT_BEGIN} ${objects} tx.a ${CRT_END}
rm -f ${objects}
@@ -44,6 +44,23 @@ case "${TOOLCHAIN}" in
# initialise_monitor_handles that startup.S calls.
SYSCALL_LIB="--specs=rdimon.specs"
SEMIHOST_STUB=""
# crti.o defines _init and _fini; crtn.o closes them. The link below
# passes -nostartfiles, which is right for a port with its own reset
# path but also drops these two, and startup.S calls
# __libc_init_array, whose newlib implementation calls _init. Without
# them every AArch64 sample failed to link:
#
# libg.a(libc_a-init.o): in function `__libc_init_array':
# undefined reference to `_init'
# relocation truncated to fit: R_AARCH64_CALL26 against undefined
# symbol `_init'
#
# crti.o must precede every other .init contribution and crtn.o must
# follow all of them, which is why they bracket the object list rather
# than sitting with the other flags. The AArch32 scripts need none of
# this: they use nosys.specs and never reach __libc_init_array.
CRT_BEGIN="$("${CC}" -mcpu="${cpu}" -print-file-name=crti.o)"
CRT_END="$("${CC}" -mcpu="${cpu}" -print-file-name=crtn.o)"
;;
atfe)
CC="${ATFE_CLANG:-clang}"
@@ -52,6 +69,11 @@ case "${TOOLCHAIN}" in
# picolibc has no initialise_monitor_handles, and neither does the
# toolchain's semihosting library, so the weak stub stands in for it.
SEMIHOST_STUB="sample_threadx/semihost_stub.S"
# Deliberately empty. picolibc's __libc_init_array does not call _init,
# so these images link today and adding crti.o would change a working
# link for no reason.
CRT_BEGIN=""
CRT_END=""
;;
*)
echo "Unknown TOOLCHAIN '${TOOLCHAIN}'; expected gnu or atfe" >&2
@@ -80,7 +102,7 @@ done
"${CC}" ${TARGET_FLAGS} -g -mcpu="${cpu}" -nostartfiles \
-T sample_threadx/sample_threadx.ld ${SYSCALL_LIB} \
-o sample_threadx.out -Wl,-Map=sample_threadx.map \
${objects} tx.a
${CRT_BEGIN} ${objects} tx.a ${CRT_END}
rm -f ${objects}
@@ -44,6 +44,23 @@ case "${TOOLCHAIN}" in
# initialise_monitor_handles that startup.S calls.
SYSCALL_LIB="--specs=rdimon.specs"
SEMIHOST_STUB=""
# crti.o defines _init and _fini; crtn.o closes them. The link below
# passes -nostartfiles, which is right for a port with its own reset
# path but also drops these two, and startup.S calls
# __libc_init_array, whose newlib implementation calls _init. Without
# them every AArch64 sample failed to link:
#
# libg.a(libc_a-init.o): in function `__libc_init_array':
# undefined reference to `_init'
# relocation truncated to fit: R_AARCH64_CALL26 against undefined
# symbol `_init'
#
# crti.o must precede every other .init contribution and crtn.o must
# follow all of them, which is why they bracket the object list rather
# than sitting with the other flags. The AArch32 scripts need none of
# this: they use nosys.specs and never reach __libc_init_array.
CRT_BEGIN="$("${CC}" -mcpu="${cpu}" -print-file-name=crti.o)"
CRT_END="$("${CC}" -mcpu="${cpu}" -print-file-name=crtn.o)"
;;
atfe)
CC="${ATFE_CLANG:-clang}"
@@ -52,6 +69,11 @@ case "${TOOLCHAIN}" in
# picolibc has no initialise_monitor_handles, and neither does the
# toolchain's semihosting library, so the weak stub stands in for it.
SEMIHOST_STUB="sample_threadx/semihost_stub.S"
# Deliberately empty. picolibc's __libc_init_array does not call _init,
# so these images link today and adding crti.o would change a working
# link for no reason.
CRT_BEGIN=""
CRT_END=""
;;
*)
echo "Unknown TOOLCHAIN '${TOOLCHAIN}'; expected gnu or atfe" >&2
@@ -80,7 +102,7 @@ done
"${CC}" ${TARGET_FLAGS} -g -mcpu="${cpu}" -nostartfiles \
-T sample_threadx/sample_threadx.ld ${SYSCALL_LIB} \
-o sample_threadx.out -Wl,-Map=sample_threadx.map \
${objects} tx.a
${CRT_BEGIN} ${objects} tx.a ${CRT_END}
rm -f ${objects}
@@ -44,6 +44,23 @@ case "${TOOLCHAIN}" in
# initialise_monitor_handles that startup.S calls.
SYSCALL_LIB="--specs=rdimon.specs"
SEMIHOST_STUB=""
# crti.o defines _init and _fini; crtn.o closes them. The link below
# passes -nostartfiles, which is right for a port with its own reset
# path but also drops these two, and startup.S calls
# __libc_init_array, whose newlib implementation calls _init. Without
# them every AArch64 sample failed to link:
#
# libg.a(libc_a-init.o): in function `__libc_init_array':
# undefined reference to `_init'
# relocation truncated to fit: R_AARCH64_CALL26 against undefined
# symbol `_init'
#
# crti.o must precede every other .init contribution and crtn.o must
# follow all of them, which is why they bracket the object list rather
# than sitting with the other flags. The AArch32 scripts need none of
# this: they use nosys.specs and never reach __libc_init_array.
CRT_BEGIN="$("${CC}" -mcpu="${cpu}" -print-file-name=crti.o)"
CRT_END="$("${CC}" -mcpu="${cpu}" -print-file-name=crtn.o)"
;;
atfe)
CC="${ATFE_CLANG:-clang}"
@@ -52,6 +69,11 @@ case "${TOOLCHAIN}" in
# picolibc has no initialise_monitor_handles, and neither does the
# toolchain's semihosting library, so the weak stub stands in for it.
SEMIHOST_STUB="sample_threadx/semihost_stub.S"
# Deliberately empty. picolibc's __libc_init_array does not call _init,
# so these images link today and adding crti.o would change a working
# link for no reason.
CRT_BEGIN=""
CRT_END=""
;;
*)
echo "Unknown TOOLCHAIN '${TOOLCHAIN}'; expected gnu or atfe" >&2
@@ -80,7 +102,7 @@ done
"${CC}" ${TARGET_FLAGS} -g -mcpu="${cpu}" -nostartfiles \
-T sample_threadx/sample_threadx.ld ${SYSCALL_LIB} \
-o sample_threadx.out -Wl,-Map=sample_threadx.map \
${objects} tx.a
${CRT_BEGIN} ${objects} tx.a ${CRT_END}
rm -f ${objects}
@@ -44,6 +44,23 @@ case "${TOOLCHAIN}" in
# initialise_monitor_handles that startup.S calls.
SYSCALL_LIB="--specs=rdimon.specs"
SEMIHOST_STUB=""
# crti.o defines _init and _fini; crtn.o closes them. The link below
# passes -nostartfiles, which is right for a port with its own reset
# path but also drops these two, and startup.S calls
# __libc_init_array, whose newlib implementation calls _init. Without
# them every AArch64 sample failed to link:
#
# libg.a(libc_a-init.o): in function `__libc_init_array':
# undefined reference to `_init'
# relocation truncated to fit: R_AARCH64_CALL26 against undefined
# symbol `_init'
#
# crti.o must precede every other .init contribution and crtn.o must
# follow all of them, which is why they bracket the object list rather
# than sitting with the other flags. The AArch32 scripts need none of
# this: they use nosys.specs and never reach __libc_init_array.
CRT_BEGIN="$("${CC}" -mcpu="${cpu}" -print-file-name=crti.o)"
CRT_END="$("${CC}" -mcpu="${cpu}" -print-file-name=crtn.o)"
;;
atfe)
CC="${ATFE_CLANG:-clang}"
@@ -52,6 +69,11 @@ case "${TOOLCHAIN}" in
# picolibc has no initialise_monitor_handles, and neither does the
# toolchain's semihosting library, so the weak stub stands in for it.
SEMIHOST_STUB="sample_threadx/semihost_stub.S"
# Deliberately empty. picolibc's __libc_init_array does not call _init,
# so these images link today and adding crti.o would change a working
# link for no reason.
CRT_BEGIN=""
CRT_END=""
;;
*)
echo "Unknown TOOLCHAIN '${TOOLCHAIN}'; expected gnu or atfe" >&2
@@ -80,7 +102,7 @@ done
"${CC}" ${TARGET_FLAGS} -g -mcpu="${cpu}" -nostartfiles \
-T sample_threadx/sample_threadx.ld ${SYSCALL_LIB} \
-o sample_threadx.out -Wl,-Map=sample_threadx.map \
${objects} tx.a
${CRT_BEGIN} ${objects} tx.a ${CRT_END}
rm -f ${objects}
@@ -44,6 +44,23 @@ case "${TOOLCHAIN}" in
# initialise_monitor_handles that startup.S calls.
SYSCALL_LIB="--specs=rdimon.specs"
SEMIHOST_STUB=""
# crti.o defines _init and _fini; crtn.o closes them. The link below
# passes -nostartfiles, which is right for a port with its own reset
# path but also drops these two, and startup.S calls
# __libc_init_array, whose newlib implementation calls _init. Without
# them every AArch64 sample failed to link:
#
# libg.a(libc_a-init.o): in function `__libc_init_array':
# undefined reference to `_init'
# relocation truncated to fit: R_AARCH64_CALL26 against undefined
# symbol `_init'
#
# crti.o must precede every other .init contribution and crtn.o must
# follow all of them, which is why they bracket the object list rather
# than sitting with the other flags. The AArch32 scripts need none of
# this: they use nosys.specs and never reach __libc_init_array.
CRT_BEGIN="$("${CC}" -mcpu="${cpu}" -print-file-name=crti.o)"
CRT_END="$("${CC}" -mcpu="${cpu}" -print-file-name=crtn.o)"
;;
atfe)
CC="${ATFE_CLANG:-clang}"
@@ -52,6 +69,11 @@ case "${TOOLCHAIN}" in
# picolibc has no initialise_monitor_handles, and neither does the
# toolchain's semihosting library, so the weak stub stands in for it.
SEMIHOST_STUB="sample_threadx/semihost_stub.S"
# Deliberately empty. picolibc's __libc_init_array does not call _init,
# so these images link today and adding crti.o would change a working
# link for no reason.
CRT_BEGIN=""
CRT_END=""
;;
*)
echo "Unknown TOOLCHAIN '${TOOLCHAIN}'; expected gnu or atfe" >&2
@@ -80,7 +102,7 @@ done
"${CC}" ${TARGET_FLAGS} -g -mcpu="${cpu}" -nostartfiles \
-T sample_threadx/sample_threadx.ld ${SYSCALL_LIB} \
-o sample_threadx.out -Wl,-Map=sample_threadx.map \
${objects} tx.a
${CRT_BEGIN} ${objects} tx.a ${CRT_END}
rm -f ${objects}
@@ -44,6 +44,23 @@ case "${TOOLCHAIN}" in
# initialise_monitor_handles that startup.S calls.
SYSCALL_LIB="--specs=rdimon.specs"
SEMIHOST_STUB=""
# crti.o defines _init and _fini; crtn.o closes them. The link below
# passes -nostartfiles, which is right for a port with its own reset
# path but also drops these two, and startup.S calls
# __libc_init_array, whose newlib implementation calls _init. Without
# them every AArch64 sample failed to link:
#
# libg.a(libc_a-init.o): in function `__libc_init_array':
# undefined reference to `_init'
# relocation truncated to fit: R_AARCH64_CALL26 against undefined
# symbol `_init'
#
# crti.o must precede every other .init contribution and crtn.o must
# follow all of them, which is why they bracket the object list rather
# than sitting with the other flags. The AArch32 scripts need none of
# this: they use nosys.specs and never reach __libc_init_array.
CRT_BEGIN="$("${CC}" -mcpu="${cpu}" -print-file-name=crti.o)"
CRT_END="$("${CC}" -mcpu="${cpu}" -print-file-name=crtn.o)"
;;
atfe)
CC="${ATFE_CLANG:-clang}"
@@ -52,6 +69,11 @@ case "${TOOLCHAIN}" in
# picolibc has no initialise_monitor_handles, and neither does the
# toolchain's semihosting library, so the weak stub stands in for it.
SEMIHOST_STUB="sample_threadx/semihost_stub.S"
# Deliberately empty. picolibc's __libc_init_array does not call _init,
# so these images link today and adding crti.o would change a working
# link for no reason.
CRT_BEGIN=""
CRT_END=""
;;
*)
echo "Unknown TOOLCHAIN '${TOOLCHAIN}'; expected gnu or atfe" >&2
@@ -80,7 +102,7 @@ done
"${CC}" ${TARGET_FLAGS} -g -mcpu="${cpu}" -nostartfiles \
-T sample_threadx/sample_threadx.ld ${SYSCALL_LIB} \
-o sample_threadx.out -Wl,-Map=sample_threadx.map \
${objects} tx.a
${CRT_BEGIN} ${objects} tx.a ${CRT_END}
rm -f ${objects}
@@ -44,6 +44,23 @@ case "${TOOLCHAIN}" in
# initialise_monitor_handles that startup.S calls.
SYSCALL_LIB="--specs=rdimon.specs"
SEMIHOST_STUB=""
# crti.o defines _init and _fini; crtn.o closes them. The link below
# passes -nostartfiles, which is right for a port with its own reset
# path but also drops these two, and startup.S calls
# __libc_init_array, whose newlib implementation calls _init. Without
# them every AArch64 sample failed to link:
#
# libg.a(libc_a-init.o): in function `__libc_init_array':
# undefined reference to `_init'
# relocation truncated to fit: R_AARCH64_CALL26 against undefined
# symbol `_init'
#
# crti.o must precede every other .init contribution and crtn.o must
# follow all of them, which is why they bracket the object list rather
# than sitting with the other flags. The AArch32 scripts need none of
# this: they use nosys.specs and never reach __libc_init_array.
CRT_BEGIN="$("${CC}" -mcpu="${cpu}" -print-file-name=crti.o)"
CRT_END="$("${CC}" -mcpu="${cpu}" -print-file-name=crtn.o)"
;;
atfe)
CC="${ATFE_CLANG:-clang}"
@@ -52,6 +69,11 @@ case "${TOOLCHAIN}" in
# picolibc has no initialise_monitor_handles, and neither does the
# toolchain's semihosting library, so the weak stub stands in for it.
SEMIHOST_STUB="sample_threadx/semihost_stub.S"
# Deliberately empty. picolibc's __libc_init_array does not call _init,
# so these images link today and adding crti.o would change a working
# link for no reason.
CRT_BEGIN=""
CRT_END=""
;;
*)
echo "Unknown TOOLCHAIN '${TOOLCHAIN}'; expected gnu or atfe" >&2
@@ -80,7 +102,7 @@ done
"${CC}" ${TARGET_FLAGS} -g -mcpu="${cpu}" -nostartfiles \
-T sample_threadx/sample_threadx.ld ${SYSCALL_LIB} \
-o sample_threadx.out -Wl,-Map=sample_threadx.map \
${objects} tx.a
${CRT_BEGIN} ${objects} tx.a ${CRT_END}
rm -f ${objects}
@@ -44,6 +44,23 @@ case "${TOOLCHAIN}" in
# initialise_monitor_handles that startup.S calls.
SYSCALL_LIB="--specs=rdimon.specs"
SEMIHOST_STUB=""
# crti.o defines _init and _fini; crtn.o closes them. The link below
# passes -nostartfiles, which is right for a port with its own reset
# path but also drops these two, and startup.S calls
# __libc_init_array, whose newlib implementation calls _init. Without
# them every AArch64 sample failed to link:
#
# libg.a(libc_a-init.o): in function `__libc_init_array':
# undefined reference to `_init'
# relocation truncated to fit: R_AARCH64_CALL26 against undefined
# symbol `_init'
#
# crti.o must precede every other .init contribution and crtn.o must
# follow all of them, which is why they bracket the object list rather
# than sitting with the other flags. The AArch32 scripts need none of
# this: they use nosys.specs and never reach __libc_init_array.
CRT_BEGIN="$("${CC}" -mcpu="${cpu}" -print-file-name=crti.o)"
CRT_END="$("${CC}" -mcpu="${cpu}" -print-file-name=crtn.o)"
;;
atfe)
CC="${ATFE_CLANG:-clang}"
@@ -52,6 +69,11 @@ case "${TOOLCHAIN}" in
# picolibc has no initialise_monitor_handles, and neither does the
# toolchain's semihosting library, so the weak stub stands in for it.
SEMIHOST_STUB="sample_threadx/semihost_stub.S"
# Deliberately empty. picolibc's __libc_init_array does not call _init,
# so these images link today and adding crti.o would change a working
# link for no reason.
CRT_BEGIN=""
CRT_END=""
;;
*)
echo "Unknown TOOLCHAIN '${TOOLCHAIN}'; expected gnu or atfe" >&2
@@ -80,7 +102,7 @@ done
"${CC}" ${TARGET_FLAGS} -g -mcpu="${cpu}" -nostartfiles \
-T sample_threadx/sample_threadx.ld ${SYSCALL_LIB} \
-o sample_threadx.out -Wl,-Map=sample_threadx.map \
${objects} tx.a
${CRT_BEGIN} ${objects} tx.a ${CRT_END}
rm -f ${objects}
@@ -44,6 +44,23 @@ case "${TOOLCHAIN}" in
# initialise_monitor_handles that startup.S calls.
SYSCALL_LIB="--specs=rdimon.specs"
SEMIHOST_STUB=""
# crti.o defines _init and _fini; crtn.o closes them. The link below
# passes -nostartfiles, which is right for a port with its own reset
# path but also drops these two, and startup.S calls
# __libc_init_array, whose newlib implementation calls _init. Without
# them every AArch64 sample failed to link:
#
# libg.a(libc_a-init.o): in function `__libc_init_array':
# undefined reference to `_init'
# relocation truncated to fit: R_AARCH64_CALL26 against undefined
# symbol `_init'
#
# crti.o must precede every other .init contribution and crtn.o must
# follow all of them, which is why they bracket the object list rather
# than sitting with the other flags. The AArch32 scripts need none of
# this: they use nosys.specs and never reach __libc_init_array.
CRT_BEGIN="$("${CC}" -mcpu="${cpu}" -print-file-name=crti.o)"
CRT_END="$("${CC}" -mcpu="${cpu}" -print-file-name=crtn.o)"
;;
atfe)
CC="${ATFE_CLANG:-clang}"
@@ -52,6 +69,11 @@ case "${TOOLCHAIN}" in
# picolibc has no initialise_monitor_handles, and neither does the
# toolchain's semihosting library, so the weak stub stands in for it.
SEMIHOST_STUB="sample_threadx/semihost_stub.S"
# Deliberately empty. picolibc's __libc_init_array does not call _init,
# so these images link today and adding crti.o would change a working
# link for no reason.
CRT_BEGIN=""
CRT_END=""
;;
*)
echo "Unknown TOOLCHAIN '${TOOLCHAIN}'; expected gnu or atfe" >&2
@@ -80,7 +102,7 @@ done
"${CC}" ${TARGET_FLAGS} -g -mcpu="${cpu}" -nostartfiles \
-T sample_threadx/sample_threadx.ld ${SYSCALL_LIB} \
-o sample_threadx.out -Wl,-Map=sample_threadx.map \
${objects} tx.a
${CRT_BEGIN} ${objects} tx.a ${CRT_END}
rm -f ${objects}
@@ -44,6 +44,23 @@ case "${TOOLCHAIN}" in
# initialise_monitor_handles that startup.S calls.
SYSCALL_LIB="--specs=rdimon.specs"
SEMIHOST_STUB=""
# crti.o defines _init and _fini; crtn.o closes them. The link below
# passes -nostartfiles, which is right for a port with its own reset
# path but also drops these two, and startup.S calls
# __libc_init_array, whose newlib implementation calls _init. Without
# them every AArch64 sample failed to link:
#
# libg.a(libc_a-init.o): in function `__libc_init_array':
# undefined reference to `_init'
# relocation truncated to fit: R_AARCH64_CALL26 against undefined
# symbol `_init'
#
# crti.o must precede every other .init contribution and crtn.o must
# follow all of them, which is why they bracket the object list rather
# than sitting with the other flags. The AArch32 scripts need none of
# this: they use nosys.specs and never reach __libc_init_array.
CRT_BEGIN="$("${CC}" -mcpu="${cpu}" -print-file-name=crti.o)"
CRT_END="$("${CC}" -mcpu="${cpu}" -print-file-name=crtn.o)"
;;
atfe)
CC="${ATFE_CLANG:-clang}"
@@ -52,6 +69,11 @@ case "${TOOLCHAIN}" in
# picolibc has no initialise_monitor_handles, and neither does the
# toolchain's semihosting library, so the weak stub stands in for it.
SEMIHOST_STUB="sample_threadx/semihost_stub.S"
# Deliberately empty. picolibc's __libc_init_array does not call _init,
# so these images link today and adding crti.o would change a working
# link for no reason.
CRT_BEGIN=""
CRT_END=""
;;
*)
echo "Unknown TOOLCHAIN '${TOOLCHAIN}'; expected gnu or atfe" >&2
@@ -80,7 +102,7 @@ done
"${CC}" ${TARGET_FLAGS} -g -mcpu="${cpu}" -nostartfiles \
-T sample_threadx/sample_threadx.ld ${SYSCALL_LIB} \
-o sample_threadx.out -Wl,-Map=sample_threadx.map \
${objects} tx.a
${CRT_BEGIN} ${objects} tx.a ${CRT_END}
rm -f ${objects}
@@ -44,6 +44,23 @@ case "${TOOLCHAIN}" in
# initialise_monitor_handles that startup.S calls.
SYSCALL_LIB="--specs=rdimon.specs"
SEMIHOST_STUB=""
# crti.o defines _init and _fini; crtn.o closes them. The link below
# passes -nostartfiles, which is right for a port with its own reset
# path but also drops these two, and startup.S calls
# __libc_init_array, whose newlib implementation calls _init. Without
# them every AArch64 sample failed to link:
#
# libg.a(libc_a-init.o): in function `__libc_init_array':
# undefined reference to `_init'
# relocation truncated to fit: R_AARCH64_CALL26 against undefined
# symbol `_init'
#
# crti.o must precede every other .init contribution and crtn.o must
# follow all of them, which is why they bracket the object list rather
# than sitting with the other flags. The AArch32 scripts need none of
# this: they use nosys.specs and never reach __libc_init_array.
CRT_BEGIN="$("${CC}" -mcpu="${cpu}" -print-file-name=crti.o)"
CRT_END="$("${CC}" -mcpu="${cpu}" -print-file-name=crtn.o)"
;;
atfe)
CC="${ATFE_CLANG:-clang}"
@@ -52,6 +69,11 @@ case "${TOOLCHAIN}" in
# picolibc has no initialise_monitor_handles, and neither does the
# toolchain's semihosting library, so the weak stub stands in for it.
SEMIHOST_STUB="sample_threadx/semihost_stub.S"
# Deliberately empty. picolibc's __libc_init_array does not call _init,
# so these images link today and adding crti.o would change a working
# link for no reason.
CRT_BEGIN=""
CRT_END=""
;;
*)
echo "Unknown TOOLCHAIN '${TOOLCHAIN}'; expected gnu or atfe" >&2
@@ -80,7 +102,7 @@ done
"${CC}" ${TARGET_FLAGS} -g -mcpu="${cpu}" -nostartfiles \
-T sample_threadx/sample_threadx.ld ${SYSCALL_LIB} \
-o sample_threadx.out -Wl,-Map=sample_threadx.map \
${objects} tx.a
${CRT_BEGIN} ${objects} tx.a ${CRT_END}
rm -f ${objects}
@@ -44,6 +44,23 @@ case "${TOOLCHAIN}" in
# initialise_monitor_handles that startup.S calls.
SYSCALL_LIB="--specs=rdimon.specs"
SEMIHOST_STUB=""
# crti.o defines _init and _fini; crtn.o closes them. The link below
# passes -nostartfiles, which is right for a port with its own reset
# path but also drops these two, and startup.S calls
# __libc_init_array, whose newlib implementation calls _init. Without
# them every AArch64 sample failed to link:
#
# libg.a(libc_a-init.o): in function `__libc_init_array':
# undefined reference to `_init'
# relocation truncated to fit: R_AARCH64_CALL26 against undefined
# symbol `_init'
#
# crti.o must precede every other .init contribution and crtn.o must
# follow all of them, which is why they bracket the object list rather
# than sitting with the other flags. The AArch32 scripts need none of
# this: they use nosys.specs and never reach __libc_init_array.
CRT_BEGIN="$("${CC}" -mcpu="${cpu}" -print-file-name=crti.o)"
CRT_END="$("${CC}" -mcpu="${cpu}" -print-file-name=crtn.o)"
;;
atfe)
CC="${ATFE_CLANG:-clang}"
@@ -52,6 +69,11 @@ case "${TOOLCHAIN}" in
# picolibc has no initialise_monitor_handles, and neither does the
# toolchain's semihosting library, so the weak stub stands in for it.
SEMIHOST_STUB="sample_threadx/semihost_stub.S"
# Deliberately empty. picolibc's __libc_init_array does not call _init,
# so these images link today and adding crti.o would change a working
# link for no reason.
CRT_BEGIN=""
CRT_END=""
;;
*)
echo "Unknown TOOLCHAIN '${TOOLCHAIN}'; expected gnu or atfe" >&2
@@ -80,7 +102,7 @@ done
"${CC}" ${TARGET_FLAGS} -g -mcpu="${cpu}" -nostartfiles \
-T sample_threadx/sample_threadx.ld ${SYSCALL_LIB} \
-o sample_threadx.out -Wl,-Map=sample_threadx.map \
${objects} tx.a
${CRT_BEGIN} ${objects} tx.a ${CRT_END}
rm -f ${objects}