[PATCH] cleanup for Alpha targets

David O'Brien obrien@FreeBSD.org
Thu Apr 11 15:09:00 GMT 2002


This patch better centralizes a few things for Alpha ELF targets, and
opens up the possibility of using alpha.h's CPP_SPEC for FreeBSD/alpha.
It also removes an ANSI-C string concatenation violation.

Richard, can you give feedback on how this affects LinuxAlpha?
Jason, can you give feedback on how his affects NetBSD/alpha?


2002-04-11  David O'Brien  <obrien@FreeBSD.org>

	* config.gcc (alpha*-*-openbsd, alpha64-dec-*vms,alpha*-dec-*vms):
	Include {cpu}/{cpu}.h thru tm_file.
	* config/alpha/elf.h (CPP_SUBTARGET_SPEC): Define __ELF__.
	(LINK_SPEC): Remove, is not OS independent.
	* config/alpha/freebsd.h (CPP_SPEC): Do not define __ELF__.
	(LINK_SPEC): Do not need to #undef any longer.
	* config/alpha/linux-ecoff.h (LINK_SPEC): Do not need to #undef
	any longer.
	* config/alpha/linux-elf.h (SUB_CPP_PREDEFINES): Do not define
	__ELF__.
	(LINK_SPEC): Moved here from alpha/elf.h.
	* config/alpha/linux.h (CPP_PREDEFINES): No longer consumer of
	SUB_CPP_PREDEFINES.
	* config/alpha/netbsd.h (CPP_PREDEFINES): Do not define __ELF__.
	(CPP_SPEC): Define _POSIX_SOURCE as needed.
	(CPP_SUBTARGET_SPEC): Do not define.
	(LINK_SPEC): Do not need to #undef any longer.
	* config/alpha/openbsd.h: Do not directly include alpha/alpha.h.
	* config/alpha/vms.h: Likewise.


Index: config.gcc
===================================================================
RCS file: /cvs/gcc/egcs/gcc/config.gcc,v
retrieving revision 1.180
diff -u -r1.180 config.gcc
--- config.gcc	9 Apr 2002 20:07:11 -0000	1.180
+++ config.gcc	11 Apr 2002 21:58:11 -0000
@@ -502,6 +502,7 @@
 	;;
 
 alpha*-*-openbsd*)
+	tm_file="${cpu_type}/${cpu_type}.h ${tm_file}"
 	# default x-alpha is only appropriate for dec-osf.
 	target_cpu_default="MASK_GAS"
 	tmake_file="alpha/t-alpha alpha/t-ieee"
@@ -559,7 +560,7 @@
 	;;
 alpha64-dec-*vms*)
 	xm_defines=POSIX
-	tm_file="alpha/vms.h alpha/vms64.h"
+	tm_file="${tm_file} alpha/vms.h alpha/vms64.h"
 	xm_file="alpha/xm-vms.h alpha/xm-vms64.h"
 	tmake_file="alpha/t-alpha alpha/t-vms alpha/t-vms64 alpha/t-ieee"
 	xmake_file=alpha/x-vms
@@ -577,7 +578,7 @@
 	;;
 alpha*-dec-*vms*)
 	xm_defines=POSIX
-	tm_file=alpha/vms.h
+	tm_file="${tm_file} alpha/vms.h"
 	xm_file=alpha/xm-vms.h
 	tmake_file="alpha/t-alpha alpha/t-vms alpha/t-ieee"
 	xmake_file=alpha/x-vms
Index: config/alpha/elf.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/config/alpha/elf.h,v
retrieving revision 1.53
diff -u -r1.53 elf.h
--- config/alpha/elf.h	31 Mar 2002 11:50:41 -0000	1.53
+++ config/alpha/elf.h	11 Apr 2002 21:58:11 -0000
@@ -35,21 +35,14 @@
 
 #undef ASM_FINAL_SPEC
 
