sol2.h: New file.
[gcc.git] / gcc / config / sparc / sol2.h
index 6dafd10ae5ffd8e6dd6dfe3a983b023ffcb16375..728774d49be623e094501770dfceb15383ac3c83 100644 (file)
@@ -23,51 +23,8 @@ Boston, MA 02111-1307, USA.  */
 
 /* Supposedly the same as vanilla sparc svr4, except for the stuff below: */
 
-/* Solaris 2 (at least as of 2.5.1) uses a 32-bit wchar_t.  */
-#undef WCHAR_TYPE
-#define WCHAR_TYPE "long int"
-
-#undef WCHAR_TYPE_SIZE
-#define WCHAR_TYPE_SIZE 32
-
-/* 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 32
-
-#define HANDLE_PRAGMA_REDEFINE_EXTNAME 1
-
 #undef CPP_PREDEFINES
-#define CPP_PREDEFINES \
-"-Dsparc -Dsun -Dunix -D__svr4__ -D__SVR4 -D__PRAGMA_REDEFINE_EXTNAME \
--Asystem=unix -Asystem=svr4"
-
-#undef CPP_SUBTARGET_SPEC
-#define CPP_SUBTARGET_SPEC "\
-%{pthreads:-D_REENTRANT -D_PTHREADS} \
-%{!pthreads:%{threads:-D_REENTRANT -D_SOLARIS_THREADS}} \
-%{compat-bsd:-iwithprefixbefore ucbinclude -I/usr/ucbinclude} \
-"
-
-/* For C++ we need to add some additional macro definitions required
-   by the C++ standard library.  */
-#define CPLUSPLUS_CPP_SPEC "\
--D_XOPEN_SOURCE=500 -D_LARGEFILE_SOURCE=1 -D_LARGEFILE64_SOURCE=1 \
--D__EXTENSIONS__ \
-%(cpp) \
-"
-
-/* 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:-K PIC} %{fPIC:-K PIC} \
-%(asm_cpu) \
-"
+#define CPP_PREDEFINES "-Dsparc"
 
 /* This is here rather than in sparc.h because it's not known what
    other assemblers will accept.  */
@@ -98,11 +55,6 @@ Boston, MA 02111-1307, USA.  */
 #define DBX_REGISTER_NUMBER(REGNO) \
   (TARGET_FLAT && (REGNO) == HARD_FRAME_POINTER_REGNUM ? 31 : REGNO)
 
-/* We use stabs-in-elf by default, because that is what the native
-   toolchain uses.  */
-#undef PREFERRED_DEBUGGING_TYPE
-#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
-
 /* The Solaris 2 assembler uses .skip, not .zero, so put this back.  */
 #undef ASM_OUTPUT_SKIP
 #define ASM_OUTPUT_SKIP(FILE,SIZE)  \
@@ -135,72 +87,12 @@ Boston, MA 02111-1307, USA.  */
   sprintf ((LABEL), "*.L%s%ld", (PREFIX), (long)(NUM))
 
 \f
-/* We don't use the standard svr4 STARTFILE_SPEC because it's wrong for us.
-   We don't use the standard LIB_SPEC only because we don't yet support c++ */
-
-#undef STARTFILE_SPEC
-#define STARTFILE_SPEC "%{!shared: \
-                        %{!symbolic: \
-                         %{p:mcrt1.o%s} \
-                          %{!p: \
-                           %{pg:gcrt1.o%s gmon.o%s} \
-                            %{!pg:crt1.o%s}}}} \
-                       crti.o%s \
-                       %{ansi:values-Xc.o%s} \
-                       %{!ansi:values-Xa.o%s} \
-                       crtbegin.o%s"
-
-/* ??? Note: in order for -compat-bsd to work fully,
-   we must somehow arrange to fixincludes /usr/ucbinclude
-   and put the result in $(libsubdir)/ucbinclude.  */
-
-#undef LIB_SPEC
-#define LIB_SPEC \
-  "%{compat-bsd:-lucb -lsocket -lnsl -lelf -laio} \
-   %{!shared:\
-     %{!symbolic:\
-       %{pthreads:-lpthread} \
-       %{!pthreads:%{threads:-lthread}} \
-       %{p|pg:-ldl} -lc}}"
 
 #undef  ENDFILE_SPEC
 #define ENDFILE_SPEC \
   "%{ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \
    crtend.o%s crtn.o%s"
 
