This is the mail archive of the gcc-patches@gcc.gnu.org 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] Define _LP64 on x86-64?


Richard Henderson <rth at redhat dot com> writes:

> On Mon, Oct 14, 2002 at 10:22:09AM +0200, Gwenole Beauchesne wrote:
>> I believe __LP64__ was first defined but wasn't the right one (PR 
>> target/5886). Then Richard added _LP64. I think the latter is the most 
>> commonly used, isn't it? Humm, pa64-linux.h only defines __LP64__.
>
> *shrug* Are we suggesting that _all_ 64-bit linux targets
> should define this value?  If so, then please do add it to
> all of them, not just one more.

The qustion is what should get defined?
* only __LP64__ (as done by pa64-linux.h)
* only _LP64 (which is defined by the ia64 ABI as needed)
* both of them?

The Linux Kernel check __LP64__ in a number of places and I have
therefore defined both now.

Or should we define this independed of the OS?  In that case I'll add
this to TARGET_CPU_CPP_BUILTINS instead.

Ok to commit for both 3.3 and mainline?

I'm currently bootstrapping/regtesting on Linux/x86-64.

Andreas

2003-03-09  Andreas Jaeger  <aj at suse dot de>

	* config/sparc/linux64.h (CPP_ARCH64_SPEC): Define.

	* config/i386/linux64.h (TARGET_OS_CPP_BUILTINS): Define __LP64__
	and _LP64 for 64-bit Linux.
	* config/rs6000/linux64.h (TARGET_OS_CPP_BUILTINS): Likewise.
	* config/alpha/linux.h (TARGET_OS_CPP_BUILTINS): Likewise.
	* config/s390/linux.h (TARGET_OS_CPP_BUILTINS): Likewise.

============================================================
Index: gcc/config/sparc/linux64.h
--- config/sparc/linux64.h	16 Dec 2002 18:21:58 -0000	1.65
+++ config/sparc/linux64.h	9 Mar 2003 11:57:08 -0000
@@ -1,5 +1,5 @@
 /* Definitions for 64-bit SPARC running Linux-based GNU systems with ELF.
-   Copyright 1996, 1997, 1998, 2000, 2002 Free Software Foundation, Inc.
+   Copyright 1996, 1997, 1998, 2000, 2002, 2003 Free Software Foundation, Inc.
    Contributed by David S. Miller (davem at caip dot rutgers dot edu)
 
 This file is part of GNU CC.
@@ -47,6 +47,10 @@ Boston, MA 02111-1307, USA.  */
 -D__GCC_NEW_VARARGS__ -Acpu=sparc -Amachine=sparc"
 
 #endif
+
+#undef CPP_ARCH64_SPEC
+#define CPP_ARCH64_SPEC "-D__arch64__ -Acpu=sparc64 -Amachine=sparc64 -D_LP64 -D__LP64__"
+
 
 /* Provide a STARTFILE_SPEC appropriate for GNU/Linux.  Here we add
    the GNU/Linux magical crtbegin.o file (see crtstuff.c) which
============================================================
Index: gcc/config/i386/linux64.h
--- config/i386/linux64.h	14 Jan 2003 13:33:02 -0000	1.19
+++ config/i386/linux64.h	9 Mar 2003 11:57:08 -0000
@@ -1,5 +1,5 @@
 /* Definitions for AMD x86-64 running Linux-based GNU systems with ELF format.
-   Copyright (C) 2001, 2002 Free Software Foundation, Inc.
+   Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
    Contributed by Jan Hubicka <jh at suse dot cz>, based on linux.h.
 
 This file is part of GNU CC.
@@ -35,6 +35,11 @@ Boston, MA 02111-1307, USA.  */
 	  {							\
 	    builtin_define ("__PIC__");				\
 	    builtin_define ("__pic__");				\
+	  }							\
+	if (TARGET_64BIT)					\
+	  {							\
+	    builtin_define ("_LP64");				\
+	    builtin_define ("__LP64__");			\
 	  }							\
     }								\
   while (0)
============================================================
Index: gcc/config/rs6000/linux64.h
--- config/rs6000/linux64.h	16 Dec 2002 18:21:46 -0000	1.32
+++ config/rs6000/linux64.h	9 Mar 2003 11:57:08 -0000
@@ -1,6 +1,6 @@
 /* Definitions of target machine for GNU compiler,
    for 64 bit PowerPC linux.
-   Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc.
+   Copyright (C) 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
 
 This file is part of GNU CC.
 
@@ -122,6 +122,11 @@ Boston, MA 02111-1307, USA.  */
       builtin_define ("__ELF__");           \
       builtin_assert ("cpu=powerpc64");     \
       builtin_assert ("machine=powerpc64"); \
+      if (TARGET_64BIT)			    \
+	{				    \
+	  builtin_define ("_LP64");	    \
+	  builtin_define ("__LP64__");	    \
+	}				    \
     }                                       \
   while (0)
 
============================================================
Index: gcc/config/alpha/linux.h
--- config/alpha/linux.h	22 Feb 2003 18:30:20 -0000	1.33
+++ config/alpha/linux.h	9 Mar 2003 11:57:08 -0000
@@ -1,6 +1,6 @@
 /* Definitions of target machine for GNU compiler,
    for Alpha Linux-based GNU systems.
-   Copyright (C) 1996, 1997, 1998, 2002 Free Software Foundation, Inc.
+   Copyright (C) 1996, 1997, 1998, 2002, 2003 Free Software Foundation, Inc.
    Contributed by Richard Henderson.
 
 This file is part of GNU CC.
@@ -27,6 +27,8 @@ Boston, MA 02111-1307, USA.  */
     do {							\
 	builtin_define ("__gnu_linux__");			\
 	builtin_define ("_LONGLONG");				\
+	builtin_define ("_LP64");				\
+	builtin_define ("__LP64__");				\
 	builtin_define_std ("linux");				\
 	builtin_define_std ("unix");				\
 	builtin_assert ("system=linux");			\
============================================================
Index: gcc/config/s390/linux.h
--- config/s390/linux.h	21 Nov 2002 12:03:49 -0000	1.28
+++ config/s390/linux.h	9 Mar 2003 11:57:08 -0000
@@ -1,5 +1,5 @@
 /* Definitions for Linux for S/390.
-   Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
    Contributed by Hartmut Penner (hpenner at de dot ibm dot com) and
                   Ulrich Weigand (uweigand at de dot ibm dot com).
 
@@ -64,6 +64,11 @@ Boston, MA 02111-1307, USA.  */
           builtin_define ("__PIC__");		\
           builtin_define ("__pic__");		\
         }					\
+      if (TARGET_64BIT)				\
+	{					\
+	  builtin_define ("_LP64");		\
+	  builtin_define ("__LP64__");		\
+	}					\
     }						\
   while (0)
 

-- 
 Andreas Jaeger
  SuSE Labs aj at suse dot de
   private aj at arthur dot inka dot de
    http://www.suse.de/~aj


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