Skip to content

arm: standalone --cortex-m internal calls need direct resolution (no linker) + $t mapping symbols #170

Description

@avrabe

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 linkerbuild_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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions