RFC: Prevent disassembly beyond symbolic boundaries

Richard Sandiford richard.sandiford@arm.com
Tue Jun 23 13:21:00 GMT 2015


Erik Christiansen <dvalin@internode.on.net> writes:
> On 19.06.15 12:41, Nicholas Clifton wrote:
>> The point being that if there is a symbol that is in the middle of an
>> instruction then something hinky is going on.  Either the symbol is
>> misplaced or the instruction is not really an instruction or else an
>> assembly programmer is being extra super clever and hiding data
>> inside instructions.
>
> One thing we did more than three decades ago, when memory cost money,
> was to pass constant parameters in-line after a function call, so the
> register loading instructions occurred only once, inside the function.
> The price was no more than indirect loads. Incrementing the return
> address came for free, as the data was read.
>
> There is so little memory in today's smaller AVR devices, that one could
> be tempted to resurrect the practice, in extremis.

FWIW, another use case is as a cheap way to avoid a second branch in
diamond control flow on simple CISC architectures (e.g. 6502, 6809).
The pattern would be something like:

	bne 	foo
        ...
	.byte    <first byte of LDY #xx>
foo:
	incx

where the Y register is dead.

In this case it was actually very helpful to have the thing decoded
twice, once as the "if" branch sees it and another as the "else" branch
(foo) sees it.

Thanks,
Richard



More information about the Binutils mailing list