Subject: Re: prepeneded underscores in gcc
To: John Hayward <>
From: Bill Studenmund <>
List: current-users
Date: 08/02/2000 19:36:24
On Wed, 2 Aug 2000, Jason R Thorpe wrote:

> On Wed, Aug 02, 2000 at 01:31:10PM -0500, John Hayward wrote:
>  >    I am trying to port Modula-3 to NetBSD-1.5 and ran into a slight
>  > problem with gcc.  It appears that under 1.4 and earlier a C identifier
>  > has an underscore prepended to it while under 1.5 there is no such
>  > identifier.  The cross compiler I have produces assembler with the
>  > prepended underscrore and I was able to things to port to 1.4.  Under 1.5
>  > however the c code which is compiled generates symbols without the
>  > prepended underscore and then link fails because the assembler source has
>  > the underscores.
>  >    Is there a way to coax gcc to produce underscores in its code
>  > generation under 1.5?
> No.  This is an ELF-vs-a.out issue.  You'll have to teach Modula-3
> how to deal with the difference.

Right. Just for reference, assembly language has a similar problem. We get
around it by using the C preprocessor and the _C_LABEL() macro. This macro
is defined in cdefs_aout.h and cdefs_elf.h, (the correct) one of which is
included by sys/cdefs.h.

So if you can use CPP as part of your assembly sequence, you can try this

Another (probably better) option would be to look at how gcc
differentiates between netbsd and netbsdelf, and act accordingly.

Take care,