This is the mail archive of the
mailing list for the binutils project.
Re: Gas can't handle prefix generated by gcc
- From: "Jan Beulich" <jbeulich at novell dot com>
- To: <zack at codesourcery dot com>,<hjl at lucon dot org>
- Cc: <gcc at gcc dot gnu dot org>,<binutils at sources dot redhat dot com>
- Date: Sun, 25 Jul 2004 13:08:39 +0200
- Subject: Re: Gas can't handle prefix generated by gcc
If anyone cares:
- the offset miscalculation should be observable only when using . in
the jump target; gcc, however, should use labels everywhere except in
inline-assembly (and doing things wrong there is the responsibility of
the creator of that piece of inline assembly)
- using prefixes followed by line separators was theoretically always
broken (and gas, at least for certain prefixes, even emits a warning -
it should be more rigid in my optinion); it's practically broken if you
try to do so for x86-64's rex prefixes (since these must be the last
prefix in the insn encoding, and you have at most implicit control over
the prefixes the assembler generates for the subsequent instruction);
and it's practically also broken (as Alan pointed out) due to the
changing value of .
- I'm feeling, especially in H.J.'s argumentation, an internal
contradiction: on one hand you want to disallow (or at least discourage)
the common (broken) practice of separating prefixes from their insns by
a line separator, on the other hand you want to support common (broken)
practice by allowing explicit prefixes where they're unnecessary
- and I'm feeling that, from Zack's standpoint (also referring to the
'ideological purity' statement in one of the earlier emails as well as
another discussion we had in the recent past), all that is important is
to support existing code (and practices), no matter whether they're
broken; it is especially unimportant with this point of view whether
this causes (whatever small) harm to those of us trying to write correct
>>> Zack Weinberg <email@example.com> 07/24/04 1:36 AM >>>
"H. J. Lu" <firstname.lastname@example.org> writes:
>> 1) Make GAS accept cs;je and do the right thing.
>> 2) Prove that cs/je, rep/stosl, etc are acceptable to all i386
>> assemblers since time immemorial.
>> 3) Write the GCC patch yourself. And I will not review it.
>> And yes, those are in order of decreasing preference.
> ';' is a line terminator for assembler. Assembler won't see the string
> of "cs;je" at all. I don't think adding such a hack for gcc is a good
My idea of the Right Thing would be to recognize an instruction
consisting only of a prefix opcode (any prefix opcode - not just
segment overrides), and save it to be combined with the next one.
That would handle "cs;je", "rep\n\tmovsl", and so on.
It's not just GCC that does this; take a look at the Linux kernel's
arch/i386 assembly files.
> I can write a patch. But who will review it?