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: m68k --register-prefix-optional and labels like registers


>> 2) gcc generates labels like this
>
> How ?  (ie can you provide a gcc based test case.  Please also mention
> how the toolchain is configured).

I can reproduce the "bug" with both gcc and gas configured for target m68k-unknown-openbsd

$ cat foo.c
void f(void)
{
        static int sp;
        sp = 1;
}

$ gcc -S foo.c # With gcc 3.4.6
$ cat foo.s
#NO_APP
.lcomm sp.0,4
        .text
        .even
        .globl  _f
        .type   _f, @function
_f:
        link a6,#0
        moveq #1,d0
        movel d0,(sp.0)
        unlk a6
        rts
        .size   _f, .-_f

Note that an '_' is inserted before the name of the global function, but not before the name of the static variable.

$ as foo.s -o foo.o
foo.s: Assembler messages:
foo.s:10: Error: syntax error -- statement `movel d0,(sp.0)' ignored

However, that behavior has changed in gcc 4.2 :

$ gcc -S foo.c # With gcc 4.2
$ cat foo.s
#NO_APP
.lcomm _sp.1464,4
        .text
        .even
        .globl  _f
        .type   _f, @function
_f:
        link fp,#0
        moveq #1,d0
        movel d0,_sp.1464
        unlk fp
        rts
        .size   _f, .-_f

$ as foo.s -o foo.o
$ objdump -f foo.o

foo.o:     file format a.out-m68k-netbsd
architecture: m68k, flags 0x0000003f:
HAS_RELOC, EXEC_P, HAS_LINENO, HAS_DEBUG, HAS_SYMS, HAS_LOCALS
start address 0x00000000

Now there is no problem, even for a.out gas, wich has --register-prefix-optional enabled by default, because there is no ambiguity thanks to the symbol prefix.

I think this kind of bug may appear on any target using a.out with gcc 3. As it has been fixed in gcc 4, we could say that it was a gcc bug, and gas is not in cause.

Vincent Rivière


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