OSDN Git Service

Solaris fixes
authormeissner <meissner@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 31 May 1996 19:02:31 +0000 (19:02 +0000)
committermeissner <meissner@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 31 May 1996 19:02:31 +0000 (19:02 +0000)
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@12132 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/config/rs6000/eabilesim.h
gcc/config/rs6000/eabisim.h
gcc/config/rs6000/linux.h
gcc/config/rs6000/sol-c0.c
gcc/config/rs6000/sol-ci.asm
gcc/config/rs6000/sol-cn.asm
gcc/config/rs6000/sol2.h
gcc/config/rs6000/sysv4.h
gcc/config/rs6000/t-ppc
gcc/config/rs6000/t-ppcgas

index a0ba5c7..d826435 100644 (file)
@@ -31,13 +31,13 @@ Boston, MA 02111-1307, USA.  */
 
 /* Make the simulator the default */
 #undef LIB_DEFAULT_SPEC
-#define LIB_DEFAULT_SPEC LIB_SIM_SPEC
+#define LIB_DEFAULT_SPEC "%(lib_sim)"
 
 #undef STARTFILE_DEFAULT_SPEC
-#define STARTFILE_DEFAULT_SPEC STARTFILE_SIM_SPEC
+#define STARTFILE_DEFAULT_SPEC "%(startfile_sim)"
 
 #undef ENDFILE_DEFAULT_SPEC
-#define ENDFILE_DEFAULT_SPEC ENDFILE_SIM_SPEC
+#define ENDFILE_DEFAULT_SPEC "%(endfile_sim)"
 
 #undef LINK_START_DEFAULT_SPEC
-#define LINK_START_DEFAULT_SPEC LINK_START_SIM_SPEC
+#define LINK_START_DEFAULT_SPEC "%(link_start_sim)"
index 96b61c3..6a82244 100644 (file)
@@ -31,13 +31,13 @@ Boston, MA 02111-1307, USA.  */
 
 /* Make the simulator the default */
 #undef LIB_DEFAULT_SPEC
-#define LIB_DEFAULT_SPEC LIB_SIM_SPEC
+#define LIB_DEFAULT_SPEC "%(lib_sim)"
 
 #undef STARTFILE_DEFAULT_SPEC
-#define STARTFILE_DEFAULT_SPEC STARTFILE_SIM_SPEC
+#define STARTFILE_DEFAULT_SPEC "%(startfile_sim)"
 
 #undef ENDFILE_DEFAULT_SPEC
-#define ENDFILE_DEFAULT_SPEC ENDFILE_SIM_SPEC
+#define ENDFILE_DEFAULT_SPEC "%(endfile_sim)"
 
 #undef LINK_START_DEFAULT_SPEC
-#define LINK_START_DEFAULT_SPEC LINK_START_SIM_SPEC
+#define LINK_START_DEFAULT_SPEC "%(link_start_sim)"
index 618158c..79a115d 100644 (file)
@@ -30,16 +30,16 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
 #define LINK_SPEC ""
 
 #undef LIB_DEFAULT_SPEC
-#define LIB_DEFAULT_SPEC LIB_LINUX_SPEC
+#define LIB_DEFAULT_SPEC "%(lib_linux)"
 
 #undef STARTFILE_DEFAULT_SPEC
-#define STARTFILE_DEFAULT_SPEC STARTFILE_LINUX_SPEC
+#define STARTFILE_DEFAULT_SPEC "%(startfile_linux)"
 
 #undef ENDFILE_DEFAULT_SPEC
-#define ENDFILE_DEFAULT_SPEC ENDFILE_LINUX_SPEC
+#define ENDFILE_DEFAULT_SPEC "%(endfile_linux)"
 
 #undef LINK_START_DEFAULT_SPEC
-#define LINK_START_DEFAULT_SPEC LINK_START_LINUX_SPEC
+#define LINK_START_DEFAULT_SPEC "%(link_start_linux)"
 
 #undef TARGET_VERSION
 #define TARGET_VERSION fprintf (stderr, " (PowerPC Linux)");
index 1530fa7..faa46c4 100644 (file)
@@ -28,13 +28,52 @@ Boston, MA 02111-1307, USA.  */
 extern char **_environ;
 
 extern int atexit (void (*__func) (void));
-extern void __init (void);
-extern void __fini (void);
-extern void __do_global_ctors (void);
+extern void __init (void) __attribute__ ((__longcall__));
+extern void __fini (void) __attribute__ ((__longcall__));
 
 typedef void (*func_ptr) (void);
 int (*__atexit)(func_ptr) = atexit;
 
