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]

Fix PR bootstrap/19364


This patch finally removes the dependencies on Solaris config files that SPARC 
embedded targets have developped.  I worked as follows: after folding sol2.h 
and sparc/sol2.h into sparc/elf.h and sparc/sp64-elf.h, I deleted the 
duplicates as well as the macros that are supposed to be Solaris-specific, 
e.g.

/* Solaris 2 uses a wint_t different from the default. This is required
   by the SCD 2.4.1, p. 6-83, Figure 6-66.  */
#undef	WINT_TYPE
#define	WINT_TYPE "long int"

#undef	WINT_TYPE_SIZE
#define	WINT_TYPE_SIZE BITS_PER_WORD

[Solaris is the only SPARC target to define it.]

#define TARGET_HANDLE_PRAGMA_REDEFINE_EXTNAME 1

[Solaris-specific pragma]

TARGET_OS_CPP_BUILTINS()

/* The Solaris linker doesn't understand constructor priorities.  (The
   GNU linker does support constructor priorities, so GNU ld
   configuration files for Solaris override this setting.)  */
#undef SUPPORTS_INIT_PRIORITY
#define SUPPORTS_INIT_PRIORITY 0

#define STDC_0_IN_SYSTEM_HEADERS 1

ENABLE_EXECUTE_STACK

/* The Solaris assembler cannot grok .stabd directives.  */
#undef NO_DBX_BNSYM_ENSYM
#define NO_DBX_BNSYM_ENSYM 1

/* Select a format to encode pointers in exception handling data.  CODE
   is 0 for data, 1 for code labels, 2 for function pointers.  GLOBAL is
   true if the symbol may be affected by dynamic relocations.

   Some Solaris dynamic linkers don't handle unaligned section relative
   relocs properly, so force them to be aligned.  */
#ifndef HAVE_AS_SPARC_UA_PCREL
#define ASM_PREFERRED_EH_DATA_FORMAT(CODE,GLOBAL)		\
  ((flag_pic || GLOBAL) ? DW_EH_PE_aligned : DW_EH_PE_absptr)
#endif

/* Solaris's _Qp_* library routine implementation clobbers the output
   memory before the inputs are fully consumed.  */

#undef TARGET_BUGGY_QP_LIB
#define TARGET_BUGGY_QP_LIB	1

#undef SUN_CONVERSION_LIBFUNCS
#define SUN_CONVERSION_LIBFUNCS 1

#undef DITF_CONVERSION_LIBFUNCS
#define DITF_CONVERSION_LIBFUNCS 1

#undef SUN_INTEGER_MULTIPLY_64
#define SUN_INTEGER_MULTIPLY_64 1


I also renamed sparc/elf.h into sparc/sp-elf.h so as to avoid confusing people 
into thinking that it should be included by all ELF targets.

Marc, 4 new macros have been added to sp64-elf.h so will affect OpenBSD:
- #define NO_IMPLICIT_EXTERN_C: it is not mentioned in any OpenBSD file so 
I've added an #undef to sparc/openbsd64.h.
- #define SWITCH_TAKES_ARG: harmless, it is overridden in openbsd.h.
- #define LOCAL_LABEL_PREFIX and #define ASM_GENERATE_INTERNAL_LABEL: they are 
defined on Solaris, FreeBSD, NetBSD and Linux to (roughly) the same values, 
probably to be compatible with the Sun assembler's format.  I think they 
can't hurt on OpenBSD.

As mentioned in a previous message, a side-effect of the patch is to switch 
the default debugging format from STABS to DWARF-2 on sparc-elf and 
sparc-rtems.  All ELF targets now build, the remaining 2 non-ELF targets 
(sparclite-coff and sparc-openbsd) are still broken.

Tested by building a cross from Linux/x86-64 to every target (well, that 
builds), compiling a testcase with -g, -gstabs and -gdwarf-2 and examining 
the assembly output.  I'll wait for the interested parties to comment before 
installing it.


