For the Motorola 68HC11, ld can perform these global optimizations when you specify the --relax command-line option.
jsr
and jmp
instructions whose
targets are within eight bits, and turns them into eight-bit
program-counter relative bsr
and bra
instructions,
respectively.
ld also looks at all 16-bit extended addressing modes and
transforms them in a direct addressing mode when the address is in
page 0 (between 0 and 0x0ff).
bclr
or
bset
instructions.
For 68HC11 and 68HC12, ld can generate trampoline code to
call a far function using a normal jsr
instruction. The linker
will also change the relocation to some far function to use the
trampoline address instead of the function address. This is typically the
case when a pointer to a function is taken. The pointer will in fact
point to the function trampoline.