]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
* configure.ac (.hidden): Change to conftest_s string. Provide string
authordje <dje@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 7 Nov 2016 20:16:13 +0000 (20:16 +0000)
committerdje <dje@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 7 Nov 2016 20:16:13 +0000 (20:16 +0000)
for AIX assembler.
(gcc_cv_ld_hidden): Yes for AIX.
* configure: Regenerate.

* dwarf2asm.c (USE_LINKONCE_INDIRECT): Don't set for AIX (XCOFF).

* config/rs6000/rs6000-protos.h (rs6000_asm_weaken_decl): Declare
(rs6000_xcoff_asm_output_aligned_decl_common): Declare.
* config/rs6000/xcoff.h (TARGET_ASM_GLOBALIZE_DECL_NAME): Define.
(ASM_OUTPUT_ALIGNED_DECL_COMMON): Define.
(ASM_OUTPUT_ALIGNED_COMMON): Delete.
* config/rs6000/rs6000.c (rs6000_init_builtins): Change clog rename
from #if to if.
(rs6000_xcoff_visibility): New.
(rs6000_xcoff_declare_function_name): Add visibility support.
(rs6000_xcoff_asm_globalize_decl_name): New.
(rs6000_xcoff_asm_output_aligned_decl_common): New.
(rs6000_asm_weaken_decl): New.
(rs6000_code_end): Disable HIDDEN_LINKONCE on XCOFF.
config/rs6000/rs6000.h (ASM_WEAKEN_DECL): Change definition to
reference function.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@241930 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/config/rs6000/rs6000-protos.h
gcc/config/rs6000/rs6000.c
gcc/config/rs6000/rs6000.h
gcc/config/rs6000/xcoff.h
gcc/configure
gcc/configure.ac
gcc/dwarf2asm.c

index eaa59f29837d10ea16cec070f9bea50018308cb4..ce1f8e3d31747496b93c46669c38587b6f70a046 100644 (file)
@@ -1,3 +1,28 @@
+2016-11-06  David Edelsohn  <dje.gcc@gmail.com>
+
+       * configure.ac (.hidden): Change to conftest_s string. Provide string
+       for AIX assembler.
+       (gcc_cv_ld_hidden): Yes for AIX.
+       * configure: Regenerate.
+
+       * dwarf2asm.c (USE_LINKONCE_INDIRECT): Don't set for AIX (XCOFF).
+
+       * config/rs6000/rs6000-protos.h (rs6000_asm_weaken_decl): Declare
+       (rs6000_xcoff_asm_output_aligned_decl_common): Declare.
+       * config/rs6000/xcoff.h (TARGET_ASM_GLOBALIZE_DECL_NAME): Define.
+       (ASM_OUTPUT_ALIGNED_DECL_COMMON): Define.
+       (ASM_OUTPUT_ALIGNED_COMMON): Delete.
+       * config/rs6000/rs6000.c (rs6000_init_builtins): Change clog rename
+       from #if to if.
+       (rs6000_xcoff_visibility): New.
+       (rs6000_xcoff_declare_function_name): Add visibility support.
+       (rs6000_xcoff_asm_globalize_decl_name): New.
+       (rs6000_xcoff_asm_output_aligned_decl_common): New.
+       (rs6000_asm_weaken_decl): New.
+       (rs6000_code_end): Disable HIDDEN_LINKONCE on XCOFF.
+       config/rs6000/rs6000.h (ASM_WEAKEN_DECL): Change definition to
+       reference function.
+
 2016-11-06  Jack Howarth  <howarth.at.gcc@gmail.com>
 
        PR driver/78206
index 8f07450d72ba5cb136c322d4265ea86e4e70bae8..989557f76c956624d5c95c235b27f96dc50adfc4 100644 (file)
@@ -187,8 +187,13 @@ extern rtx rs6000_libcall_value (machine_mode);
 extern rtx rs6000_va_arg (tree, tree);
 extern int function_ok_for_sibcall (tree);
 extern int rs6000_reg_parm_stack_space (tree, bool);
+extern void rs6000_asm_weaken_decl (FILE *, tree, const char *, const char *);
 extern void rs6000_xcoff_declare_function_name (FILE *, const char *, tree);
 extern void rs6000_xcoff_declare_object_name (FILE *, const char *, tree);
+extern void rs6000_xcoff_asm_output_aligned_decl_common (FILE *, tree,
+                                                        const char *,
+                                                        unsigned HOST_WIDE_INT,
+                                                        unsigned HOST_WIDE_INT);
 extern void rs6000_elf_declare_function_name (FILE *, const char *, tree);
 extern bool rs6000_elf_in_small_data_p (const_tree);
 #ifdef ARGS_SIZE_RTX
index b0d2b6430a650fd174903ca57b0e3c3ee4463f6c..1316252e48141f876316ee1ecac9a709038a904f 100644 (file)
@@ -16982,11 +16982,10 @@ rs6000_init_builtins (void)
   def_builtin ("__builtin_cpu_is", ftype, RS6000_BUILTIN_CPU_IS);
   def_builtin ("__builtin_cpu_supports", ftype, RS6000_BUILTIN_CPU_SUPPORTS);
 
-#if TARGET_XCOFF
   /* AIX libm provides clog as __clog.  */
-  if ((tdecl = builtin_decl_explicit (BUILT_IN_CLOG)) != NULL_TREE)
+  if (TARGET_XCOFF &&
+      (tdecl = builtin_decl_explicit (BUILT_IN_CLOG)) != NULL_TREE)
     set_user_assembler_name (tdecl, "__clog");
-#endif
 
 #ifdef SUBTARGET_INIT_BUILTINS
   SUBTARGET_INIT_BUILTINS;
@@ -35364,6 +35363,31 @@ rs6000_declare_alias (struct symtab_node *n, void *d)
   return false;
 }
 
+
+#ifdef HAVE_GAS_HIDDEN
+/* Helper function to calculate visibility of a DECL
+   and return the value as a const string.  */
+
+static const char *
+rs6000_xcoff_visibility (tree decl)
+{
+  static const char * const visibility_types[] = {
+    "", ",protected", ",hidden", ",internal"
+  };
+
+  enum symbol_visibility vis = DECL_VISIBILITY (decl);
+
+  if (TREE_CODE (decl) == FUNCTION_DECL
+      && cgraph_node::get (decl)
+      && cgraph_node::get (decl)->instrumentation_clone
+      && cgraph_node::get (decl)->instrumented_version)
+    vis = DECL_VISIBILITY (cgraph_node::get (decl)->instrumented_version->decl);
+
+  return visibility_types[vis];
+}
+#endif
+
+
 /* This macro produces the initial definition of a function name.
    On the RS/6000, we need to place an extra '.' in the function name and
    output the function descriptor.
@@ -35403,6 +35427,9 @@ rs6000_xcoff_declare_function_name (FILE *file, const char *name, tree decl)
            }
          fputs ("\t.globl .", file);
          RS6000_OUTPUT_BASENAME (file, buffer);
+#ifdef HAVE_GAS_HIDDEN
+         fputs (rs6000_xcoff_visibility (decl), file);
+#endif
          putc ('\n', file);
        }
     }
@@ -35447,6 +35474,52 @@ rs6000_xcoff_declare_function_name (FILE *file, const char *name, tree decl)
   return;
 }
 
+
+/* Output assembly language to globalize a symbol from a DECL,
+   possibly with visibility.  */
+
+void
+rs6000_xcoff_asm_globalize_decl_name (FILE *stream, tree decl)
+{
+  const char *name = XSTR (XEXP (DECL_RTL (decl), 0), 0);
+  fputs (GLOBAL_ASM_OP, stream);
+  RS6000_OUTPUT_BASENAME (stream, name);
+#ifdef HAVE_GAS_HIDDEN
+  fputs (rs6000_xcoff_visibility (decl), stream);
+#endif
+  putc ('\n', stream);
+}
+
+/* Output assembly language to define a symbol as COMMON from a DECL,
+   possibly with visibility.  */
+
+void
+rs6000_xcoff_asm_output_aligned_decl_common (FILE *stream,
+                                            tree decl ATTRIBUTE_UNUSED,
+                                            const char *name,
+                                            unsigned HOST_WIDE_INT size,
+                                            unsigned HOST_WIDE_INT align)
+{
+  unsigned HOST_WIDE_INT align2 = 2;
+
+  if (align > 32)
+    align2 = floor_log2 (align / BITS_PER_UNIT);
+  else if (size > 4)
+    align2 = 3;
+
+  fputs (COMMON_ASM_OP, stream);
+  RS6000_OUTPUT_BASENAME (stream, name);
+
+  fprintf (stream,
+          "," HOST_WIDE_INT_PRINT_UNSIGNED "," HOST_WIDE_INT_PRINT_UNSIGNED,
+          size, align2);
+
+#ifdef HAVE_GAS_HIDDEN
+  fputs (rs6000_xcoff_visibility (decl), stream);
+#endif
+  putc ('\n', stream);
+}
+
 /* This macro produces the initial definition of a object (variable) name.
    Because AIX assembler's .set command has unexpected semantics, we output
    all aliases as alternative labels in front of the definition.  */
@@ -35528,6 +35601,45 @@ rs6000_xcoff_encode_section_info (tree decl, rtx rtl, int first)
 #endif /* HAVE_AS_TLS */
 #endif /* TARGET_XCOFF */
 
+void
+rs6000_asm_weaken_decl (FILE *stream, tree decl,
+                       const char *name, const char *val)
+{
+  fputs ("\t.weak\t", stream);
+  RS6000_OUTPUT_BASENAME (stream, name);
+  if (decl && TREE_CODE (decl) == FUNCTION_DECL
+      && DEFAULT_ABI == ABI_AIX && DOT_SYMBOLS)
+    {
+      if (TARGET_XCOFF)                                                
+       fputs ("[DS]", stream);
+#if HAVE_GAS_HIDDEN
+      if (TARGET_XCOFF)
+       fputs (rs6000_xcoff_visibility (decl), stream);
+#endif
+      fputs ("\n\t.weak\t.", stream);
+      RS6000_OUTPUT_BASENAME (stream, name);
+    }
+#if HAVE_GAS_HIDDEN
+  if (TARGET_XCOFF)
+    fputs (rs6000_xcoff_visibility (decl), stream);
+#endif
+  fputc ('\n', stream);
+  if (val)
+    {
+      ASM_OUTPUT_DEF (stream, name, val);
+      if (decl && TREE_CODE (decl) == FUNCTION_DECL
+         && DEFAULT_ABI == ABI_AIX && DOT_SYMBOLS)
+       {
+         fputs ("\t.set\t.", stream);
+         RS6000_OUTPUT_BASENAME (stream, name);
+         fputs (",.", stream);
+         RS6000_OUTPUT_BASENAME (stream, val);
+         fputc ('\n', stream);
+       }
+    }
+}
+
+
 /* Return true if INSN should not be copied.  */
 
 static bool
@@ -38699,7 +38811,7 @@ rs6000_code_end (void)
   TREE_STATIC (decl) = 1;
 
 #if RS6000_WEAK