-/* This should be the same as in svr4.h, except with -R added.  */
-#undef LINK_SPEC
-#define LINK_SPEC \
-  "%{h*} %{v:-V} \
-   %{b} %{Wl,*:%*} \
-   %{static:-dn -Bstatic} \
-   %{shared:-G -dy %{!mimpure-text:-z text}} \
-   %{symbolic:-Bsymbolic -G -dy -z text} \
-   %{G:-G} \
-   %{YP,*} \
-   %{R*} \
-   %{compat-bsd: \
-     %{!YP,*:%{pg:-Y P,/usr/ucblib:/usr/ccs/lib/libp:/usr/lib/libp:/usr/ccs/lib:/usr/lib} \
-             %{!pg:%{p:-Y P,/usr/ucblib:/usr/ccs/lib/libp:/usr/lib/libp:/usr/ccs/lib:/usr/lib} \
-                   %{!p:-Y P,/usr/ucblib:/usr/ccs/lib:/usr/lib}}} \
-             -R /usr/ucblib} \
-   %{!compat-bsd: \
-     %{!YP,*:%{pg:-Y P,/usr/ccs/lib/libp:/usr/lib/libp:/usr/ccs/lib:/usr/lib} \
-             %{!pg:%{p:-Y P,/usr/ccs/lib/libp:/usr/lib/libp:/usr/ccs/lib:/usr/lib} \
-                   %{!p:-Y P,/usr/ccs/lib:/usr/lib}}}} \
-   %{Qy:} %{!Qn:-Qy}"
-
-/* 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) == 'x' \
-   || (CHAR) == 'z')
-
 /* 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.
@@ -221,8 +113,6 @@ Boston, MA 02111-1307, USA.  */
 /* But indicate that it isn't supported by the hardware.  */
 #define WIDEST_HARDWARE_FP_SIZE 64
 
-#define STDC_0_IN_SYSTEM_HEADERS 1
-
 #define MULDI3_LIBCALL "__mul64"
 #define DIVDI3_LIBCALL "__div64"
 #define UDIVDI3_LIBCALL "__udiv64"
@@ -249,56 +139,4 @@ Boston, MA 02111-1307, USA.  */
 /* Solaris allows 64 bit out and global registers in 32 bit mode.
    sparc_override_options will disable V8+ if not generating V9 code.  */
 #undef TARGET_DEFAULT
-#define TARGET_DEFAULT (MASK_FPU + MASK_V8PLUS + MASK_LONG_DOUBLE_128)
-\f
-/*
- * Attempt to turn on access permissions for the stack.
- *
- * This code must be defined when compiling gcc but not when compiling
- * libgcc2.a, unless we're generating code for 64 bits SPARC
- *
- * _SC_STACK_PROT is only defined for post 2.6, but we want this code
- * to run always.  2.6 can change the stack protection but has no way to
- * query it.
- *
- */
-
-/* This declares mprotect (used in TRANSFER_FROM_TRAMPOLINE) for
-   libgcc2.c.  */
-/* We don't want to include this because sys/mman.h is not present on
-   some non-Solaris configurations that use sol2.h.  */
-#if 0 /* def L_trampoline */
-#include <sys/mman.h>
-#endif
-
-#define TRANSFER_FROM_TRAMPOLINE                                       \
-static int need_enable_exec_stack;                                     \
-                                                                       \
-static void check_enabling(void) __attribute__ ((constructor));                \
-static void check_enabling(void)                                       \
-{                                                                      \
-  extern long sysconf(int);                                            \
-                                                                       \
-  int prot = (int) sysconf(515 /*_SC_STACK_PROT */);                   \
-  if (prot != 7)                                                       \
-    need_enable_exec_stack = 1;                                                \
-}                                                                      \
-                                                                       \
-extern void __enable_execute_stack (void *);                           \
-void                                                                   \
-__enable_execute_stack (addr)                                          \
-     void *addr;                                                       \
-{                                                                      \
-  if (!need_enable_exec_stack)                                         \
-    return;                                                            \
-  else {                                                               \
-    long size = getpagesize ();                                                \
-    long mask = ~(size-1);                                             \
-    char *page = (char *) (((long) addr) & mask);                      \
-    char *end  = (char *) ((((long) (addr + TRAMPOLINE_SIZE)) & mask) + size); \
-                                                                       \
-    /* 7 is PROT_READ | PROT_WRITE | PROT_EXEC */                      \
-    if (mprotect (page, end - page, 7) < 0)                            \
-      perror ("mprotect of trampoline code");                          \
-  }                                                                    \
-}
+#define TARGET_DEFAULT (MASK_V8PLUS + MASK_FPU + MASK_LONG_DOUBLE_128)