2005-01-21  Eric Botcazou  <ebotcazou@libertysurf.fr>

	PR bootstrap/19364
	* config.gcc (sparc-*-elf*): Remove sol2.h, sparc/sol2.h and
	sparc/elf.h, add sparc/sp-elf.h.
	(sparc-*-rtems*): Likewise.
	(sparclite-*-elf*): Remove sol2.h, sparc/sol2.h, sparc/elf.h and
	tm-dwarf2.h, add sparc/sp-elf.h.
	(sparc86x-*-elf): Likewise.
	(sparc64-*-elf*): Remove sol2.h, sparc/sol2.h and tm-dwarf2.h.
	* config/sparc/liteelf.h (TARGET_SUB_OS_CPP_BUILTINS): Rename into
	TARGET_OS_CPP_BUILTINS.
	* config/sparc/sp86x-elf (TARGET_SUB_OS_CPP_BUILTINS): Likewise.
	* config/sparc/rtemself.h (TARGET_SUB_OS_CPP_BUILTINS): Likewise.
	Undefine it.
	* config/sparc/openbsd64.h (NO_IMPLICIT_EXTERN_C): Undefine.
	* config/sparc/sp64-elf.h (NO_IMPLICIT_EXTERN_C): New macro.
	(SWITCH_TAKES_ARG): Likewise.
	(LOCAL_LABEL_PREFIX): Likewise.
	(ASM_GENERATE_INTERNAL_LABEL): Likewise.
	(TARGET_N_FORMAT_TYPES): Delete.
	(TARGET_FORMAT_TYPES): Likewise.
	(ASM_DECLARE_FUNCTION_SIZE): Likewise.
	* config/sparc/elf.h: Delete.
	* config/sparc/sp-elf.h: New file.
	

-- 
Eric Botcazou
Index: config.gcc
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config.gcc,v
retrieving revision 1.510
diff -u -r1.510 config.gcc
--- config.gcc	21 Jan 2005 10:15:55 -0000	1.510
+++ config.gcc	21 Jan 2005 21:46:55 -0000
@@ -1889,7 +1889,7 @@
 	with_cpu=ultrasparc
 	;;
 sparc-*-elf*)
-	tm_file="${tm_file} dbxelf.h elfos.h svr4.h sparc/sysv4.h sol2.h sparc/sol2.h sparc/elf.h"
+	tm_file="${tm_file} dbxelf.h elfos.h svr4.h sparc/sysv4.h sparc/sp-elf.h"
 	tmake_file="sparc/t-elf sparc/t-crtfm"
 	extra_parts="crti.o crtn.o crtbegin.o crtend.o"
 	use_fixproto=yes
@@ -1899,7 +1899,7 @@
 	tmake_file="${tmake_file} sparc/t-crtfm"
 	;;
 sparc-*-rtems*)
-	tm_file="${tm_file} dbxelf.h elfos.h svr4.h sparc/sysv4.h sol2.h sparc/sol2.h sparc/elf.h sparc/rtemself.h rtems.h"
+	tm_file="${tm_file} dbxelf.h elfos.h svr4.h sparc/sysv4.h sparc/sp-elf.h sparc/rtemself.h rtems.h"
 	tmake_file="sparc/t-elf sparc/t-crtfm t-rtems"
 	extra_parts="crti.o crtn.o crtbegin.o crtend.o"
 	;;
@@ -1997,19 +1997,19 @@
 	tmake_file=sparc/t-sparclite
 	;;
 sparclite-*-elf*)
-	tm_file="${tm_file} dbxelf.h elfos.h svr4.h sparc/sysv4.h sol2.h sparc/sol2.h sparc/elf.h sparc/liteelf.h tm-dwarf2.h"
+	tm_file="${tm_file} dbxelf.h elfos.h svr4.h sparc/sysv4.h sparc/sp-elf.h sparc/liteelf.h"
 	tmake_file="sparc/t-sparclite sparc/t-crtfm"
         extra_parts="crtbegin.o crtend.o"
 	use_fixproto=yes
 	;;
 sparc86x-*-elf*)
-	tm_file="${tm_file} dbxelf.h elfos.h svr4.h sparc/sysv4.h sol2.h sparc/sol2.h sparc/elf.h sparc/sp86x-elf.h tm-dwarf2.h"
+	tm_file="${tm_file} dbxelf.h elfos.h svr4.h sparc/sysv4.h sparc/sp-elf.h sparc/sp86x-elf.h"
 	tmake_file="sparc/t-sp86x sparc/t-crtfm"
         extra_parts="crtbegin.o crtend.o"
 	use_fixproto=yes
 	;;
 sparc64-*-elf*)
-	tm_file="${tm_file} dbxelf.h elfos.h svr4.h sparc/sysv4.h sol2.h sparc/sol2.h sparc/sp64-elf.h tm-dwarf2.h"
+	tm_file="${tm_file} dbxelf.h elfos.h svr4.h sparc/sysv4.h sparc/sp64-elf.h"
 	tmake_file="${tmake_file} sparc/t-crtfm"
 	extra_parts="crtbegin.o crtend.o"
 	use_fixproto=yes
Index: config/sparc/liteelf.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/sparc/liteelf.h,v
retrieving revision 1.15
diff -u -r1.15 liteelf.h
--- config/sparc/liteelf.h	21 Jan 2005 10:15:56 -0000	1.15
+++ config/sparc/liteelf.h	21 Jan 2005 21:46:55 -0000
@@ -1,5 +1,5 @@
 /* Definitions of target machine for GCC, for SPARClite w/o FPU, ELF.
-   Copyright (C) 1998, 1999 Free Software Foundation, Inc.
+   Copyright (C) 1998, 1999, 2005 Free Software Foundation, Inc.
    Contributed by Stan Cox (scox@cygnus.com).
 
 This file is part of GCC.
@@ -19,17 +19,17 @@
 the Free Software Foundation, 59 Temple Place - Suite 330,
 Boston, MA 02111-1307, USA.  */
 
-#undef TARGET_SUB_OS_CPP_BUILTINS
-#define TARGET_SUB_OS_CPP_BUILTINS()		\
+#undef TARGET_VERSION
+#define TARGET_VERSION fprintf (stderr, " (sparclite)");
+
+#undef TARGET_OS_CPP_BUILTINS
+#define TARGET_OS_CPP_BUILTINS()		\
   do						\
     {						\
 	builtin_define ("__sparclite__");	\
     }						\
   while (0)
 
-#undef TARGET_VERSION
-#define TARGET_VERSION fprintf (stderr, " (sparclite)");
-
 /* Enable app-regs and epilogue options.  Do not enable the fpu.  */
 
 #undef TARGET_DEFAULT
Index: config/sparc/openbsd64.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/sparc/openbsd64.h,v
retrieving revision 1.5
diff -u -r1.5 openbsd64.h
--- config/sparc/openbsd64.h	3 Jun 2003 09:06:55 -0000	1.5
+++ config/sparc/openbsd64.h	21 Jan 2005 21:46:55 -0000
@@ -1,5 +1,5 @@
 /* Configuration file for sparc64 OpenBSD target.
-   Copyright (C) 1999 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2005 Free Software Foundation, Inc.
 
 This file is part of GCC.
 
@@ -51,6 +51,9 @@
 #undef MD_EXEC_PREFIX
 #undef MD_STARTFILE_PREFIX
 
+/* Inherited from sp64-elf.  */
+#undef NO_IMPLICIT_EXTERN_C
+
 #undef ASM_SPEC
 #define ASM_SPEC "\
 %{v:-V} -s %{fpic|fPIC|fpie|fPIE:-K PIC} \
Index: config/sparc/rtemself.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/sparc/rtemself.h,v
retrieving revision 1.12
diff -u -r1.12 rtemself.h
--- config/sparc/rtemself.h	3 Jan 2005 21:00:24 -0000	1.12
+++ config/sparc/rtemself.h	21 Jan 2005 21:46:55 -0000
@@ -1,5 +1,5 @@
 /* Definitions for rtems targeting a SPARC using ELF.
-   Copyright (C) 1996, 1997, 2000, 2002 Free Software Foundation, Inc.
+   Copyright (C) 1996, 1997, 2000, 2002, 2005 Free Software Foundation, Inc.
    Contributed by Joel Sherrill (joel@OARcorp.com).
 
 This file is part of GCC.
@@ -20,7 +20,8 @@
 Boston, MA 02111-1307, USA.  */
 
 /* Target OS builtins.  */
