Follow-up to #167 (fixed for the --relocatable path in PR #169).
Standalone --cortex-m direct call resolution
The --relocatable path now emits R_ARM_THM_CALL relocations so the host linker resolves internal BL func_N calls. But a standalone --cortex-m executable has no linker — build_multi_func_cortex_m_elf must resolve internal calls directly by patching the Thumb BL offset at layout time (function addresses are known). Today those calls remain bl #0 placeholders in a standalone image.
Scope: in build_multi_func_cortex_m_elf, after laying out functions, walk each function's BL func_N relocation and patch the encoded Thumb BL displacement (S − P, accounting for the +4 pipeline) in place. The 0xF800 zero-offset encoding from PR #169 is the correct base to patch.
$t / $a / $d mapping symbols
synth's ARM objects emit no mapping symbols, so objdump won't disassemble .text as Thumb (shows .word), and strict consumers may mis-read ARM-vs-Thumb regions. Not required for linking (PR #169 links cleanly without them), but needed for clean disassembly/debug and full ARM-ELF-ABI conformance. Requires emitting a local $t at .text offset 0, which means making the .symtab sh_info (first-global index) dynamic and ordering local symbols before globals in the builder.
Follow-up to #167 (fixed for the
--relocatablepath in PR #169).Standalone
--cortex-mdirect call resolutionThe
--relocatablepath now emitsR_ARM_THM_CALLrelocations so the host linker resolves internalBL func_Ncalls. But a standalone--cortex-mexecutable has no linker —build_multi_func_cortex_m_elfmust resolve internal calls directly by patching the Thumb BL offset at layout time (function addresses are known). Today those calls remainbl #0placeholders in a standalone image.Scope: in
build_multi_func_cortex_m_elf, after laying out functions, walk each function'sBL func_Nrelocation and patch the encoded Thumb BL displacement (S − P, accounting for the +4 pipeline) in place. The0xF800zero-offset encoding from PR #169 is the correct base to patch.$t/$a/$dmapping symbolssynth's ARM objects emit no mapping symbols, so
objdumpwon't disassemble.textas Thumb (shows.word), and strict consumers may mis-read ARM-vs-Thumb regions. Not required for linking (PR #169 links cleanly without them), but needed for clean disassembly/debug and full ARM-ELF-ABI conformance. Requires emitting a local$tat.textoffset 0, which means making the.symtabsh_info(first-global index) dynamic and ordering local symbols before globals in the builder.