]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[RS6000] function for linux64 SUBSUBTARGET_OVERRIDE_OPTIONS
authorAlan Modra <amodra@gmail.com>
Thu, 1 Oct 2020 02:22:38 +0000 (11:52 +0930)
committerAlan Modra <amodra@gmail.com>
Thu, 1 Oct 2020 22:34:27 +0000 (08:04 +0930)
* config/rs6000/freebsd64.h (SUBSUBTARGET_OVERRIDE_OPTIONS): Use
rs6000_linux64_override_options.
* config/rs6000/linux64.h (SUBSUBTARGET_OVERRIDE_OPTIONS): Break
out to..
* config/rs6000/rs6000.c (rs6000_linux64_override_options): ..this,
new function.  Tweak non-biarch test and clearing of
profile_kernel to work with freebsd64.h.

gcc/config/rs6000/freebsd64.h
gcc/config/rs6000/linux64.h
gcc/config/rs6000/rs6000.c

index c9913638ffbece3ffc6b9c44d7a9ba7d67fd9bde..6984ca5a10752717ddb4f4b74d005a2867ab0023 100644 (file)
@@ -78,65 +78,7 @@ extern int dot_symbols;
 
 #undef  SUBSUBTARGET_OVERRIDE_OPTIONS
 #define SUBSUBTARGET_OVERRIDE_OPTIONS                          \
-  do                                                           \
-    {                                                          \
-      if (!global_options_set.x_rs6000_alignment_flags)                \
-       rs6000_alignment_flags = MASK_ALIGN_NATURAL;            \
-      if (TARGET_64BIT)                                                \
-       {                                                       \
-         if (DEFAULT_ABI != ABI_AIX)                           \
-           {                                                   \
-             rs6000_current_abi = ABI_AIX;                     \
-             error (INVALID_64BIT, "call");                    \
-           }                                                   \
-         dot_symbols = !strcmp (rs6000_abi_name, "aixdesc");   \
-         if (rs6000_isa_flags & OPTION_MASK_RELOCATABLE)       \
-           {                                                   \
-             rs6000_isa_flags &= ~OPTION_MASK_RELOCATABLE;     \
-             error (INVALID_64BIT, "relocatable");             \
-           }                                                   \
-         if (ELFv2_ABI_CHECK)                                  \
-           {                                                   \
-             rs6000_current_abi = ABI_ELFv2;                   \
-             if (dot_symbols)                                  \
-               error ("%<-mcall-aixdesc%> incompatible with %<-mabi=elfv2%>"); \
-           }                                                   \
-         if (rs6000_isa_flags & OPTION_MASK_EABI)              \
-           {                                                   \
-             rs6000_isa_flags &= ~OPTION_MASK_EABI;            \
-             error (INVALID_64BIT, "eabi");                    \
-           }                                                   \
-         if (TARGET_PROTOTYPE)                                 \
-           {                                                   \
-             target_prototype = 0;                             \
-             error (INVALID_64BIT, "prototype");               \
-           }                                                   \
-         if ((rs6000_isa_flags & OPTION_MASK_POWERPC64) == 0)  \
-           {                                                   \
-             rs6000_isa_flags |= OPTION_MASK_POWERPC64;        \
-             error ("%<-m64%> requires a PowerPC64 cpu");              \
-           }                                                   \
-          if ((rs6000_isa_flags_explicit                       \
-               & OPTION_MASK_MINIMAL_TOC) != 0)                \
-           {                                                   \
-             if (global_options_set.x_rs6000_current_cmodel    \
-                 && rs6000_current_cmodel != CMODEL_SMALL)     \
-               error ("%<-mcmodel%> incompatible with other toc options"); \
-             SET_CMODEL (CMODEL_SMALL);                        \
-           }                                                   \
-         else                                                  \
-           {                                                   \
-             if (!global_options_set.x_rs6000_current_cmodel)  \
-               SET_CMODEL (CMODEL_MEDIUM);                     \
-             if (rs6000_current_cmodel != CMODEL_SMALL)        \
-               {                                               \
-                 TARGET_NO_FP_IN_TOC = 0;                      \
-                 TARGET_NO_SUM_IN_TOC = 0;                     \
-               }                                               \
-           }                                                   \
-       }                                                       \
-    }                                                          \
-  while (0)
+  do rs6000_linux64_override_options (); while (0)
 
 #undef ASM_SPEC
 #undef LINK_OS_FREEBSD_SPEC
index 5c9f8e3d7afba0f3115c46c4bb582f4b054876af..73b6c01874cd179822c87192164bdab9b30bd4b5 100644 (file)
@@ -96,99 +96,7 @@ extern int dot_symbols;
 
 #undef SUBSUBTARGET_OVERRIDE_OPTIONS
 #define        SUBSUBTARGET_OVERRIDE_OPTIONS                           \
