This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: RFC: Prevent disassembly beyond symbolic boundaries


> On 23 Jun 2015, at 15:20, Richard Sandiford <Richard.Sandiford@arm.com> wrote:
> 
> 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.

Yes.  Microsoft was fan of that trick for its basic on 6809.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]