Subject: bin/7466: #ident vs. as
To: None <gnats-bugs@gnats.netbsd.org>
From: Hubert Feyrer <feyrer@rfhs8012.fh-regensburg.de>
List: netbsd-bugs
Date: 04/24/1999 09:20:57
>Number:         7466
>Category:       bin
>Synopsis:       #ident vs. as
>Confidential:   yes
>Severity:       serious
>Priority:       medium
>Responsible:    bin-bug-people (Utility Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Apr 24 09:20:00 1999
>Last-Modified:
>Originator:     Hubert Feyrer
>Organization:
-- 
Hubert Feyrer <hubert.feyrer@rz.uni-regensburg.de>
>Release:        19990422
>Environment:
	
System: NetBSD nc 1.4_BETA NetBSD 1.4_BETA (NC) #32: Sat Apr 24 14:00:42 MEST 1999     feyrer@nc:/usr/cvs/src/sys/arch/arm32/compile/NC arm32


>Description:
	A (C) source line of the form

#ident  "@(#)atom.c     26.24   93/06/28 SMI"

	causes compilation to abort on (at least) arm32:

nc# make
gcc -O2   -I/usr/X11R6/include -I..   -I/usr/X11R6/include   -DCSRG_BASED   -DFUNCPROTO=15 -DNARROWPROTO  -DSHAPE -DSUNOS41 -DOW_I18N_L3  -c atom.c
/tmp/ccJVPAwi.s: Assembler messages:
/tmp/ccJVPAwi.s:10: Error: Rest of line ignored. First ignored character is `-'.

	Lines 9-11 of the assembly file are:

___gnu_compiled_c:
- - - ident @(#)atom.c  26.24   93/06/28 SMI
.text

	"as -v" on arm32 says: 
	GNU assembler version 2.9.1 (arm--netbsd), using BFD version 2.9.1

	This problem does not arise on 1.4_BETA sparc and an older 
	i386-current:

	i386:  as -v => GNU assembler version 1.92.3, NetBSD $Revision: 1.3 $
	sparc: as -v => GNU assembler version 2.9.1 (sparc--netbsd), using BFD version 2.9.1

	The generated assembly language lines from the #ident line are:
	i386:   .ident "@(#)atom.c     26.24   93/06/28 SMI"
	sparc:  .ident  "@(#)atom.c     26.24   93/06/28 SMI"

	Here is what "info cpp" says:

   The `#ident' directive is supported for compatibility with certain
other systems.  It is followed by a line of text.  On some systems, the
text is copied into a special place in the object file; on most systems,
the text is ignored and this directive has no effect.  Typically
`#ident' is only used in header files supplied with those systems where
it is meaningful.



>How-To-Repeat:
	On arm32, do:

cat >ident.c <EOF
#ident  "@(#)atom.c     26.24   93/06/28 SMI"

#include <stdio.h>

int main(void)
{
        printf("bla\n");
        return 0;
}
EOF
gcc ident.c -o ident
gcc ident.c -o ident
/tmp/ccQ1RMLY.s: Assembler messages:
/tmp/ccQ1RMLY.s:10: Error: Rest of line ignored. First ignored character is `-'.


>Fix:
	Probably. :)
	At least make behaviour consistent between architecture.
>Audit-Trail:
>Unformatted: