]> git.ipfire.org Git - thirdparty/gcc.git/blobdiff - gcc/config/rs6000/freebsd64.h
Update copyright years.
[thirdparty/gcc.git] / gcc / config / rs6000 / freebsd64.h
index 909f703a07eb058843769818c7282012231d1ab8..c9913638ffbece3ffc6b9c44d7a9ba7d67fd9bde 100644 (file)
@@ -1,5 +1,5 @@
 /* Definitions for 64-bit PowerPC running FreeBSD using the ELF format
-   Copyright (C) 2012 Free Software Foundation, Inc.
+   Copyright (C) 2012-2020 Free Software Foundation, Inc.
 
    This file is part of GCC.
 
    along with GCC; see the file COPYING3.  If not see
    <http://www.gnu.org/licenses/>.  */
 
+/* Undef gnu-user.h macros we don't want.  */
+#undef CPLUSPLUS_CPP_SPEC
+#undef LINK_GCC_C_SEQUENCE_SPEC
+
 /* Override the defaults, which exist to force the proper definition.  */
 
 #ifdef IN_LIBGCC2
@@ -57,7 +61,7 @@ extern int dot_symbols;
    -mrelocatable or -mrelocatable-lib is given.  */
 #undef RELOCATABLE_NEEDS_FIXUP
 #define RELOCATABLE_NEEDS_FIXUP \
-  (target_flags & target_flags_explicit & MASK_RELOCATABLE)
+  (rs6000_isa_flags & rs6000_isa_flags_explicit & OPTION_MASK_RELOCATABLE)
 
 #undef  RS6000_ABI_NAME
 #define RS6000_ABI_NAME "freebsd"
@@ -65,6 +69,13 @@ extern int dot_symbols;
 #define INVALID_64BIT "-m%s not supported in this configuration"
 #define INVALID_32BIT INVALID_64BIT
 
+/* Use LINUX64 instead of FREEBSD64 for compat with e.g. sysv4le.h */
+#ifdef LINUX64_DEFAULT_ABI_ELFv2
+#define ELFv2_ABI_CHECK (rs6000_elf_abi != 1)
+#else
+#define ELFv2_ABI_CHECK (rs6000_elf_abi == 2)
+#endif
+
 #undef  SUBSUBTARGET_OVERRIDE_OPTIONS
 #define SUBSUBTARGET_OVERRIDE_OPTIONS                          \
   do                                                           \
@@ -79,14 +90,20 @@ extern int dot_symbols;
              error (INVALID_64BIT, "call");                    \
            }                                                   \
          dot_symbols = !strcmp (rs6000_abi_name, "aixdesc");   \
-         if (target_flags & MASK_RELOCATABLE)                  \
+         if (rs6000_isa_flags & OPTION_MASK_RELOCATABLE)       \
            {                                                   \
-             target_flags &= ~MASK_RELOCATABLE;                \
+             rs6000_isa_flags &= ~OPTION_MASK_RELOCATABLE;     \
              error (INVALID_64BIT, "relocatable");             \
            }                                                   \
-         if (target_flags & MASK_EABI)                         \
+         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)              \
            {                                                   \
-             target_flags &= ~MASK_EABI;                       \
+             rs6000_isa_flags &= ~OPTION_MASK_EABI;            \
              error (INVALID_64BIT, "eabi");                    \
            }                                                   \
          if (TARGET_PROTOTYPE)                                 \
@@ -94,16 +111,17 @@ extern int dot_symbols;
              target_prototype = 0;                             \
              error (INVALID_64BIT, "prototype");               \
            }                                                   \
-         if ((target_flags & MASK_POWERPC64) == 0)             \
+         if ((rs6000_isa_flags & OPTION_MASK_POWERPC64) == 0)  \
            {                                                   \
-             target_flags |= MASK_POWERPC64;                   \
-             error ("-m64 requires a PowerPC64 cpu");          \
+             rs6000_isa_flags |= OPTION_MASK_POWERPC64;        \
+             error ("%<-m64%> requires a PowerPC64 cpu");              \
            }                                                   \
-          if ((target_flags_explicit & MASK_MINIMAL_TOC) != 0) \
+          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"); \
+               error ("%<-mcmodel%> incompatible with other toc options"); \
              SET_CMODEL (CMODEL_SMALL);                        \
            }                                                   \
          else                                                  \
@@ -120,16 +138,14 @@ extern int dot_symbols;
     }                                                          \
   while (0)
 
-#undef ASM_DEFAULT_SPEC
 #undef ASM_SPEC
 #undef LINK_OS_FREEBSD_SPEC
 
