Subject: port-m68k/6265: minor bug in assembler output from gcc (produces 'empty' symbols)
To: None <gnats-bugs@gnats.netbsd.org>
From: Chas Williams <chas@cmf.nrl.navy.mil>
List: netbsd-bugs
Date: 10/08/1998 15:42:03
>Number:         6265
>Category:       port-m68k
>Synopsis:       extra whitespace in gcc's output confuses gas.new
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    gnats-admin (GNATS administrator)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Oct  8 12:50:01 1998
>Last-Modified:
>Originator:     
>Organization:
	
>Release:        10/8/98
>Environment:
	NetBSD thirdoffive 1.3H NetBSD 1.3H (CURRENT) #6: Tue Oct  6 19:57:49 PDT 1998     chas@thirdoffive:/usr/current/src/sys/arch/mac68k/compile/CURRENT mac68k



>Description:
	gcc is emitting .type directives following by <TAB><SPACE><SYMBOL>
	this confuses gas.new (see app.c, the comments about state 9 and
	10)
	
	why am i using gas.new with the old gcc?  i dont know i must be 
	nuts, but i would like to verify the proper operation of gas.new
	against a known compiler.

>How-To-Repeat:
	run the following through gas.new:

        #NO_APP
	.text
	.globl __obstack_begin
	.type   __obstack_begin,@function

	(make sure its:  .type<TAB><SPACE>__obstack...)

	then, % nm -p a.out
	 U __obstack_begin
	 U 

	you get a strange 'empty' symbol.

	

>Fix:
	you could fix gas.new, but that would be much harder than fixing
	gcc.
	apply the following diff to /usr/src/gnu/usr.bin/gcc/arch/netbsd.h

diff -u netbsd.h.000 netbsd.h
--- netbsd.h.000        Thu Oct  8 12:22:57 1998
+++ netbsd.h    Thu Oct  8 12:36:21 1998
@@ -142,7 +142,7 @@
 #undef ASM_DECLARE_FUNCTION_NAME
 #define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL)                    \
   do {                                                                 \
-    fprintf (FILE, "\t%s\t ", TYPE_ASM_OP);                            \
+    fprintf (FILE, "\t%s\t", TYPE_ASM_OP);                             \
     assemble_name (FILE, NAME);                                                
\
     putc (',', FILE);                                                  \
     fprintf (FILE, TYPE_OPERAND_FMT, "function");                      \
@@ -156,7 +156,7 @@
 #undef ASM_DECLARE_OBJECT_NAME
 #define ASM_DECLARE_OBJECT_NAME(FILE, NAME, DECL)                      \
   do {                                                                 \
-    fprintf (FILE, "\t%s\t ", TYPE_ASM_OP);                            \
+    fprintf (FILE, "\t%s\t", TYPE_ASM_OP);                             \
     assemble_name (FILE, NAME);                                                
\
     putc (',', FILE);                                                  \
     fprintf (FILE, TYPE_OPERAND_FMT, "object");                                
\
@@ -165,7 +165,7 @@
     if (!flag_inhibit_size_directive && DECL_SIZE (DECL))              \
       {                                                                        
\
        size_directive_output = 1;                                      \
-       fprintf (FILE, "\t%s\t ", SIZE_ASM_OP);                         \
+       fprintf (FILE, "\t%s\t", SIZE_ASM_OP);                          \
        assemble_name (FILE, NAME);                                     \
        fprintf (FILE, ",%d\n",  int_size_in_bytes (TREE_TYPE (DECL))); \
       }                                                                        
\
@@ -188,7 +188,7 @@
         && !size_directive_output)                                      \
        {                                                                \
         size_directive_output = 1;                                      \
-        fprintf (FILE, "\t%s\t ", SIZE_ASM_OP);                         \
+        fprintf (FILE, "\t%s\t", SIZE_ASM_OP);                  \
         assemble_name (FILE, name);                                     \
         fprintf (FILE, ",%d\n",  int_size_in_bytes (TREE_TYPE (DECL))); \
        }                                                                \
@@ -206,7 +206,7 @@
        labelno++;                                                      \
        ASM_GENERATE_INTERNAL_LABEL (label, "Lfe", labelno);            \
        ASM_OUTPUT_INTERNAL_LABEL (FILE, "Lfe", labelno);               \
-       fprintf (FILE, "\t%s\t ", SIZE_ASM_OP);                         \
+       fprintf (FILE, "\t%s\t", SIZE_ASM_OP);                          \
        assemble_name (FILE, (FNAME));                                  \
         fprintf (FILE, ",");                                           \
        assemble_name (FILE, label);                                    \

>Audit-Trail:
>Unformatted: