Fix PR bootstrap/19364

Eric Botcazou ebotcazou@libertysurf.fr
Fri Jan 21 21:59:00 GMT 2005


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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pr19364.diff
Type: text/x-diff
Size: 11980 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20050121/3d7f1a2a/attachment.bin>


More information about the Gcc-patches mailing list