Bug 24610 - The comment start symbol of arm target
Summary: The comment start symbol of arm target
Status: RESOLVED INVALID
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 4.1.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-11-01 07:31 UTC by Hanzac Chen
Modified: 2005-11-02 10:13 UTC (History)
1 user (show)

See Also:
Host: i686-pc-mingw32
Target: arm-wince-pe
Build: i686-pc-mingw32
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Hanzac Chen 2005-11-01 07:31:50 UTC
It's true that the arm comment start symbol is '@', but GCC will generate some assembler code end with a '@' and a comment without a separator so it can't be parsed by gas.

For example, I compile the libgcc2.c:__gcc_bcmp with xgcc, it failed:
_____________________________________________________________________
/* Like bcmp except the sign is meaningful.
   Result is negative if S1 is less than S2,
   positive if S1 is greater, 0 if S1 and S2 are equal.  */

int
__gcc_bcmp (const unsigned char *s1, const unsigned char *s2, size_t size)
{
  while (size > 0)
    {
      const unsigned char c1 = *s1++, c2 = *s2++;
      if (c1 != c2)
	return c1 - c2;
      size--;
    }
  return 0;
}
_____________________________________________________________________
I'm compile gcc under cygwin and mingw32-gcc, binutils-2.16.1 already compiled also with --target=arm-wince-pe, here is the gcc(gcc-4.1-20051022) configuration:
$ ./configure --disable-nls --disable-win32-registry --enable-threads=win32 --host=i686-pc-mingw32 --build=i686-pc-mingw32 --target=arm-wince-pe

I also found that if I made a change in gcc-4.1-20051022\gcc\config\arm\aout.h (add a semicolon), it will work:
@@ -294,7 +294,7 @@
 #endif
      
 #ifndef ASM_COMMENT_START
-#define ASM_COMMENT_START "@"
+#define ASM_COMMENT_START ";@"
 #endif
 
 /* This works for GAS and some other assemblers.  */

See also in: http://gcc.gnu.org/ml/gcc/2005-10/msg01215.html
Comment 1 Richard Earnshaw 2005-11-01 09:37:47 UTC
Subject: Re:   New: The comment start symbol of arm target

On Tue, 2005-11-01 at 07:31, hanzac at gmail dot com wrote:
> It's true that the arm comment start symbol is '@', but GCC will generate some
> assembler code end with a '@' and a comment without a separator so it can't be
> parsed by gas.

No, it shouldn't.  '@' is the comment symbol in GAS for ARM.  Any other
use of '@' by gcc in ARM code is a bug.  So the question is where is
this coming from.  I don't have a wince build, so can you post an
assembly code fragment that demonstrates this problem?


> @@ -294,7 +294,7 @@
>  #endif
> 
>  #ifndef ASM_COMMENT_START
> -#define ASM_COMMENT_START "@"
> +#define ASM_COMMENT_START ";@"
>  #endif

This is incorrect.  ';' is a statement separator, not a comment
separator.

Comment 2 Hanzac Chen 2005-11-02 06:27:30 UTC
I made a clean compilation, here is the result, even the existing assembler code can't pass. (gcc/config/arm/lib1funcs.asm)

