Subject: RE: leading/trailing underscores?
To: Tim Rightnour <root@garbled.net>
From: None <mcmahill@mtl.mit.edu>
List: tech-toolchain
Date: 01/11/1999 12:59:00
On Mon, 11 Jan 1999, Tim Rightnour wrote:

> 
> On 11-Jan-99 mcmahill@mtl.mit.edu spoke unto us all:
> #  I looked on a few different machines to see if __ELF__ is defined
> #  by 'cpp -dM < /dev/null'  and I'm seeing some inconsistency here as well.
> #  for example, on your alpha, I see
> #  
> # #define __NetBSD__ 1
> # #define __KPRINTF_ATTRIBUTE__ 1
> # #define __alpha__ 1
> # #define __GNUC__ 1
> # #define __ELF__ 1
> # #define __alpha 1
> #  
> #  on my mac68k,
> #  
> # #define __NetBSD__ 1
> # #define __KPRINTF_ATTRIBUTE__ 1
> # #define mc68000 1
> # #define mc68020 1
> # #define __GNUC__ 1
> # #define m68k 1
> # #define unix 1
> 
> I'm assuming this is 1.3.. still if we don't predefine "unix" anymore, why do
> we define m68k and the mc68 defines?
yes.  I should have mentioned that.  The mac68k machine is NetBSD-1.3


> #  
> #  on my pmax,
> #  
> # #define R3000 1
> # #define SYSTYPE_BSD 1
> # #define __NO_LEADING_UNDERSCORES__ 1
> # #define __ANSI_COMPAT 1
> # #define __NetBSD__ 1
> # #define __KPRINTF_ATTRIBUTE__ 1
> # #define _R3000 1
> # #define MIPSEL 1
> # #define __GP_SUPPORT__ 1
> # #define mips 1
> # #define __GNUC__ 1
> # #define _SYSTYPE_BSD 1
> # #define unix 1
> 
> Hrmmm..  that should definately define __ELF__.. how odd...
thats what I thought.  The pmax is NetBSD-1.3.2. 

but I guess, back to the original question, that in terms of leading
underscores, the thing to do is something like:

#if defined(__ELF__) || defined(mips)
#define ENTRY_NAME "myfunction"
#else
#define ENTRY_NAME "_myfunction"
#endif

or something like that.  The ||defined(mips) takes care of broken(?) pmax
machines that don't define __ELF__

Sound right to you?

-Dan