-  if (USE_HIDDEN_LINKONCE)
+  if (USE_HIDDEN_LINKONCE && !TARGET_XCOFF)
     {
       cgraph_node::create (decl)->set_comdat_group (DECL_ASSEMBLER_NAME (decl));
       targetm.asm_out.unique_section (decl, 0);
index 584d68004652608da8362ddef0c695366186002f..1148212c7ff20f0febb21e34677d9b45ce1688ce 100644 (file)
@@ -2282,35 +2282,8 @@ extern int toc_initialized;
 
 #if RS6000_WEAK
 /* Used in lieu of ASM_WEAKEN_LABEL.  */
-#define        ASM_WEAKEN_DECL(FILE, DECL, NAME, VAL)                          \
-  do                                                                   \
-    {                                                                  \
-      fputs ("\t.weak\t", (FILE));                                     \
-      RS6000_OUTPUT_BASENAME ((FILE), (NAME));                                 \
-      if ((DECL) && TREE_CODE (DECL) == FUNCTION_DECL                  \
-         && DEFAULT_ABI == ABI_AIX && DOT_SYMBOLS)                     \
-       {                                                               \
-         if (TARGET_XCOFF)                                             \
-           fputs ("[DS]", (FILE));                                     \
-         fputs ("\n\t.weak\t.", (FILE));                               \
-         RS6000_OUTPUT_BASENAME ((FILE), (NAME));                      \
-       }                                                               \
-      fputc ('\n', (FILE));                                            \
-      if (VAL)                                                         \
-       {                                                               \
-         ASM_OUTPUT_DEF ((FILE), (NAME), (VAL));                       \
-         if ((DECL) && TREE_CODE (DECL) == FUNCTION_DECL               \
-             && DEFAULT_ABI == ABI_AIX && DOT_SYMBOLS)                 \
-           {                                                           \
-             fputs ("\t.set\t.", (FILE));                              \
-             RS6000_OUTPUT_BASENAME ((FILE), (NAME));                  \
-             fputs (",.", (FILE));                                     \
-             RS6000_OUTPUT_BASENAME ((FILE), (VAL));                   \
-             fputc ('\n', (FILE));                                     \
-           }                                                           \
-       }                                                               \
-    }                                                                  \
-  while (0)
+#define        ASM_WEAKEN_DECL(FILE, DECL, NAME, VAL) \
+  rs6000_asm_weaken_decl ((FILE), (DECL), (NAME), (VAL))
 #endif
 
 #if HAVE_GAS_WEAKREF
index cfdc528ef9543b40be42c33416d058dc111332b2..f63d28720ce56d9ac1de12eabc94d1650896b6ec 100644 (file)
@@ -89,6 +89,7 @@
 #undef TARGET_DEBUG_UNWIND_INFO
 #define TARGET_DEBUG_UNWIND_INFO  rs6000_xcoff_debug_unwind_info
 #define TARGET_ASM_OUTPUT_ANCHOR  rs6000_xcoff_asm_output_anchor
+#define TARGET_ASM_GLOBALIZE_DECL_NAME  rs6000_xcoff_asm_globalize_decl_name
 #define TARGET_ASM_GLOBALIZE_LABEL  rs6000_xcoff_asm_globalize_label
 #define TARGET_ASM_INIT_SECTIONS  rs6000_xcoff_asm_init_sections
 #define TARGET_ASM_RELOC_RW_MASK  rs6000_xcoff_reloc_rw_mask
 #ifdef HAVE_AS_TLS
 #define TARGET_ENCODE_SECTION_INFO rs6000_xcoff_encode_section_info
 #endif
+#define ASM_OUTPUT_ALIGNED_DECL_COMMON  rs6000_xcoff_asm_output_aligned_decl_common
 
 /* FP save and restore routines.  */
 #define        SAVE_FP_PREFIX "._savef"
 
 #define COMMON_ASM_OP "\t.comm "
 
-#define ASM_OUTPUT_ALIGNED_COMMON(FILE, NAME, SIZE, ALIGN)     \
-  do { fputs (COMMON_ASM_OP, (FILE));                  \
-       RS6000_OUTPUT_BASENAME ((FILE), (NAME));                \
-       if ((ALIGN) > 32)                               \
-        fprintf ((FILE), "," HOST_WIDE_INT_PRINT_UNSIGNED",%u\n", (SIZE), \
-                 floor_log2 ((ALIGN) / BITS_PER_UNIT)); \
-       else if ((SIZE) > 4)                            \
-         fprintf ((FILE), "," HOST_WIDE_INT_PRINT_UNSIGNED",3\n", (SIZE)); \
-       else                                            \
-        fprintf ((FILE), "," HOST_WIDE_INT_PRINT_UNSIGNED"\n", (SIZE)); \
-  } while (0)
-
 /* This says how to output an assembler line
    to define a local common symbol.
    The assembler in AIX 6.1 and later supports an alignment argument.
index 80fc5c71a0e4e90b25f88588487047910d4c7ce3..0f04033bc1d674a6b737315d3126a002d9f8e293 100755 (executable)
 # ld, we don't know its patchlevel version, so we set the baseline at 2.13
 # to be safe.
 # The gcc_GAS_CHECK_FEATURE call just sets a cache variable.
+case "${target}" in
+  *-*-aix*)
+    conftest_s='       .globl foobar,hidden'
+    ;;
+  *)
+    conftest_s='       .hidden foobar
+foobar:'
+    ;;
+esac
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler for .hidden" >&5
 $as_echo_n "checking assembler for .hidden... " >&6; }
 if test "${gcc_cv_as_hidden+set}" = set; then :
@@ -22674,8 +22683,7 @@ else
   then gcc_cv_as_hidden=yes
 fi
   elif test x$gcc_cv_as != x; then
-    $as_echo ' .hidden foobar
-foobar:' > conftest.s
+    $as_echo "$conftest_s" > conftest.s
     if { ac_try='$gcc_cv_as $gcc_cv_as_flags  -o conftest.o conftest.s >&5'
   { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
   (eval $ac_try) 2>&5
@@ -22809,6 +22817,9 @@ else
     fi
   else
     case "${target}" in
+      *-*-aix[789]*)
+        gcc_cv_ld_hidden=yes
+        ;;
       *-*-darwin*)
        # Darwin ld has some visibility support.
        gcc_cv_ld_hidden=yes
index 338956f644a2701b6bfe177c9a67a177aa558448..2f9b859eafb5e4cbcecaea0885bfd85c883e95d8 100644 (file)
@@ -2537,10 +2537,17 @@ gcc_GAS_CHECK_FEATURE([.nsubspa comdat], gcc_cv_as_nsubspa_comdat,
 # ld, we don't know its patchlevel version, so we set the baseline at 2.13
 # to be safe.
 # The gcc_GAS_CHECK_FEATURE call just sets a cache variable.
+case "${target}" in
+  *-*-aix*)
+    conftest_s='       .globl foobar,hidden'
+    ;;
+  *)
+    conftest_s='       .hidden foobar
+foobar:'
+    ;;
+esac
 gcc_GAS_CHECK_FEATURE([.hidden], gcc_cv_as_hidden,
- [elf,2,13,0],,
-[      .hidden foobar
-foobar:])
+ [elf,2,13,0],, [$conftest_s])
 case "${target}" in
   *-*-darwin*)
     # Darwin as has some visibility support, though with a different syntax.
@@ -2649,6 +2656,9 @@ else
     fi
   else
     case "${target}" in
+      *-*-aix[789]*)
+        gcc_cv_ld_hidden=yes
+        ;;
       *-*-darwin*)
        # Darwin ld has some visibility support.
        gcc_cv_ld_hidden=yes
index 473353885006231f6898efb5753e75b0f79899e2..80f385b0e13195c5cce8ecaec9beb063701a86ec 100644 (file)
@@ -824,7 +824,7 @@ static GTY(()) hash_map<const char *, tree> *indirect_pool;
 
 static GTY(()) int dw2_const_labelno;
 
-#if defined(HAVE_GAS_HIDDEN)
+#if defined(HAVE_GAS_HIDDEN) && !defined(XCOFF_DEBUGGING_INFO)
 # define USE_LINKONCE_INDIRECT (SUPPORTS_ONE_ONLY)
 #else
 # define USE_LINKONCE_INDIRECT 0