]> git.ipfire.org Git - thirdparty/gcc.git/blobdiff - gcc/config/sh/linux.h
Update copyright years.
[thirdparty/gcc.git] / gcc / config / sh / linux.h
index 87248542f49a88189c5153c32e4969ae4d39190e..c30083423f29e6b8cdb8f329862228b55e83cc89 100644 (file)
@@ -1,12 +1,12 @@
 /* Definitions for SH running Linux-based GNU systems using ELF
-   Copyright (C) 1999, 2000, 2002, 2003, 2004 Free Software Foundation, Inc.
+   Copyright (C) 1999-2017 Free Software Foundation, Inc.
    Contributed by Kazumoto Kojima <kkojima@rr.iij4u.or.jp>
 
 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)
+the Free Software Foundation; either version 3, or (at your option)
 any later version.
 
 GCC is distributed in the hope that it will be useful,
@@ -15,27 +15,10 @@ 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 this program; see the file COPYING.  If not, write to
-the Free Software Foundation, 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA.  */
+along with GCC; see the file COPYING3.  If not see
+<http://www.gnu.org/licenses/>.  */
 
 /* Run-time Target Specification.  */
-#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
@@ -48,100 +31,81 @@ 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                                           \
+    {                                          \
+      GNU_USER_TARGET_OS_CPP_BUILTINS();       \
+    }                                          \
+  while (0)
 
 #undef TARGET_DEFAULT
 #define TARGET_DEFAULT \
-  (TARGET_CPU_DEFAULT | USERMODE_BIT | TARGET_ENDIAN_DEFAULT)
+  (TARGET_CPU_DEFAULT | TARGET_ENDIAN_DEFAULT | TARGET_OPT_DEFAULT)
 
 #define TARGET_ASM_FILE_END file_end_indicate_exec_stack
 
-#undef SUBTARGET_LINK_EMUL_SUFFIX
-#define SUBTARGET_LINK_EMUL_SUFFIX "_linux"
-#undef SUBTARGET_LINK_SPEC
-#define SUBTARGET_LINK_SPEC \
-  "%{shared:-shared} \
-   %{!static: \
-     %{rdynamic:-export-dynamic} \
-     %{!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} "
+#if TARGET_ENDIAN_DEFAULT == MASK_LITTLE_ENDIAN
+#define MUSL_DYNAMIC_LINKER_E "%{mb:eb}"
+#else
+#define MUSL_DYNAMIC_LINKER_E "%{!ml:eb}"
 #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}"
+#if TARGET_CPU_DEFAULT & (MASK_HARD_SH2A_DOUBLE | MASK_SH4)
+/* "-nofpu" if any nofpu option is specified.  */
+#define MUSL_DYNAMIC_LINKER_FP \
+  "%{m1|m2|m2a-nofpu|m3|m4-nofpu|m4-100-nofpu|m4-200-nofpu|m4-300-nofpu|" \
+  "m4-340|m4-400|m4-500|m4al:-nofpu}"
 #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}"
+/* "-nofpu" if none of the hard fpu options are specified.  */
+#define MUSL_DYNAMIC_LINKER_FP "%{m2a|m4|m4-100|m4-200|m4-300|m4a:;:-nofpu}"
 #endif
 
-#undef ENDFILE_SPEC
-#define ENDFILE_SPEC \
-  "%{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s"
+#undef MUSL_DYNAMIC_LINKER
+#define MUSL_DYNAMIC_LINKER \
+  "/lib/ld-musl-sh" MUSL_DYNAMIC_LINKER_E MUSL_DYNAMIC_LINKER_FP \
+  "%{mfdpic:-fdpic}.so.1"
 
-#define LINK_GCC_C_SEQUENCE_SPEC \
-  "%{static:--start-group} %G %L %{static:--end-group}%{!static:%G}"
+#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
 
-/* Use --as-needed -lgcc_s for eh support.  */
-#ifdef HAVE_LD_AS_NEEDED
-#define USE_LD_AS_NEEDED 1
-#endif
+#undef SUBTARGET_LINK_EMUL_SUFFIX
+#define SUBTARGET_LINK_EMUL_SUFFIX "%{mfdpic:_fd;:_linux}"
 
-/* Output assembler code to STREAM to call the profiler.  */
+#undef SUBTARGET_LINK_SPEC
+#define SUBTARGET_LINK_SPEC \
+  "%{shared:-shared} \
+   %{!static: \
+     %{rdynamic:-export-dynamic} \
+     -dynamic-linker " GNU_USER_DYNAMIC_LINKER "} \
+   %{static:-static}"
 
+/* Output assembler code to STREAM to call the profiler.  */
 #undef FUNCTION_PROFILER
 #define FUNCTION_PROFILER(STREAM,LABELNO)                              \
   do {                                                                 \
-    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");                         \
+       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");                      \
   } while (0)
 
-#define MD_UNWIND_SUPPORT "config/sh/linux-unwind.h"
-
 /* For SH3 and SH4, we use a slot of the unwind frame which correspond
    to a fake register number 16 as a placeholder for the return address
    in MD_FALLBACK_FRAME_STATE_FOR and its content will be read with
@@ -151,4 +115,26 @@ do { \
    so as to return itself for 16.  */
 #undef DBX_REGISTER_NUMBER
 #define DBX_REGISTER_NUMBER(REGNO) \
-  ((! TARGET_SH5 && (REGNO) == 16) ? 16 : SH_DBX_REGISTER_NUMBER (REGNO))
+  (((REGNO) == 16) ? 16 : SH_DBX_REGISTER_NUMBER (REGNO))
+
+/* Install the __sync libcalls.  */
+#undef TARGET_INIT_LIBFUNCS
+#define TARGET_INIT_LIBFUNCS  sh_init_sync_libfuncs
+
+#undef SUBTARGET_OVERRIDE_OPTIONS
+#define SUBTARGET_OVERRIDE_OPTIONS                                     \
+  do                                                                   \
+    {                                                                  \
+      /* Set default atomic model if it hasn't been specified.  */     \
+      if (global_options_set.x_sh_atomic_model_str == 0)               \
+       {                                                               \
+         if (TARGET_SH3)                                               \
+           sh_atomic_model_str = "soft-gusa";                          \
+         else if (TARGET_SH1)                                          \
+           sh_atomic_model_str = "soft-imask";                         \
+       }                                                               \
+      /* Set -musermode if it hasn't been specified.  */               \
+      if (global_options_set.x_TARGET_USERMODE == 0)                   \
+       TARGET_USERMODE = true;                                         \
+    }                                                                  \
+  while (0)