This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Gas can't handle prefix generated by gcc
- From: "H. J. Lu" <hjl at lucon dot org>
- To: Zack Weinberg <zack at codesourcery dot com>, gcc at gcc dot gnu dot org
- Cc: Jan Beulich <JBeulich at novell dot com>, binutils at sources dot redhat dot com
- Date: Fri, 23 Jul 2004 11:58:39 -0700
- Subject: Gas can't handle prefix generated by gcc
- References: <s100c3d9.002@emea1-mh.id2.novell.com> <20040723140035.GA31423@lucon.org> <87y8laboyn.fsf@codesourcery.com>
On Fri, Jul 23, 2004 at 10:41:52AM -0700, Zack Weinberg wrote:
> (except for the assembler miscalculating the branch offset).
> See for yourself:
>
> $ cat test.s
> .text
> ds ; je .+2 # offset miscalculated
> cs ; je .+2 # offset miscalculated
> je,pt .+3
> je,pn .+3
> $ as test.s
> $ objdump -d a.out
>
> a.out: file format elf64-x86-64
>
> Disassembly of section .text:
>
> 0000000000000000 <.text>:
> 0: 3e 74 00 je,pt 0x3
> 3: 2e 74 00 je,pn 0x6
> 6: 3e 74 00 je,pt 0x9
> 9: 2e 74 00 je,pn 0xc
>
> I assume that the offset miscalculation is due to the problem HJ is
> trying to solve, i.e. the x86-64 assembler rejecting explicit ds/cs
> prefixes on branch instructions.
>
I opened a bug:
http://sources.redhat.com/bugzilla/show_bug.cgi?id=286
It seems that gcc uses a prefix syntax which gas doesn't handle. Does
gcc always use " ; " as prefix separator? Right now, gas can only
handle PREFIX_SEPARATOR, which is defined as '\\' or '/'. There can be
no spaces after PREFIX_SEPARATOR. I can special case branch hints. But
I don't know if it is enough.
H.J.