-  do                                                           \
-    {                                                          \
-      if (!global_options_set.x_rs6000_alignment_flags)                \
-       rs6000_alignment_flags = MASK_ALIGN_NATURAL;            \
-      if (rs6000_isa_flags & OPTION_MASK_64BIT)                        \
-       {                                                       \
-         if (DEFAULT_ABI != ABI_AIX)                           \
-           {                                                   \
-             rs6000_current_abi = ABI_AIX;                     \
-             error (INVALID_64BIT, "call");                    \
-           }                                                   \
-         dot_symbols = !strcmp (rs6000_abi_name, "aixdesc");   \
-         if (ELFv2_ABI_CHECK)                                  \
-           {                                                   \
-             rs6000_current_abi = ABI_ELFv2;                   \
-             if (dot_symbols)                                  \
-               error ("%<-mcall-aixdesc%> incompatible with %<-mabi=elfv2%>"); \
-           }                                                   \
-         if (rs6000_isa_flags & OPTION_MASK_RELOCATABLE)       \
-           {                                                   \
-             rs6000_isa_flags &= ~OPTION_MASK_RELOCATABLE;     \
-             error (INVALID_64BIT, "relocatable");             \
-           }                                                   \
-         if (rs6000_isa_flags & OPTION_MASK_EABI)              \
-           {                                                   \
-             rs6000_isa_flags &= ~OPTION_MASK_EABI;            \
-             error (INVALID_64BIT, "eabi");                    \
-           }                                                   \
-         if (TARGET_PROTOTYPE)                                 \
-           {                                                   \
-             target_prototype = 0;                             \
-             error (INVALID_64BIT, "prototype");               \
-           }                                                   \
-         if ((rs6000_isa_flags & OPTION_MASK_POWERPC64) == 0)  \
-           {                                                   \
-             rs6000_isa_flags |= OPTION_MASK_POWERPC64;        \
-             error ("%<-m64%> requires a PowerPC64 cpu");      \
-           }                                                   \
-         if (!global_options_set.x_rs6000_current_cmodel)      \
-           SET_CMODEL (CMODEL_MEDIUM);                         \
-         if ((rs6000_isa_flags_explicit                        \
-              & OPTION_MASK_MINIMAL_TOC) != 0)                 \
-           {                                                   \
-             if (global_options_set.x_rs6000_current_cmodel    \
-                 && rs6000_current_cmodel != CMODEL_SMALL)     \
-               error ("%<-mcmodel incompatible with other toc options%>"); \
-             if (TARGET_MINIMAL_TOC)                           \
-               SET_CMODEL (CMODEL_SMALL);                      \
-             else if (TARGET_PCREL                             \
-                      || (PCREL_SUPPORTED_BY_OS                \
-                          && (rs6000_isa_flags_explicit        \
-                              & OPTION_MASK_PCREL) == 0))      \
-               /* Ignore -mno-minimal-toc.  */                 \
-               ;                                               \
-             else                                              \
-               SET_CMODEL (CMODEL_SMALL);                      \
-           }                                                   \
-         else                                                  \
-           {                                                   \
-             if (rs6000_current_cmodel != CMODEL_SMALL)        \
-               {                                               \
-                 if (!global_options_set.x_TARGET_NO_FP_IN_TOC) \
-                   TARGET_NO_FP_IN_TOC                         \
-                     = rs6000_current_cmodel == CMODEL_MEDIUM; \
-                 if (!global_options_set.x_TARGET_NO_SUM_IN_TOC) \
-                   TARGET_NO_SUM_IN_TOC = 0;                   \
-               }                                               \
-           }                                                   \
-         if (TARGET_PLTSEQ && DEFAULT_ABI != ABI_ELFv2)        \
-           {                                                   \
-             if (global_options_set.x_rs6000_pltseq)           \
-               warning (0, "%qs unsupported for this ABI",     \
-                        "-mpltseq");                           \
-             rs6000_pltseq = false;                            \
-           }                                                   \
-       }                                                       \
-      else                                                     \
-       {                                                       \
-         if (!RS6000_BI_ARCH_P)                                \
-           error (INVALID_32BIT, "32");                        \
-         if (TARGET_PROFILE_KERNEL)                            \
-           {                                                   \
-             TARGET_PROFILE_KERNEL = 0;                        \
-             error (INVALID_32BIT, "profile-kernel");          \
-           }                                                   \
-         if (global_options_set.x_rs6000_current_cmodel)       \
-           {                                                   \
-             SET_CMODEL (CMODEL_SMALL);                        \
-             error (INVALID_32BIT, "cmodel");                  \
-           }                                                   \
-       }                                                       \
-    }                                                          \
-  while (0)
+  do rs6000_linux64_override_options (); while (0)
 
 #undef ASM_SPEC
 #undef LINK_OS_LINUX_SPEC