-#define TARGET_SUB_OS_CPP_BUILTINS()		\
+#undef TARGET_OS_CPP_BUILTINS
+#define TARGET_OS_CPP_BUILTINS()		\
   do						\
     {						\
 	builtin_define ("__rtems__");		\
Index: config/sparc/sp64-elf.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/sparc/sp64-elf.h,v
retrieving revision 1.35
diff -u -r1.35 sp64-elf.h
--- config/sparc/sp64-elf.h	21 Jan 2005 10:15:56 -0000	1.35
+++ config/sparc/sp64-elf.h	21 Jan 2005 21:46:55 -0000
@@ -20,16 +20,10 @@
 the Free Software Foundation, 59 Temple Place - Suite 330,
 Boston, MA 02111-1307, USA.  */
 
-/* ??? We're taking the scheme of including another file and then overriding
-   the values we don't like a bit too far here.  The alternative is to more or
-   less duplicate all of svr4.h, sparc/sysv4.h, and sparc/sol2.h here
-   (suitably cleaned up).  */
-
 #undef TARGET_VERSION
 #define TARGET_VERSION fprintf (stderr, " (sparc64-elf)")
 
 /* A 64 bit v9 compiler in a Medium/Anywhere code model environment.  */
-
 #undef TARGET_DEFAULT
 #define TARGET_DEFAULT \
 (MASK_V9 + MASK_PTR64 + MASK_64BIT + MASK_HARD_QUAD \
@@ -38,6 +32,9 @@
 #undef SPARC_DEFAULT_CMODEL
 #define SPARC_DEFAULT_CMODEL CM_EMBMEDANY
 
+/* Don't assume anything about the header files.  */
+#define NO_IMPLICIT_EXTERN_C
+
 /* __svr4__ is used by the C library (FIXME) */
 #undef CPP_SUBTARGET_SPEC
 #define CPP_SUBTARGET_SPEC "-D__svr4__"
@@ -75,6 +72,15 @@
 /* Use the default (for now).  */
 #undef LIB_SPEC
 
+/* This defines which switch letters take arguments.
+   It is as in svr4.h but with -R added.  */
+#undef SWITCH_TAKES_ARG
+#define SWITCH_TAKES_ARG(CHAR) \
+  (DEFAULT_SWITCH_TAKES_ARG(CHAR) \
+   || (CHAR) == 'R' \
+   || (CHAR) == 'h' \
+   || (CHAR) == 'z')
+
 /* V9 chips can handle either endianness.  */
 #undef SUBTARGET_SWITCHES
 #define SUBTARGET_SWITCHES \
@@ -86,7 +92,19 @@
 
 #undef WORDS_BIG_ENDIAN
 #define WORDS_BIG_ENDIAN (! TARGET_LITTLE_ENDIAN)
-
+
+#undef  LOCAL_LABEL_PREFIX
+#define LOCAL_LABEL_PREFIX  "."
+
+/* This is how to store into the string LABEL
+   the symbol_ref name of an internal numbered label where
+   PREFIX is the class of label and NUM is the number within the class.
+   This is suitable for output with `assemble_name'.  */
+
+#undef  ASM_GENERATE_INTERNAL_LABEL
+#define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM)	\
+  sprintf ((LABEL), "*.L%s%ld", (PREFIX), (long)(NUM))
+
 /* ??? This should be 32 bits for v9 but what can we do?  */
 #undef WCHAR_TYPE
 #define WCHAR_TYPE "short unsigned int"
@@ -104,17 +122,3 @@
    this 0 to not confuse the branch shortening code.  */
 #undef JUMP_TABLES_IN_TEXT_SECTION
 #define JUMP_TABLES_IN_TEXT_SECTION 0
-
-/* Don't include Solaris-specific format checks.  */
-#undef TARGET_N_FORMAT_TYPES
-#undef TARGET_FORMAT_TYPES
-
-/* Don't include Solaris-specific .init / .fini support.  */
-#undef ASM_DECLARE_FUNCTION_SIZE
-#define ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL)		\
-  do								\
-    {								\
-      if (!flag_inhibit_size_directive)				\
-	ASM_OUTPUT_MEASURED_SIZE (FILE, FNAME);			\
-    }								\
-  while (0)
Index: config/sparc/sp86x-elf.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/sparc/sp86x-elf.h,v
retrieving revision 1.17
diff -u -r1.17 sp86x-elf.h
--- config/sparc/sp86x-elf.h	21 Jan 2005 10:15:56 -0000	1.17
+++ config/sparc/sp86x-elf.h	21 Jan 2005 21:46:55 -0000
@@ -1,5 +1,5 @@
 /* Definitions of target machine for GCC, for sparclite 86x w/o FPU.
-   Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc.
+   Copyright (C) 1998, 1999, 2000, 2005 Free Software Foundation, Inc.
    Contributed by Stan Cox (scox@cygnus.com).
 
 This file is part of GCC.
@@ -19,17 +19,17 @@
 the Free Software Foundation, 59 Temple Place - Suite 330,
 Boston, MA 02111-1307, USA.  */
 
-#undef  TARGET_SUB_OS_CPP_BUILTINS
-#define TARGET_SUB_OS_CPP_BUILTINS()		\
+#undef TARGET_VERSION
+#define TARGET_VERSION fprintf (stderr, " (sparclite 86x)");
+
+#undef TARGET_OS_CPP_BUILTINS
+#define TARGET_OS_CPP_BUILTINS()		\
   do						\
     {						\
 	builtin_define ("__sparclite86x__");	\
     }						\
   while (0)
 
-#undef TARGET_VERSION
-#define TARGET_VERSION fprintf (stderr, " (sparclite 86x)");
-
 /* Enable app-regs and epilogue options.  Do not enable the fpu.  */
 
 #undef TARGET_DEFAULT
--- /dev/null	1970-01-01 01:00:00.000000000 +0100
+++ config/sparc/sp-elf.h	2005-01-21 21:19:03.000000000 +0100
@@ -0,0 +1,83 @@
+/* Definitions of target machine for GCC,
+   for SPARC running in an embedded environment using the ELF file format.
+   Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GCC; see the file COPYING.  If not, write to
+the Free Software Foundation, 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA.  */
+
+#undef TARGET_VERSION
+#define TARGET_VERSION fprintf (stderr, " (sparc-elf)")
+
+#undef TARGET_DEFAULT
+#define TARGET_DEFAULT MASK_FPU
+
+/* Don't assume anything about the header files.  */
+#define NO_IMPLICIT_EXTERN_C
+
+/* The sun bundled assembler doesn't accept -Yd, (and neither does gas).
+   It's safe to pass -s always, even if -g is not used.  */
+#undef ASM_SPEC
+#define ASM_SPEC \
+  "%{v:-V} %{Qy:} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Wa,*:%*} -s \
+   %{fpic|fpie|fPIC|fPIE:-K PIC} %(asm_cpu)"
+
+/* Use the default.  */
+#undef LINK_SPEC
+
+#undef STARTFILE_SPEC
+#define STARTFILE_SPEC "crt0.o%s crti.o%s crtbegin.o%s"
+
+#undef ENDFILE_SPEC
+#define ENDFILE_SPEC \
+  "%{ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \
+   crtend.o%s crtn.o%s"
+
+/* Don't set the target flags, this is done by the linker script */
+#undef LIB_SPEC
+#define LIB_SPEC ""
+
+/* This defines which switch letters take arguments.
+   It is as in svr4.h but with -R added.  */
+#undef SWITCH_TAKES_ARG
+#define SWITCH_TAKES_ARG(CHAR) \
+  (DEFAULT_SWITCH_TAKES_ARG(CHAR) \
+   || (CHAR) == 'R' \
+   || (CHAR) == 'h' \
+   || (CHAR) == 'z')
+
+#undef  LOCAL_LABEL_PREFIX
+#define LOCAL_LABEL_PREFIX  "."
+
+/* This is how to store into the string LABEL
+   the symbol_ref name of an internal numbered label where
+   PREFIX is the class of label and NUM is the number within the class.
+   This is suitable for output with `assemble_name'.  */
+
+#undef  ASM_GENERATE_INTERNAL_LABEL
+#define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM)	\
+  sprintf ((LABEL), "*.L%s%ld", (PREFIX), (long)(NUM))
+
+/* ??? Inherited from sol2.h.  Probably wrong.  */
+#undef WCHAR_TYPE
+#define WCHAR_TYPE "long int"
+
+#undef WCHAR_TYPE_SIZE
+#define WCHAR_TYPE_SIZE BITS_PER_WORD
+
+/* ??? until fixed.  */
+#undef LONG_DOUBLE_TYPE_SIZE
+#define LONG_DOUBLE_TYPE_SIZE 64

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