OSDN Git Service

* config/sh/linux-unwind.h (SH_DWARF_FRAME_XD0): Remove for SH5.
[pf3gnuchains/gcc-fork.git] / gcc / config / sh / linux.h
index 56c85d6..51d52eb 100644 (file)
@@ -24,20 +24,6 @@ Boston, MA 02111-1307, USA.  */
 #undef TARGET_VERSION
 #define TARGET_VERSION  fputs (" (SH GNU/Linux with ELF)", stderr);
 
-/* We're not SYSVR4, not having /usr/ccs */
-#undef MD_EXEC_PREFIX
-#undef MD_STARTFILE_PREFIX
-
-/* This was defined in linux.h.  Define it here also.  */
-#define HANDLE_PRAGMA_PACK_PUSH_POP
-
-/* Don't assume anything about the header files.  */
-#define NO_IMPLICIT_EXTERN_C
-
-/* The GNU C++ standard library requires that these macros be defined.  */
-#undef CPLUSPLUS_CPP_SPEC
-#define CPLUSPLUS_CPP_SPEC "-D_GNU_SOURCE %(cpp)"
-
 /* Enable DWARF 2 exceptions.  */
 #undef DWARF2_UNWIND_INFO
 #define DWARF2_UNWIND_INFO 1
@@ -49,18 +35,21 @@ Boston, MA 02111-1307, USA.  */
 "
 
 #define TARGET_OS_CPP_BUILTINS() \
-do { \
-  builtin_define_std ("unix"); \
-  builtin_define ("__gnu_linux__"); \
-  builtin_define_std ("linux"); \
-  builtin_assert ("system=linux"); \
-  builtin_assert ("system=unix"); \
-  builtin_assert ("system=posix"); \
-} while (0)
+  do                                           \
+    {                                          \
+      LINUX_TARGET_OS_CPP_BUILTINS();          \
+      if (flag_pic)                            \
+       {                                       \
+         builtin_define ("__PIC__");           \
+         builtin_define ("__pic__");           \
+       }                                       \
+    }                                          \
+  while (0)
 
 #undef TARGET_DEFAULT
 #define TARGET_DEFAULT \
-  (TARGET_CPU_DEFAULT | USERMODE_BIT | TARGET_ENDIAN_DEFAULT)
+  (TARGET_CPU_DEFAULT | MASK_USERMODE | TARGET_ENDIAN_DEFAULT \
+   | TARGET_OPT_DEFAULT)
 
 #define TARGET_ASM_FILE_END file_end_indicate_exec_stack
 
@@ -74,75 +63,61 @@ do { \
      %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2}} \
    %{static:-static}"
 