+/* Exception handling */
+struct ex_shared1 {
+  void *prev;
+  void *next;
+  char *text_start;
+  char *range_start;
+  char *text_end;
+  char *range_end;
+};
+
+struct ex_shared {
+  void (*ex_register) (struct ex_shared1 *);
+  void (*ex_deregister) (struct ex_shared1 *);
+  struct ex_shared1 shared_info;
+};
+
+extern char _ex_text0[], _ex_text1[];
+extern char _ex_range0[], _ex_range1[];
+extern void _ex_register (struct ex_shared1 *);
+extern void _ex_deregister (struct ex_shared1 *);
+
+struct ex_shared shared __attribute__((section(".ex_shared"))) = {
+  _ex_register,
+  _ex_deregister,
+  {
+    (void *)0,
+    (void *)0,
+    _ex_text0,
+    _ex_range0,
+    _ex_text1,
+    _ex_range1
+  }
+};
+
+static void
+deregister (void)
+{
+  (* shared.ex_deregister) (&shared.shared_info);
+}
+
 /* Start function.  */
 
 void
@@ -48,10 +87,17 @@ _start(int argc, char *argv[], char *envp[], void *auxp, void (*termfunc)())
   if (termfunc)
     atexit (termfunc);
 
-#if 0
+  /* Register exception handler if needed */
+  if (shared.ex_register)
+    (* shared.ex_register) (&shared.shared_info);
+
+  if (shared.ex_deregister)
+    atexit (deregister);
+
   /* Call any global constructors and destructors.  */
-  __do_global_ctors ();
-#endif
+  __init ();
+
+  atexit (__fini);
 
   /* Call the main program now */
   ret = main (argc, argv, envp, auxp);
index 71a3315..e4ead32 100644 (file)
        .file   "scrti.s"
        .ident  "GNU C scrti.s"
 
+# Start of .text
+       .section ".text"
+       .globl  _ex_text0
+_ex_text0:
+
+# Exception range
+       .section ".exception_ranges","aw"
+       .globl  _ex_range0
+_ex_range0:
+
 # List of C++ constructors
        .section ".ctors","aw"
        .globl  __CTOR_LIST__
@@ -56,15 +66,36 @@ __DTOR_LIST__:
        .align 2
        .globl __init
        .type __init,@function
-__init:        stwu %r1,-16(%r1)
-       mflr %r0
-       stw %r0,12(%r1)
+__init:        stwu    %r1,-16(%r1)
+       mflr    %r0
+#      stw     %r31,12(%r1)
+       stw     %r0,16(%r1)
+
+#      bl      _GLOBAL_OFFSET_TABLE_-4 # get the GOT address
+#      mflr    %r31
+#
+#      lwz     %r3,_ex_shared0@got(%r31)
+#      lwz     %r4,-8(%r3)             # _ex_register or 0
+#      cmpi    %cr0,%r4,0
+#      beq     .Lno_reg
+#      mtlr    %r4
+#      blrl
+#.Lno_reg:
 
 # Head of __fini function used for static destructors in Solaris
        .section ".fini","ax"
        .align 2
        .globl __fini
        .type __fini,@function
-__fini:        stwu %r1,-16(%r1)
-       mflr %r0
-       stw %r0,12(%r1)
+__fini:        stwu    %r1,-16(%r1)
+       mflr    %r0
+       stw     %r31,12(%r1)
+       stw     %r0,16(%r1)
+
+#      bl      _GLOBAL_OFFSET_TABLE_-4 # get the GOT address
+#      mflr    %r31
+
+# _environ and its evil twin environ, pointing to the environment
+       .comm   _environ,4,4
+       .weak   environ
+       .set    environ,_environ
index d3a6083..b911b8f 100644 (file)
        .file   "scrtn.s"
        .ident  "GNU C scrtn.s"
 
+# Default versions of exception handling register/deregister
+       .weak   _ex_register
+       .weak   _ex_deregister
+       .set    _ex_register,0
+       .set    _ex_deregister,0
+
 # End list of C++ constructors
        .section ".ctors","aw"
        .globl  __CTOR_END__
@@ -51,16 +57,24 @@ __CTOR_END__:
        .type   __DTOR_END__,@object
 __DTOR_END__:
 
+       .section ".text"
+       .globl  _ex_text1
+_ex_text1:
+
+       .section ".exception_ranges","aw"
+       .globl  _ex_range1
+_ex_range1:
+
 # Tail of __init used for static constructors in Solaris
        .section ".init","ax"
