This is the mail archive of the binutils@sources.redhat.com 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: [PATCH] x86: suppress emission of zero displacements in memoryoperands


"Dave Korn" <dave.korn@artimi.com> writes:

>   I'm not sure if I've fully understood the intent of this patch, but I
> think you're saying that if someone writes
>
>         mov %eax,0(%edi)
>
> the assembler will emit
>
>    4 0003 8907          mov %eax,(%edi)
>
> and not
>
>    2 0000 894700        mov %eax,0(%edi)
>
> yes?  Nothing the user _explicitly_ specifies should ever be discarded IMO.

The m68k assembler is doing something similar, also known as relaxing.

$ echo 'move.w 0(%a0),%d0' | m68k-linux-as -
$ m68k-linux-objdump -d

a.out:     file format elf32-m68k

Disassembly of section .text:

00000000 <.text>:
   0:   3010            movew %a0@,%d0

> What if someone wants to write self-modifying code that stores varying
> offsets into that field?

In the m68k assembler you can force a field by adding an explicit size
modifier.

$ echo 'move.w 0.w(%a0),%d0' | m68k-linux-as -
$ m68k-linux-objdump -d

a.out:     file format elf32-m68k

Disassembly of section .text:

00000000 <.text>:
   0:   3028 0000       movew %a0@(0),%d0

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."


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