From: karl@claude.cs.umb.edu (Karl Berry)
Subject: gcc 2.3.1 on ISC 2.2.1 with gas
Reply-To: karl@cs.umb.edu
Organization: GNUs Not Usenet
Distribution: gnu
Date: Wed, 11 Nov 1992 05:55:39 GMT

GCC 2.3.1 doesn't quite compile as-is on my 486 running Interactive Unix
2.2.1, configured as --with-gnu-as i386-isc.  The first problem was that
temporary labels were defined with a `.' prefix, but not declared with
the `.' in the .long directive.  For example, the assembler output of
cexp.c looked like:

	.long L336
   ... many lines omitted ...
.L336:

(Notice no `.' in the .long statement.)

To fix this, I made the definition of LPREFIX in bsd386.h conditional on
NO_UNDERSCORES (which also determines whether the `.' is prepended).
(See patch below.)  I believe this will only affect those few systems
using bsd386.h and defining NO_UNDERSCORES -- perhaps only ISC.

The second problem was that DBX debugging information wasn't output.  I
changed i386iscgas.h to #undef SDB_DEBUGGING_INFO and #define
DBX_DEBUGGING_INFO.

And the third and so far final problem was that the definitions in
dbxout.c for writing the main output source directory and filename omit
the first character of the label (which in this case is a `.'):

          fprintf (asmfile, "%s \"%s/\",%d,0,0,%s\n", ASM_STABS_OP,
		   cwd, N_SO, &ltext_label_name[1]);
  ...

  fprintf (asmfile, "%s \"%s\",%d,0,0,%s\n", ASM_STABS_OP, input_file_name,
	   N_SO, &ltext_label_name[1]);

I don't understand why this is a good thing, but doubtless that is
simply ignorance on my part.  So I changed i386iscgas.h to essentially
repeat dbxout.c's code except not omit the `.'.

Here are the diffs and ChangeLog entries.


Tue Nov 10 08:38:14 1992  Karl Berry  (karl@cs.umb.edu)

	* i386iscgas.h (SDB_DEBUGGING_INFO): #undef.
        (DBX_DEBUGGING_INFO): #define.
        (DBX_OUTPUT_MAIN_SOURCE_{DIRECTORY,FILENAME}): Override dbxout.c.

	* bsd386.h (LPREFIX) [NO_UNDERSCORES]: Define as `.L'.

*** ./ORIG/bsd386.h	Thu Oct  1 00:52:06 1992
--- ./bsd386.h	Thu Nov  5 12:24:43 1992
***************
*** 28,35 ****
  
  /* Define the syntax of pseudo-ops, labels and comments.  */
  
! /* Prefix for internally generated assembler labels.  */
  #define LPREFIX "L"
  
  /* Assembler pseudos to introduce constants of various size.  */
  
--- 28,41 ----
  
  /* Define the syntax of pseudo-ops, labels and comments.  */
  
! /* Prefix for internally generated assembler labels.  If we aren't using
!    underscores, we are using prefix `.'s to identify labels that should
!    be ignored, as in `i386gas.h' --karl@cs.umb.edu  */
! #ifdef NO_UNDERSCORES
! #define LPREFIX ".L"
! #else
  #define LPREFIX "L"
+ #endif /* not NO_UNDERSCORES */
  
  /* Assembler pseudos to introduce constants of various size.  */
  
*** ./ORIG/i386iscgas.h	Mon Jul 27 22:32:25 1992
--- ./i386iscgas.h	Tue Nov 10 08:34:53 1992
***************
*** 14,19 ****
--- 14,44 ----
  /* But with ISC-specific additions.  */
  #include "isc.h"
  
+ /* We do not want to output SDB debugging information.  */
+ 
+ #undef SDB_DEBUGGING_INFO
+ 
+ /* We want to output DBX debugging information.  */
+ 
+ #define DBX_DEBUGGING_INFO
+ 
+ 
+ /* The function `dbxout_init' in dbxout.c omits the first character of
+    `ltext_label_name' when outputting the main source directory and main
+    source filename.  I don't understand why, but rather than making a
+    system-independent change there, I override dbxout.c's defaults.
+    Perhaps it would be better to use ".Ltext0" instead of
+    `ltext_label_name', but we've already generated the label, so we just
+    use it here.  --karl@cs.umb.edu  */
+ #define DBX_OUTPUT_MAIN_SOURCE_DIRECTORY(asmfile, cwd)			\
+   fprintf (asmfile, "%s \"%s/\",%d,0,0,%s\n", ASM_STABS_OP,		\
+ 	  	     cwd, N_SO, ltext_label_name)
+ #define DBX_OUTPUT_MAIN_SOURCE_FILENAME(asmfile, input_file_name)	\
+   fprintf (asmfile, "%s \"%s\",%d,0,0,%s\n", ASM_STABS_OP, input_file_name,\
+ 	   N_SO, ltext_label_name);					\
+   text_section ();							\
+   ASM_OUTPUT_INTERNAL_LABEL (asmfile, "Ltext", 0)
+ 
  
  /* Because we don't include `svr3.h', we haven't yet defined SIZE_TYPE
     and PTRDIFF_TYPE.  ISC's definitions don't match GCC's defaults, so: */

Newsgroups: gnu.gcc.bug