-       lwz %r0,12(%r1)
-       mtlr %r0
-       addi %r1,%r1,16
+       lwz     %r0,16(%r1)
+       mtlr    %r0
+       addi    %r1,%r1,16
        blr
 
 # Tail of __fini used for static destructors in Solaris
        .section ".fini","ax"
-       lwz %r0,12(%r1)
-       mtlr %r0
-       addi %r1,%r1,16
+       lwz     %r0,16(%r1)
+       mtlr    %r0
+       addi    %r1,%r1,16
        blr
index 357e21c..5b0e29f 100644 (file)
@@ -25,11 +25,6 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
 #undef RS6000_ABI_NAME
 #define RS6000_ABI_NAME "solaris"
 
-#undef CPP_PREDEFINES
-#define CPP_PREDEFINES \
- "-Dsun=1 -Dunix -D__svr4__ -DSVR4 -DPPC \
-  -D__ppc -Asystem(unix) -Asystem(svr4) -Acpu(powerpc) -Amachine(prep)"
-
 #undef ASM_CPU_SPEC
 #define ASM_CPU_SPEC "%{fpic:-K PIC} %{fPIC:-K PIC} -le -s"
 
@@ -60,16 +55,19 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
                        MASK_REGNAMES)
 
 #undef LIB_DEFAULT_SPEC
-#define LIB_DEFAULT_SPEC LIB_SOLARIS_SPEC
+#define LIB_DEFAULT_SPEC "%(lib_solaris)"
 
 #undef STARTFILE_DEFAULT_SPEC
-#define STARTFILE_DEFAULT_SPEC STARTFILE_SOLARIS_SPEC
+#define STARTFILE_DEFAULT_SPEC "%(startfile_solaris)"
 
 #undef ENDFILE_DEFAULT_SPEC
-#define ENDFILE_DEFAULT_SPEC ENDFILE_SOLARIS_SPEC
+#define ENDFILE_DEFAULT_SPEC "%(endfile_solaris)"
 
 #undef LINK_START_DEFAULT_SPEC
-#define LINK_START_DEFAULT_SPEC LINK_START_SOLARIS_SPEC
+#define LINK_START_DEFAULT_SPEC "%(link_start_solaris)"
+
+#undef CPP_OS_DEFAULT_SPEC
+#define        CPP_OS_DEFAULT_SPEC "%(cpp_os_solaris)"
 
 /* Don't turn -B into -L if the argument specifies a relative file name.  */
 #undef RELATIVE_PREFIX_NOT_LINKDIR
@@ -171,6 +169,3 @@ while (0)
 #define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO) \
 ( (OUTPUT) = (char *) alloca (strlen ((NAME)) + 10),   \
   sprintf ((OUTPUT), "%s_.%d", (NAME), (LABELNO))) 
-
-#define ASM_RELOCATION_EXPRESSIONS 1
-
index b6e4023..cf6740c 100644 (file)
@@ -96,6 +96,7 @@ extern enum rs6000_sdata_type rs6000_sdata;
   { "sim",              0 },                                           \
   { "mvme",             0 },                                           \
   { "emb",              0 },                                           \
+  { "solaris-cclib",    0 },                                           \
   { "newlib",           0 },
 
 /* Default ABI to use */
@@ -185,8 +186,7 @@ do {                                                                        \
     }                                                                  \
   else if (TARGET_SDATA)                                               \
     rs6000_sdata = (TARGET_EABI) ? SDATA_EABI : SDATA_SYSV;            \