-#undef LIB_SPEC
-#define LIB_SPEC \
-  "%{pthread:-lpthread} \
-   %{shared: -lc} \
-   %{!static:-rpath-link %R/lib:%R/usr/lib} \
-   %{!shared: \
-     %{mieee-fp:-lieee} \
-     %{profile:-lc_p} %{!profile: -lc}}"
-
-#if defined(HAVE_LD_EH_FRAME_HDR)
-#undef LINK_EH_SPEC
-#define LINK_EH_SPEC "%{!static:--eh-frame-hdr} "
-#endif
-
-#undef STARTFILE_SPEC
-#if defined HAVE_LD_PIE
-#define STARTFILE_SPEC \
-  "%{!shared: %{pg|p|profile:gcrt1.o%s;pie:Scrt1.o%s;:crt1.o%s}} \
-   crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}"
-#else
-#define STARTFILE_SPEC \
-  "%{!shared: %{pg|p|profile:gcrt1.o%s;:crt1.o%s}} \
-   crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}"
-#endif
-
-#undef ENDFILE_SPEC
-#define ENDFILE_SPEC \
-  "%{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s"
-
-#define LINK_GCC_C_SEQUENCE_SPEC \
-  "%{static:--start-group} %G %L %{static:--end-group}%{!static:%G}"
-
-/* Use --as-needed -lgcc_s for eh support.  */
-#ifdef HAVE_LD_AS_NEEDED
-#define USE_LD_AS_NEEDED 1
-#endif
-
-/* Determine whether the the entire c99 runtime
-   is present in the runtime library.  */
-#define TARGET_C99_FUNCTIONS 1
-
 /* Output assembler code to STREAM to call the profiler.  */
 
 #undef FUNCTION_PROFILER
 #define FUNCTION_PROFILER(STREAM,LABELNO)                              \
   do {                                                                 \
-    if (flag_pic)                                                      \
+    if (TARGET_SHMEDIA)                                                        \
       {                                                                        \
-       fprintf (STREAM, "\tmov.l\t3f,r1\n");                           \
-       fprintf (STREAM, "\tmova\t3f,r0\n");                            \
-       fprintf (STREAM, "\tadd\tr1,r0\n");                             \
-       fprintf (STREAM, "\tmov.l\t1f,r1\n");                           \
-       fprintf (STREAM, "\tmov.l\t@(r0,r1),r1\n");                     \
+       fprintf (STREAM, "\tpt\t1f,tr1\n");                             \
+       fprintf (STREAM, "\taddi.l\tr15,-8,r15\n");                     \
+       fprintf (STREAM, "\tst.l\tr15,0,r18\n");                        \
+       if (flag_pic)                                                   \
+         {                                                             \
+           char *gofs = "(datalabel _GLOBAL_OFFSET_TABLE_-(0f-.))";    \
+           fprintf (STREAM, "\tmovi\t((%s>>16)&0xffff),r21\n", gofs);  \
+           fprintf (STREAM, "\tshori\t(%s & 0xffff),r21\n", gofs);     \
+           fprintf (STREAM, "0:\tptrel/u\tr21,tr0\n");                 \
+           fprintf (STREAM, "\tmovi\t((mcount@GOTPLT)&0xffff),r22\n"); \
+           fprintf (STREAM, "\tgettr\ttr0,r21\n");                     \
+           fprintf (STREAM, "\tadd.l\tr21,r22,r21\n");                 \
+           fprintf (STREAM, "\tld.l\tr21,0,r21\n");                    \
+           fprintf (STREAM, "\tptabs\tr21,tr0\n");                     \
+         }                                                             \
+       else                                                            \
+         fprintf (STREAM, "\tpt\tmcount,tr0\n");                       \
+       fprintf (STREAM, "\tgettr\ttr1,r18\n");                         \
+       fprintf (STREAM, "\tblink\ttr0,r63\n");                         \
+       fprintf (STREAM, "1:\tld.l\tr15,0,r18\n");                      \
+       fprintf (STREAM, "\taddi.l\tr15,8,r15\n");                      \
       }                                                                        \
     else                                                               \
-      fprintf (STREAM, "\tmov.l\t1f,r1\n");                            \
-    fprintf (STREAM, "\tsts.l\tpr,@-r15\n");                           \
-    fprintf (STREAM, "\tmova\t2f,r0\n");                               \
-    fprintf (STREAM, "\tjmp\t@r1\n");                                  \
-    fprintf (STREAM, "\tlds\tr0,pr\n");                                        \
-    fprintf (STREAM, "\t.align\t2\n");                                 \
-    if (flag_pic)                                                      \
       {                                                                        \
-       fprintf (STREAM, "1:\t.long\tmcount@GOT\n");                    \
-       fprintf (STREAM, "3:\t.long\t_GLOBAL_OFFSET_TABLE_\n");         \
+       if (flag_pic)                                                   \
+         {                                                             \
+           fprintf (STREAM, "\tmov.l\t3f,r1\n");                       \
+           fprintf (STREAM, "\tmova\t3f,r0\n");                        \
+           fprintf (STREAM, "\tadd\tr1,r0\n");                         \
+           fprintf (STREAM, "\tmov.l\t1f,r1\n");                       \
+           fprintf (STREAM, "\tmov.l\t@(r0,r1),r1\n");                 \
+         }                                                             \
+       else                                                            \
+         fprintf (STREAM, "\tmov.l\t1f,r1\n");                         \
+       fprintf (STREAM, "\tsts.l\tpr,@-r15\n");                        \
+       fprintf (STREAM, "\tmova\t2f,r0\n");                            \
+       fprintf (STREAM, "\tjmp\t@r1\n");                               \
+       fprintf (STREAM, "\tlds\tr0,pr\n");                             \
+       fprintf (STREAM, "\t.align\t2\n");                              \
+       if (flag_pic)                                                   \
+         {                                                             \
+           fprintf (STREAM, "1:\t.long\tmcount@GOT\n");                \
+           fprintf (STREAM, "3:\t.long\t_GLOBAL_OFFSET_TABLE_\n");     \
+         }                                                             \
+       else                                                            \
+         fprintf (STREAM, "1:\t.long\tmcount\n");                      \
+       fprintf (STREAM, "2:\tlds.l\t@r15+,pr\n");                      \
       }                                                                        \
-    else                                                               \
-      fprintf (STREAM, "1:\t.long\tmcount\n");                         \
-    fprintf (STREAM, "2:\tlds.l\t@r15+,pr\n");                         \
   } while (0)
 
 #define MD_UNWIND_SUPPORT "config/sh/linux-unwind.h"
@@ -157,3 +132,10 @@ do { \
 #undef DBX_REGISTER_NUMBER
 #define DBX_REGISTER_NUMBER(REGNO) \
   ((! TARGET_SH5 && (REGNO) == 16) ? 16 : SH_DBX_REGISTER_NUMBER (REGNO))
+
+/* Since libgcc is compiled with -fpic for this target, we can't use
+   __sdivsi3_1 as the division strategy for -O0 and -Os.  */
+#undef SH_DIV_STRATEGY_DEFAULT
+#define SH_DIV_STRATEGY_DEFAULT SH_DIV_CALL2
+#undef SH_DIV_STR_FOR_SIZE
+#define SH_DIV_STR_FOR_SIZE "call2"