index 6a05f84a021c792bc1d7aa821393266c3ab65b83..f5f927f30322e8dea27e344af131151b2a37c27c 100644 (file)
@@ -3452,6 +3452,102 @@ rs6000_override_options_after_change (void)
     flag_cunroll_grow_size = flag_peel_loops || optimize >= 3;
 }
 
+#ifdef TARGET_USES_LINUX64_OPT
+static void
+rs6000_linux64_override_options ()
+{
+  if (!global_options_set.x_rs6000_alignment_flags)
+    rs6000_alignment_flags = MASK_ALIGN_NATURAL;
+  if (rs6000_isa_flags & OPTION_MASK_64BIT)
+    {
+      if (DEFAULT_ABI != ABI_AIX)
+       {
+         rs6000_current_abi = ABI_AIX;
+         error (INVALID_64BIT, "call");
+       }
+      dot_symbols = !strcmp (rs6000_abi_name, "aixdesc");
+      if (ELFv2_ABI_CHECK)
+       {
+         rs6000_current_abi = ABI_ELFv2;
+         if (dot_symbols)
+           error ("%<-mcall-aixdesc%> incompatible with %<-mabi=elfv2%>");
+       }
+      if (rs6000_isa_flags & OPTION_MASK_RELOCATABLE)
+       {
+         rs6000_isa_flags &= ~OPTION_MASK_RELOCATABLE;
+         error (INVALID_64BIT, "relocatable");
+       }
+      if (rs6000_isa_flags & OPTION_MASK_EABI)
+       {
+         rs6000_isa_flags &= ~OPTION_MASK_EABI;
+         error (INVALID_64BIT, "eabi");
+       }
+      if (TARGET_PROTOTYPE)
+       {
+         target_prototype = 0;
+         error (INVALID_64BIT, "prototype");
+       }
+      if ((rs6000_isa_flags & OPTION_MASK_POWERPC64) == 0)
+       {
+         rs6000_isa_flags |= OPTION_MASK_POWERPC64;
+         error ("%<-m64%> requires a PowerPC64 cpu");
+       }
+      if (!global_options_set.x_rs6000_current_cmodel)
+       SET_CMODEL (CMODEL_MEDIUM);
+      if ((rs6000_isa_flags_explicit
+          & OPTION_MASK_MINIMAL_TOC) != 0)
+       {
+         if (global_options_set.x_rs6000_current_cmodel
+             && rs6000_current_cmodel != CMODEL_SMALL)
+           error ("%<-mcmodel incompatible with other toc options%>");
+         if (TARGET_MINIMAL_TOC)
+           SET_CMODEL (CMODEL_SMALL);
+         else if (TARGET_PCREL
+                  || (PCREL_SUPPORTED_BY_OS
+                      && (rs6000_isa_flags_explicit
+                          & OPTION_MASK_PCREL) == 0))
+           /* Ignore -mno-minimal-toc.  */
+           ;
+         else
+           SET_CMODEL (CMODEL_SMALL);
+       }
+      else
+       {
+         if (rs6000_current_cmodel != CMODEL_SMALL)
+           {
+             if (!global_options_set.x_TARGET_NO_FP_IN_TOC)
+               TARGET_NO_FP_IN_TOC
+                 = rs6000_current_cmodel == CMODEL_MEDIUM;
+             if (!global_options_set.x_TARGET_NO_SUM_IN_TOC)
+               TARGET_NO_SUM_IN_TOC = 0;
+           }
+       }
+      if (TARGET_PLTSEQ && DEFAULT_ABI != ABI_ELFv2)
+       {
+         if (global_options_set.x_rs6000_pltseq)
+           warning (0, "%qs unsupported for this ABI",
+                    "-mpltseq");
+         rs6000_pltseq = false;
+       }
+    }
+  else if (TARGET_64BIT)
+    error (INVALID_32BIT, "32");
+  else
+    {
+      if (TARGET_PROFILE_KERNEL)
+       {
+         profile_kernel = 0;
+         error (INVALID_32BIT, "profile-kernel");
+       }
+      if (global_options_set.x_rs6000_current_cmodel)
+       {
+         SET_CMODEL (CMODEL_SMALL);
+         error (INVALID_32BIT, "cmodel");
+       }
+    }
+}
+#endif
+
 /* Override command line options.
 
    Combine build-specific configuration information with options