-  else if (!TARGET_RELOCATABLE && !flag_pic                            \
-          && (DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_SOLARIS))    \
+  else if (!TARGET_RELOCATABLE && !flag_pic && DEFAULT_ABI == ABI_V4)  \
     {                                                                  \
       rs6000_sdata = SDATA_DATA;                                       \
       target_flags |= MASK_SDATA;                                      \
@@ -403,7 +403,8 @@ do {                                                                        \
 
 #define SDATA_SECTION_ASM_OP "\t.section \".sdata\",\"aw\""
 #define SDATA2_SECTION_ASM_OP "\t.section \".sdata2\",\"a\""
-#define SBSS_SECTION_ASM_OP "\t.section \".sbss\",\"aw\",@nobits"
+#define SBSS_SECTION_ASM_OP \
+  ((DEFAULT_ABI == ABI_SOLARIS) ? "\t.section \".sbss\",\"aw\"" : "\t.section \".sbss\",\"aw\",@nobits")
 
 
 /* Besides the usual ELF sections, we need a toc section.  */
@@ -1091,11 +1092,15 @@ scrti.o%s"
 #endif
 
 #ifndef        STARTFILE_SOLARIS_SPEC
-#define        STARTFILE_SOLARIS_SPEC "scrti.o%s scrt0.o%s"
+#define        STARTFILE_SOLARIS_SPEC "\
+%{!msolaris-cclib: scrti.o%s scrt0.o%s} \
+%{msolaris-cclib: crti.o%s crt1.o%s}"
 #endif
 
 #ifndef        ENDFILE_SOLARIS_SPEC
-#define        ENDFILE_SOLARIS_SPEC "scrtn.o%s"
+#define        ENDFILE_SOLARIS_SPEC "\
+%{!msolaris-cclib: scrtn.o%s} \
+%{msolaris-cclib: crtn.o%s}"
 #endif
 
 #ifndef LINK_START_SOLARIS_SPEC
@@ -1109,7 +1114,7 @@ scrti.o%s"
 #ifndef CPP_OS_SOLARIS_SPEC
 #define CPP_OS_SOLARIS_SPEC "-D__ppc -D__sun__=1 -D__unix__ -D__svr4__  -D__SVR4__ \
 %{!ansi: -Dsun=1 -Dunix -DSVR4 -D__EXTENSIONS__ } \
--Asystem(unix) -Asystem(svr4) -Amachine(prep)"
+-Amachine(prep)"
 #endif
 
 /* Define any extra SPECS that the compiler needs to generate.  */
index bee27ad..69c7e75 100644 (file)
@@ -26,20 +26,18 @@ eabi-ctors.c: $(srcdir)/config/rs6000/eabi-ctors.c
 # -mbig/-mlittle switches passed to gas.  The -mrelocatable support also needs
 # -mrelocatable passed to gas, so don't use it either.
 MULTILIB_OPTIONS       = msoft-float \
-                         mcall-sysv-noeabi/mcall-sysv-eabi/mcall-aix
+                         mcall-sysv-noeabi/mcall-sysv-eabi/mcall-aix/mcall-solaris
 
 MULTILIB_DIRNAMES      = nof \
                          le be \
-                         cs ce ca
+                         cs ce ca sol
 
 MULTILIB_MATCHES       = mlittle=mlittle-endian \
                          mbig=mbig-endian \
-                         mlittle=mcall-solaris \
                          mbig=mcall-linux \
                          msoft-float=mcpu?403 \
                          msoft-float=mcpu?821 \
                          msoft-float=mcpu?860 \
-                         mcall-sysv-noeabi=mcall-solaris \
                          mcall-sysv-noeabi=mcall-linux \
                          mcall-sysv-eabi=meabi \
                          mcall-sysv-noeabi=mno-eabi
index 107ace9..115323d 100644 (file)
@@ -26,26 +26,27 @@ eabi-ctors.c: $(srcdir)/config/rs6000/eabi-ctors.c
 MULTILIB_OPTIONS       = msoft-float \
                          mrelocatable \
                          mlittle/mbig \
-                         mcall-sysv-noeabi/mcall-sysv-eabi/mcall-aix
+                         mcall-sysv-noeabi/mcall-sysv-eabi/mcall-aix/mcall-solaris
 
 MULTILIB_DIRNAMES      = nof \
                          rel \
                          le be \
-                         cs ce ca
+                         cs ce ca sol
 
 MULTILIB_MATCHES       = mlittle=mlittle-endian \
                          mbig=mbig-endian \
-                         mlittle=mcall-solaris \
                          mbig=mcall-linux \
                          msoft-float=mcpu?403 \
                          msoft-float=mcpu?821 \
                          msoft-float=mcpu?860 \
-                         mcall-sysv-noeabi=mcall-solaris \
                          mcall-sysv-noeabi=mcall-linux \
                          mcall-sysv-eabi=meabi \
                          mcall-sysv-noeabi=mno-eabi
 
-MULTILIB_EXCEPTIONS    = *mrelocatable*/*mcall-sysv-noeabi*
+MULTILIB_EXCEPTIONS    = *mrelocatable*/*mcall-sysv-noeabi* \
+                         *mrelocatable*/*mcall-solaris* \
+                         *mbig*/*mcall-solaris* \
+                         *mlittle*/*mcall-solaris*
 
 LIBGCC = stmp-multilib stmp-crt
 INSTALL_LIBGCC = install-multilib install-crt