This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: RFC: Prevent disassembly beyond symbolic boundaries
- From: Tristan Gingold <gingold at adacore dot com>
- To: Richard Sandiford <Richard dot Sandiford at arm dot com>
- Cc: Erik Christiansen <dvalin at internode dot on dot net>, binutils at sourceware dot org
- Date: Tue, 23 Jun 2015 15:33:15 +0200
- Subject: Re: RFC: Prevent disassembly beyond symbolic boundaries
- Authentication-results: sourceware.org; auth=none
- References: <87lhfhynoz dot fsf at redhat dot com> <3D81F97D-90EA-4769-8381-514BB6E81E3F at adacore dot com> <5583FFEE dot 6060106 at redhat dot com> <20150619124229 dot GD3443 at ratatosk> <87ioaeblz2 dot fsf at e105548-lin dot cambridge dot arm dot com>
> 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.