-#define        ASM_DEFAULT_SPEC "-mppc%{!m32:64}"
 #define        ASM_SPEC         "%{m32:%(asm_spec32)}%{!m32:%(asm_spec64)} %(asm_spec_common)"
 #define        LINK_OS_FREEBSD_SPEC "%{m32:%(link_os_freebsd_spec32)}%{!m32:%(link_os_freebsd_spec64)}"
 
 #define ASM_SPEC32 "-a32 \
-%{mrelocatable} %{mrelocatable-lib} %{fpic:-K PIC} %{fPIC:-K PIC} \
+%{mrelocatable} %{mrelocatable-lib} %{" FPIE_OR_FPIC_SPEC ":-K PIC} \
 %{memb} %{!memb: %{msdata=eabi: -memb}} \
 %{!mlittle: %{!mlittle-endian: %{!mbig: %{!mbig-endian: \
     %{mcall-freebsd: -mbig} \
@@ -153,22 +169,7 @@ extern int dot_symbols;
   { "link_os_freebsd_spec32",  LINK_OS_FREEBSD_SPEC32 },               \
   { "link_os_freebsd_spec64",  LINK_OS_FREEBSD_SPEC64 },
 
-#define FREEBSD_DYNAMIC_LINKER32 "/libexec/ld-elf32.so.1"
-#define FREEBSD_DYNAMIC_LINKER64 "/libexec/ld-elf.so.1"
-
-#define LINK_OS_FREEBSD_SPEC_DEF32 "\
-  %{p:%nconsider using `-pg' instead of `-p' with gprof(1)} \
-  %{v:-V} \
-  %{assert*} %{R*} %{rpath*} %{defsym*} \
-  %{shared:-Bshareable %{h*} %{soname*}} \
-  %{!shared: \
-    %{!static: \
-      %{rdynamic: -export-dynamic} \
-      %{!dynamic-linker:-dynamic-linker " FREEBSD_DYNAMIC_LINKER32 "}} \
-    %{static:-Bstatic}} \
-  %{symbolic:-Bsymbolic}"
-
-#define LINK_OS_FREEBSD_SPEC_DEF64 "\
+#define LINK_OS_FREEBSD_SPEC_DEF "\
   %{p:%nconsider using `-pg' instead of `-p' with gprof(1)} \
   %{v:-V} \
   %{assert*} %{R*} %{rpath*} %{defsym*} \
@@ -176,13 +177,13 @@ extern int dot_symbols;
   %{!shared: \
     %{!static: \
       %{rdynamic: -export-dynamic} \
-      %{!dynamic-linker:-dynamic-linker " FREEBSD_DYNAMIC_LINKER64 "}} \
+      %{!dynamic-linker:-dynamic-linker " FBSD_DYNAMIC_LINKER "}} \
     %{static:-Bstatic}} \
   %{symbolic:-Bsymbolic}"
 
-#define LINK_OS_FREEBSD_SPEC32 "-melf32ppc_fbsd " LINK_OS_FREEBSD_SPEC_DEF32
+#define LINK_OS_FREEBSD_SPEC32 "-melf32ppc_fbsd " LINK_OS_FREEBSD_SPEC_DEF
   
-#define LINK_OS_FREEBSD_SPEC64 "-melf64ppc_fbsd " LINK_OS_FREEBSD_SPEC_DEF64
+#define LINK_OS_FREEBSD_SPEC64 "-melf64ppc_fbsd " LINK_OS_FREEBSD_SPEC_DEF
 
 #undef MULTILIB_DEFAULTS
 #define MULTILIB_DEFAULTS { "m64" }
@@ -226,7 +227,7 @@ extern int dot_symbols;
    registers and memory.  FIRST is nonzero if this is the only
    element.  */
 #define BLOCK_REG_PADDING(MODE, TYPE, FIRST) \
-  (!(FIRST) ? upward : FUNCTION_ARG_PADDING (MODE, TYPE))
+  (!(FIRST) ? PAD_UPWARD : targetm.calls.function_arg_padding (MODE, TYPE))
 
 /* FreeBSD doesn't support saving and restoring 64-bit regs with a 32-bit
    kernel. This is supported when running on a 64-bit kernel with
@@ -303,23 +304,10 @@ extern int dot_symbols;
 
 /* rs6000.h gets this wrong for FreeBSD.  We use the GCC defaults instead.  */
 #undef WCHAR_TYPE
-#define        WCHAR_TYPE      (TARGET_64BIT ? "int" : "long int")
+
 #undef  WCHAR_TYPE_SIZE
 #define WCHAR_TYPE_SIZE 32
 
-
-/* Override rs6000.h definition.  */
-#undef  ASM_APP_ON
-#define ASM_APP_ON "#APP\n"
-
-/* Override rs6000.h definition.  */
-#undef  ASM_APP_OFF
-#define ASM_APP_OFF "#NO_APP\n"
-
-/* PowerPC no-op instruction.  */
-#undef  RS6000_CALL_GLUE
-#define RS6000_CALL_GLUE (TARGET_64BIT ? "nop" : "cror 31,31,31")
-
 /* Function profiling bits */
 #undef  RS6000_MCOUNT
 #define RS6000_MCOUNT "_mcount"
@@ -354,7 +342,7 @@ extern int dot_symbols;
    true if the symbol may be affected by dynamic relocations.  */
 #undef ASM_PREFERRED_EH_DATA_FORMAT
 #define        ASM_PREFERRED_EH_DATA_FORMAT(CODE, GLOBAL) \
-  ((TARGET_64BIT || flag_pic || TARGET_RELOCATABLE)                    \
+  (TARGET_64BIT || flag_pic                                            \
    ? (((GLOBAL) ? DW_EH_PE_indirect : 0) | DW_EH_PE_pcrel              \
       | (TARGET_64BIT ? DW_EH_PE_udata8 : DW_EH_PE_sdata4))            \
    : DW_EH_PE_absptr)
@@ -365,16 +353,17 @@ extern int dot_symbols;
 /* The default value isn't sufficient in 64-bit mode.  */
 #define STACK_CHECK_PROTECT (TARGET_64BIT ? 16 * 1024 : 12 * 1024)
 
-#define DBX_REGISTER_NUMBER(REGNO) rs6000_dbx_register_number (REGNO)
+/* Use standard DWARF numbering for DWARF debugging information.  */
+#define RS6000_USE_DWARF_NUMBERING
 
 /* PowerPC64 Linux word-aligns FP doubles when -malign-power is given.  */
 #undef  ADJUST_FIELD_ALIGN
-#define ADJUST_FIELD_ALIGN(FIELD, COMPUTED) \
-  ((TARGET_ALTIVEC && TREE_CODE (TREE_TYPE (FIELD)) == VECTOR_TYPE)     \
+#define ADJUST_FIELD_ALIGN(FIELD, TYPE, COMPUTED) \
+  (rs6000_special_adjust_field_align_p ((TYPE), (COMPUTED))            \
    ? 128                                                                \
    : (TARGET_64BIT                                                      \
       && TARGET_ALIGN_NATURAL == 0                                      \
-      && TYPE_MODE (strip_array_types (TREE_TYPE (FIELD))) == DFmode)   \
+      && TYPE_MODE (strip_array_types (TYPE)) == DFmode)               \
    ? MIN ((COMPUTED), 32)                                               \
    : (COMPUTED))
 
@@ -388,7 +377,7 @@ extern int dot_symbols;
 #define MINIMAL_TOC_SECTION_ASM_OP \
   (TARGET_64BIT                                         \
    ? "\t.section\t\".toc1\",\"aw\""                     \
-   : ((TARGET_RELOCATABLE || flag_pic)                  \
+   : (flag_pic                                         \
       ? "\t.section\t\".got2\",\"aw\""                  \
       : "\t.section\t\".got1\",\"aw\""))
 
@@ -413,20 +402,19 @@ extern int dot_symbols;
 #undef  ASM_OUTPUT_SPECIAL_POOL_ENTRY_P
 #define ASM_OUTPUT_SPECIAL_POOL_ENTRY_P(X, MODE)                        \
   (TARGET_TOC                                                           \
-   && (GET_CODE (X) == SYMBOL_REF                                       \
+   && (SYMBOL_REF_P (X)                                                        \
        || (GET_CODE (X) == CONST && GET_CODE (XEXP (X, 0)) == PLUS      \
-           && GET_CODE (XEXP (XEXP (X, 0), 0)) == SYMBOL_REF)           \
+           && SYMBOL_REF_P (XEXP (XEXP (X, 0), 0)))                    \
        || GET_CODE (X) == LABEL_REF                                     \
-       || (GET_CODE (X) == CONST_INT                                    \
+       || (CONST_INT_P (X)                                             \
            && GET_MODE_BITSIZE (MODE) <= GET_MODE_BITSIZE (Pmode))      \
-       || (GET_CODE (X) == CONST_DOUBLE                                 \
+       || (CONST_DOUBLE_P (X)                                          \
            && ((TARGET_64BIT                                            \
                 && (TARGET_MINIMAL_TOC                                  \
                     || (SCALAR_FLOAT_MODE_P (GET_MODE (X))              \
                         && ! TARGET_NO_FP_IN_TOC)))                     \
                || (!TARGET_64BIT                                        \
                    && !TARGET_NO_FP_IN_TOC                              \
-                   && !TARGET_RELOCATABLE                               \
                    && SCALAR_FLOAT_MODE_P (GET_MODE (X))                \
                    && BITS_PER_WORD == HOST_BITS_PER_INT)))))