+#undef  CPP_SUBTARGET_SPEC
+#define CPP_SUBTARGET_SPEC "-D__ELF__"
+
 #undef  CC1_SPEC
 #define CC1_SPEC  "%{G*}"
 
 #undef  ASM_SPEC
 #define ASM_SPEC  "%{G*} %{relax:-relax} %{!gstabs*:-no-mdebug}%{gstabs*:-mdebug}"
-
-#undef  LINK_SPEC
-#define LINK_SPEC "-m elf64alpha %{G*} %{relax:-relax}		\
-  %{O*:-O3} %{!O*:-O1}						\
-  %{shared:-shared}						\
-  %{!shared:							\
-    %{!static:							\
-      %{rdynamic:-export-dynamic}				\
-      %{!dynamic-linker:-dynamic-linker %(elf_dynamic_linker)}}	\
-    %{static:-static}}"
 
 /* Output at beginning of assembler file.  */
 #undef  ASM_FILE_START
Index: config/alpha/freebsd.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/config/alpha/freebsd.h,v
retrieving revision 1.7
diff -u -r1.7 freebsd.h
--- config/alpha/freebsd.h	11 Apr 2002 18:11:53 -0000	1.7
+++ config/alpha/freebsd.h	11 Apr 2002 21:58:11 -0000
@@ -25,13 +25,12 @@
    deal with the Alpha's FP issues.  */
 
 #undef  CPP_SPEC
-#define CPP_SPEC "%(cpp_cpu) %(cpp_subtarget) -D__ELF__			\
+#define CPP_SPEC "%(cpp_cpu) %(cpp_subtarget)				\
   %{fPIC:-D__PIC__ -D__pic__} %{fpic:-D__PIC__ -D__pic__}		\
   %{posix:-D_POSIX_SOURCE}						\
   %{mieee:-D_IEEE_FP}							\
   %{mieee-with-inexact:-D_IEEE_FP -D_IEEE_FP_INEXACT}"
 
