This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] always define __sparc64__ on ultrasparc

On Fri, May 17, 2002 at 12:08:14AM -0700, David O'Brien wrote:

 > Why?  As you said:
 >     but the NetBSD convention is to also -D__$(MACHINE_ARCH)__, where
 >     MACHINE_ARCH == i386, sparc, sparc64, alpha, m68k, sh, whatever.

When NetBSD's "sparc64" port is running a 32-bit kernel, it reports
a $(MACHINE_ARCH) of "sparc", not "sparc64".  In theory, 32-bit ultrasparc
binaries could be run on e.g. sparcv8 machines, if the kernel emulated
the non-implemented insns.

 > (actually that is a *BSD convention)  Since I want to add __sparc64__ to
 > show the platform, not it's LP size, why it would it break NetBSD?  If
 > you are doing -mcpu=ultrasparc, regardless of -m32 or -m64, you are
 > running on a NetBSD/sparc64 system.  Or does this hurt in some cross
 > compiler configuration?

NetBSD has 2 variables at play here:

	* MACHINE_ARCH -- the "architecture".

	* MACHINE -- a specific platform.

So, e.g. an iMac running NetBSD would be MACHINE == "macppc" and
MACHINE_ARCH == "powerpc".

In the case of an Ultra 10 running NetBSD... if the kernel is a
64-bit kernel, MACHINE_ARCH == "sparc64" or "sparc" for a 32-bit
kernel.  MACHINE always is "sparc64" in this case.

So, as I said, in NetBSD, we define -D__$(MACHINE_ARCH)__, which is:

	-mcpu=ultrasparc -m32 .. __sparc__ (and __sparc_v9__)

	-mcpu=ultrasparc -m64 .. __sparc64__ (and __sparc_v9__ and __arch64__)

...and thus your proposed change would break this for NetBSD.

        -- Jason R. Thorpe <>

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]