nuttx/Documentation/components
Marco Casaroli db011db3ac arch/arm: Reserve r10 via ARCHCFLAGS and hoist the PIC module flags.
Toolchain.defs adds --fixed-r10 to CFLAGS under CONFIG_PIC, but nearly
every board Make.defs includes that file and then assigns

  CFLAGS := $(ARCHCFLAGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) ...

with ':=', which discards it.  266 of the 269 ARM board files assign
CFLAGS that way; the remaining three delegate to a shared makefile that
does the same thing.

The flag is what keeps the base firmware from allocating r10, the
register a PIC module reaches its own data through.  Losing it is silent
and the symptom is remote from the cause: the build succeeds, and only a
callback from base firmware into module code -- qsort() with a module
comparison function is the standard case -- misbehaves, reading its data
through a register the firmware has since felt free to reuse.

Adding it to ARCHCFLAGS puts it on the far side of that ':=', which
re-expands ARCHCFLAGS, so every board picks it up with no board changes
at all.

A module is the other side of the --fixed-r10 contract: it gets r10 via
-mpic-register=r10, and GCC rejects both on one command line with
"unable to use 'r10' for PIC register".  Every ARM board carried the
same three lines to set that up:

  ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
  CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
  CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)

They move to arch/arm/src/common/Toolchain.defs, which also filters
--fixed-r10 back out of CPICFLAGS, CXXPICFLAGS, CELFFLAGS and
CXXELFFLAGS in one place instead of each board having to know about the
interaction.  ARCHPICFLAGS uses '?=' and the derived flags use deferred
'=', so a board can still override or append after including the file,
and CFLAGS is whatever the board finally set it to.

Two boards keep a definition because they genuinely differ: am67 adds
-ffixed-r10 and tiva conditionally adds -mno-pic-data-is-text-relative.
tlsr82 previously appended -fpic to an unset variable, so only -fpic
ever reached its compiler; it now inherits the standard set, verified
against tc32-elf-gcc 4.5.1.tc32-elf-1.5 (Telink TC32 v2.0), whose
ARM-derived backend honors -msingle-pic-base and -mpic-register=r10.
The mps2, mps3, qemu-armv7a, qemu-armv7r, fvp and mcx-nxxx families
referenced ARCHPICFLAGS without ever defining it, so their CPICFLAGS
carried no PIC flags at all; they get the standard set too.

Also adds the missing space in

  CXXELFFLAGS = $(CXXFLAGS)-fvisibility=hidden -mlong-calls

which ran the last token of CXXFLAGS into -fvisibility=hidden, yielding
a single malformed token such as -DNDEBUG-fvisibility=hidden.

Also exempts the pre-existing "*.siz" gsize comment in Toolchain.defs
from codespell, which reads "siz" as a misspelling and fires for any
patch touching the file, since checkpatch scans whole files rather than
changed lines.

Before, with CONFIG_PIC=y:  CFLAGS has --fixed-r10: NO
After:                      CFLAGS has --fixed-r10: YES
                            CPICFLAGS/CELFFLAGS:    filtered out

Assisted-by: Claude Code:claude-opus-4-8
Assisted-by: Claude Code:claude-fable-5
Signed-off-by: Marco Casaroli <marco.casaroli@gmail.com>
2026-07-24 23:09:08 +08:00
..
arch Documentation: update organization.rst 2023-10-30 20:29:54 +08:00
audio docs/audio_tone: Add documentation about the audio tone driver 2026-07-13 09:42:26 +08:00
concurrency Documentation: Add documentation for seqcount. 2025-12-22 10:22:06 -03:00
drivers docs/audio_tone: Add documentation about the audio tone driver 2026-07-13 09:42:26 +08:00
filesystem fs/littlefs: Enforce open permissions and set create ownership 2026-06-21 10:39:42 +08:00
libs include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
mm mm/iob: add iob_init method to support external buffer init as iob structure 2025-12-25 10:08:49 +08:00
net Documentation/net: document lower-half driver performance tuning 2026-07-13 11:53:26 +02:00
nxgraphics !boards/boardctl: Remove BOARDIOC_INIT 2026-05-26 09:57:29 +08:00
tools Documentation: PBKDF2 login docs, board Kconfig, and CI password 2026-07-21 20:19:14 +08:00
binfmt.rst style: fix typos 2025-04-30 13:45:46 +08:00
boards.rst Documentation/components/boards.rst: fix typo 2026-06-04 09:58:42 +08:00
cmake.rst Documentation: initialize cmake doc 2023-10-27 13:21:40 -03:00
crypto.rst crypto: Support SHA2_224_HMAC 2026-07-04 14:15:17 +08:00
index.rst Documentation: Add documentation for seqcount. 2025-12-22 10:22:06 -03:00
nxflat.rst arch/arm: Reserve r10 via ARCHCFLAGS and hoist the PIC module flags. 2026-07-24 23:09:08 +08:00
openamp.rst Documentation: add dummy pages for missing top directories 2023-10-27 13:21:40 -03:00
paging.rst style: fix typos 2025-04-30 13:45:46 +08:00
syscall.rst Documentation: fix spelling 2025-05-15 11:33:41 +08:00
video.rst Documentation: add dummy pages for missing top directories 2023-10-27 13:21:40 -03:00
wireless.rst Documentation: add dummy pages for missing top directories 2023-10-27 13:21:40 -03:00