-#undef  LINK_SPEC
 #define LINK_SPEC "%{G*} %{relax:-relax}				\
   %{p:%e`-p' not supported; use `-pg' and gprof(1)}			\
   %{Wl,*:%*}								\
Index: config/alpha/linux-ecoff.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/config/alpha/linux-ecoff.h,v
retrieving revision 1.4
diff -u -r1.4 linux-ecoff.h
--- config/alpha/linux-ecoff.h	11 Jan 1999 13:33:52 -0000	1.4
+++ config/alpha/linux-ecoff.h	11 Apr 2002 21:58:11 -0000
@@ -26,7 +26,6 @@
 #undef CPP_SUBTARGET_SPEC
 #define CPP_SUBTARGET_SPEC "-D__ECOFF__"
 
-#undef LINK_SPEC
 #define LINK_SPEC "-G 8 %{O*:-O3} %{!O*:-O1}"
 
 /* stabs get slurped by the assembler into a queer ecoff format.  */
Index: config/alpha/linux-elf.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/config/alpha/linux-elf.h,v
retrieving revision 1.6
diff -u -r1.6 linux-elf.h
--- config/alpha/linux-elf.h	21 Jul 2001 09:42:19 -0000	1.6
+++ config/alpha/linux-elf.h	11 Apr 2002 21:58:11 -0000
@@ -27,14 +27,20 @@
 #define SUBTARGET_EXTRA_SPECS \
 { "elf_dynamic_linker", ELF_DYNAMIC_LINKER },
 
-#undef SUB_CPP_PREDEFINES
-#define SUB_CPP_PREDEFINES	"-D__ELF__"
-
 #ifdef USE_GNULIBC_1
 #define ELF_DYNAMIC_LINKER	"/lib/ld.so.1"
 #else
 #define ELF_DYNAMIC_LINKER	"/lib/ld-linux.so.2"
 #endif
+
+#define LINK_SPEC "-m elf64alpha %{G*} %{relax:-relax}		\
+  %{O*:-O3} %{!O*:-O1}						\
+  %{shared:-shared}						\
+  %{!shared:							\
+    %{!static:							\
+      %{rdynamic:-export-dynamic}				\
+      %{!dynamic-linker:-dynamic-linker %(elf_dynamic_linker)}}	\
+    %{static:-static}}"
 
 #ifndef USE_GNULIBC_1
 #undef LIB_SPEC
Index: config/alpha/linux.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/config/alpha/linux.h,v
retrieving revision 1.25
diff -u -r1.25 linux.h
--- config/alpha/linux.h	12 Dec 2001 06:40:27 -0000	1.25
+++ config/alpha/linux.h	11 Apr 2002 21:58:11 -0000
@@ -25,8 +25,7 @@
 
 #undef CPP_PREDEFINES
 #define CPP_PREDEFINES \
-"-Dlinux -Dunix -Asystem=linux -D_LONGLONG -D__alpha__ " \
-SUB_CPP_PREDEFINES
+  "-Dlinux -Dunix -Asystem=linux -D_LONGLONG -D__alpha__"
 
 /* The GNU C++ standard library requires that these macros be defined.  */
 #undef CPLUSPLUS_CPP_SPEC
Index: config/alpha/netbsd.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/config/alpha/netbsd.h,v
retrieving revision 1.8
diff -u -r1.8 netbsd.h
--- config/alpha/netbsd.h	5 Feb 2002 19:01:46 -0000	1.8
+++ config/alpha/netbsd.h	11 Apr 2002 21:58:11 -0000
@@ -24,7 +24,7 @@
 
 #undef CPP_PREDEFINES
 #define CPP_PREDEFINES							\
-  "-D__NetBSD__ -D__ELF__ -Asystem=unix -Asystem=NetBSD"
+  "-D__NetBSD__ -Asystem=unix -Asystem=NetBSD"
 
 
 /* Show that we need a GP when profiling.  */
@@ -39,18 +39,13 @@
 #define CPP_SPEC							\
   "%{mieee:-D_IEEE_FP}							\
    %{mieee-with-inexact:-D_IEEE_FP -D_IEEE_FP_INEXACT}			\
+   %{posix:-D_POSIX_SOURCE}						\
    %(cpp_cpu) %(cpp_subtarget)"
 
-#undef CPP_SUBTARGET_SPEC
-#define CPP_SUBTARGET_SPEC						\
-  "%{posix:-D_POSIX_SOURCE}"
-
-
 /* Provide a LINK_SPEC appropriate for a NetBSD/alpha ELF target.
    This is a copy of LINK_SPEC from <netbsd-elf.h> tweaked for
    the alpha target.  */
 
-#undef LINK_SPEC
 #define LINK_SPEC							\
   "%{G*} %{relax:-relax}						\
    %{O*:-O3} %{!O*:-O1}							\
Index: config/alpha/openbsd.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/config/alpha/openbsd.h,v
retrieving revision 1.4
diff -u -r1.4 openbsd.h
--- config/alpha/openbsd.h	2 Nov 2000 23:29:08 -0000	1.4
+++ config/alpha/openbsd.h	11 Apr 2002 21:58:11 -0000
@@ -21,8 +21,6 @@
 /* We settle for little endian for now.  */
 #define TARGET_ENDIAN_DEFAULT 0
 
-#include <alpha/alpha.h>
-
 #define OBSD_NO_DYNAMIC_LIBRARIES
 #define OBSD_HAS_DECLARE_FUNCTION_NAME
 #define OBSD_HAS_DECLARE_FUNCTION_SIZE
Index: config/alpha/vms.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/config/alpha/vms.h,v
retrieving revision 1.60
diff -u -r1.60 vms.h
--- config/alpha/vms.h	13 Feb 2002 15:32:02 -0000	1.60
+++ config/alpha/vms.h	11 Apr 2002 21:58:11 -0000
@@ -29,8 +29,6 @@
 
 #define NO_EXTERNAL_INDIRECT_ADDRESS
 
-#include "alpha/alpha.h"
-
 #undef CPP_PREDEFINES
 #define CPP_PREDEFINES \
 "-D__ALPHA -Dvms -DVMS -D__vms__ -D__VMS__ -Asystem=vms"



More information about the Gcc-patches mailing list