/cygdrive/e/gcc-4.1-20051029/host-i686-pc-mingw32/gcc/xgcc -B/cygdrive/e/gcc-4.1-20051029/host-i686-pc-mingw32/gcc/ -B/usr/local/arm-wince-pe/bin/ -B/usr/local/arm-wince-pe/lib/ -isystem /usr/local/arm-wince-pe/include -isystem /usr/local/arm-wince-pe/sys-include -O2  -O2 -g -O2   -DIN_GCC -DCROSS_COMPILE   -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition  -isystem ./include  -Dinhibit_libc -g -DHAVE_GTHR_DEFAULT -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED -Dinhibit_libc -I. -I. -I../.././gcc -I../.././gcc/. -I../.././gcc/../include -I../.././gcc/../libcpp/include  -DL_udivsi3 -xassembler-with-cpp -c ../.././gcc/config/arm/lib1funcs.asm -o libgcc/./_udivsi3.o
../.././gcc/config/arm/lib1funcs.asm: Assembler messages:
../.././gcc/config/arm/lib1funcs.asm:1: Error: invalid character '@' in mnemonic
../.././gcc/config/arm/lib1funcs.asm:2: Error: invalid character '@' in mnemonic
../.././gcc/config/arm/lib1funcs.asm:65: Error: invalid character '@' in mnemonic
../.././gcc/config/arm/lib1funcs.asm:730: Error: too many memory references for `sub'
../.././gcc/config/arm/lib1funcs.asm:731: Error: no such instruction: `moveq pc,lr'
../.././gcc/config/arm/lib1funcs.asm:732: Error: no such instruction: `bcc Ldiv0'
../.././gcc/config/arm/lib1funcs.asm:733: Error: too many memory references for `cmp'
../.././gcc/config/arm/lib1funcs.asm:734: Error: no such instruction: `bls 11f'
../.././gcc/config/arm/lib1funcs.asm:735: Error: no such instruction: `tst r1,r2'
../.././gcc/config/arm/lib1funcs.asm:736: Error: no such instruction: `beq 12f'
../.././gcc/config/arm/lib1funcs.asm:373: Error: invalid character '@' in mnemonic
../.././gcc/config/arm/lib1funcs.asm:373: Error: invalid character '@' in mnemonic
../.././gcc/config/arm/lib1funcs.asm:373: Error: invalid character '@' in mnemonic
../.././gcc/config/arm/lib1funcs.asm:373: Error: invalid character '@' in mnemonic
../.././gcc/config/arm/lib1funcs.asm:373: Error: no such instruction: `tst r1,'
../.././gcc/config/arm/lib1funcs.asm:373: Error: no such instruction: `moveq r1,r1,lsl'
../.././gcc/config/arm/lib1funcs.asm:373: Error: no such instruction: `moveq r3,'
../.././gcc/config/arm/lib1funcs.asm:373: Error: no such instruction: `movne r3,'
../.././gcc/config/arm/lib1funcs.asm:373: Error: invalid character '@' in mnemonic
../.././gcc/config/arm/lib1funcs.asm:373: Error: invalid character '@' in mnemonic
../.././gcc/config/arm/lib1funcs.asm:373: Error: invalid character '@' in mnemonic
../.././gcc/config/arm/lib1funcs.asm:373: Error: invalid character '@' in mnemonic
../.././gcc/config/arm/lib1funcs.asm:373: Error: expecting operand after ','; got nothing
../.././gcc/config/arm/lib1funcs.asm:373: Error: no such instruction: `cmplo r1,r0'
../.././gcc/config/arm/lib1funcs.asm:373: Error: no such instruction: `movlo r1,r1,lsl'
../.././gcc/config/arm/lib1funcs.asm:373: Error: no such instruction: `movlo r3,r3,lsl'
../.././gcc/config/arm/lib1funcs.asm:373: Error: no such instruction: `blo 1b'
../.././gcc/config/arm/lib1funcs.asm:373: Error: invalid character '@' in mnemonic
../.././gcc/config/arm/lib1funcs.asm:373: Error: invalid character '@' in mnemonic
../.././gcc/config/arm/lib1funcs.asm:373: Error: expecting operand after ','; got nothing
../.././gcc/config/arm/lib1funcs.asm:373: Error: no such instruction: `cmplo r1,r0'
../.././gcc/config/arm/lib1funcs.asm:373: Error: no such instruction: `movlo r1,r1,lsl'
../.././gcc/config/arm/lib1funcs.asm:373: Error: no such instruction: `movlo r3,r3,lsl'
../.././gcc/config/arm/lib1funcs.asm:373: Error: no such instruction: `blo 1b'
../.././gcc/config/arm/lib1funcs.asm:373: Error: expecting operand after ','; got nothing
../.././gcc/config/arm/lib1funcs.asm:373: Error: invalid character '@' in mnemonic
../.././gcc/config/arm/lib1funcs.asm:373: Error: too many memory references for `cmp'
../.././gcc/config/arm/lib1funcs.asm:373: Error: no such instruction: `subhs r0,r0,r1'
../.././gcc/config/arm/lib1funcs.asm:373: Error: no such instruction: `orrhs r2,r2,r3'
../.././gcc/config/arm/lib1funcs.asm:373: Error: too many memory references for `cmp'
../.././gcc/config/arm/lib1funcs.asm:373: Error: no such instruction: `subhs r0,r0,r1,lsr'
../.././gcc/config/arm/lib1funcs.asm:373: Error: no such instruction: `orrhs r2,r2,r3,lsr'
../.././gcc/config/arm/lib1funcs.asm:373: Error: too many memory references for `cmp'
../.././gcc/config/arm/lib1funcs.asm:373: Error: no such instruction: `subhs r0,r0,r1,lsr'
../.././gcc/config/arm/lib1funcs.asm:373: Error: no such instruction: `orrhs r2,r2,r3,lsr'
../.././gcc/config/arm/lib1funcs.asm:373: Error: too many memory references for `cmp'
../.././gcc/config/arm/lib1funcs.asm:373: Error: no such instruction: `subhs r0,r0,r1,lsr'
../.././gcc/config/arm/lib1funcs.asm:373: Error: no such instruction: `orrhs r2,r2,r3,lsr'
../.././gcc/config/arm/lib1funcs.asm:373: Error: expecting operand after ','; got nothing
../.././gcc/config/arm/lib1funcs.asm:373: Error: no such instruction: `movnes r3,r3,lsr'
../.././gcc/config/arm/lib1funcs.asm:373: Error: no such instruction: `movne r1,r1,lsr'
../.././gcc/config/arm/lib1funcs.asm:373: Error: no such instruction: `bne 1b'
../.././gcc/config/arm/lib1funcs.asm:740: Error: too many memory references for `mov'
../.././gcc/config/arm/lib1funcs.asm:741: Error: too many memory references for `mov'
../.././gcc/config/arm/lib1funcs.asm:743: Error: no such instruction: `moveq r0,'
../.././gcc/config/arm/lib1funcs.asm:744: Error: no such instruction: `movne r0,'
../.././gcc/config/arm/lib1funcs.asm:745: Error: too many memory references for `mov'
../.././gcc/config/arm/lib1funcs.asm:435: Error: expecting operand after ','; got nothing
../.././gcc/config/arm/lib1funcs.asm:435: Error: no such instruction: `movhs r1,r1,lsr'
../.././gcc/config/arm/lib1funcs.asm:435: Error: no such instruction: `movhs r2,'
../.././gcc/config/arm/lib1funcs.asm:435: Error: no such instruction: `movlo r2,'
../.././gcc/config/arm/lib1funcs.asm:435: Error: expecting operand after ','; got nothing
../.././gcc/config/arm/lib1funcs.asm:435: Error: no such instruction: `movhs r1,r1,lsr'
../.././gcc/config/arm/lib1funcs.asm:435: Error: no such instruction: `addhs r2,r2,'
../.././gcc/config/arm/lib1funcs.asm:435: Error: expecting operand after ','; got nothing
../.././gcc/config/arm/lib1funcs.asm:435: Error: no such instruction: `movhs r1,r1,lsr'
../.././gcc/config/arm/lib1funcs.asm:435: Error: no such instruction: `addhs r2,r2,'
../.././gcc/config/arm/lib1funcs.asm:435: Error: expecting operand after ','; got nothing
../.././gcc/config/arm/lib1funcs.asm:435: Error: no such instruction: `addhi r2,r2,'
../.././gcc/config/arm/lib1funcs.asm:435: Error: no such instruction: `addls r2,r2,r1,lsr'
../.././gcc/config/arm/lib1funcs.asm:749: Error: too many memory references for `mov'
../.././gcc/config/arm/lib1funcs.asm:750: Error: too many memory references for `mov'
../.././gcc/config/arm/lib1funcs.asm:754: Error: invalid char '[' beginning operand 2 `[sp'
../.././gcc/config/arm/lib1funcs.asm:754: Error: too many positional arguments
../.././gcc/config/arm/lib1funcs.asm:754: Error: no such instruction: `bl ___div0'
../.././gcc/config/arm/lib1funcs.asm:754: Error: expecting operand after ','; got nothing
../.././gcc/config/arm/lib1funcs.asm:195: Error: no such instruction: `ldr pc,[sp],'
../.././gcc/config/arm/lib1funcs.asm:765: Error: no such instruction: `stmfd sp!,{r0,r1,lr}'
../.././gcc/config/arm/lib1funcs.asm:766: Error: no such instruction: `bl ___udivsi3'
../.././gcc/config/arm/lib1funcs.asm:767: Error: no such instruction: `ldmfd sp!,{r1,r2,lr}'
../.././gcc/config/arm/lib1funcs.asm:768: Error: too many memory references for `mul'
../.././gcc/config/arm/lib1funcs.asm:769: Error: too many memory references for `sub'
../.././gcc/config/arm/lib1funcs.asm:770: Error: too many memory references for `mov'
../.././gcc/config/arm/ieee754-df.S:44: Error: invalid character '@' in mnemonic
../.././gcc/config/arm/ieee754-df.S:45: Error: invalid character '@' in mnemonic
make[3]: *** [libgcc/./_udivsi3.o] Error 1
make[3]: Leaving directory `/cygdrive/e/gcc-4.1-20051029/host-i686-pc-mingw32/gcc'
make[2]: *** [stmp-multilib] Error 2
make[2]: Leaving directory `/cygdrive/e/gcc-4.1-20051029/host-i686-pc-mingw32/gcc'
make[1]: *** [all-gcc] Error 2
make[1]: Leaving directory `/cygdrive/e/gcc-4.1-20051029'
Comment 3 Richard Earnshaw 2005-11-02 10:13:24 UTC
> ../.././gcc/config/arm/lib1funcs.asm:731: Error: no such instruction: `moveq pc,lr'

This just shows that you aren't picking up an ARM assembler.  Have you installed GAS correctly? and does the compiler know how to find it?

If you've not build a cross-compilation toolchain before, it might help to take a look at crosstool (http://kegel.com/crosstool/)