On any target which defines ASM_OUTPUT_EXTERNAL, there is some fiddling that has to be done with external labels. hpux is such a target, and any unresolved functions need to be emitted as CODE labels rather than the default DATA label.

previously, all __builtin functions were considered to be incorporeal and didnt need any processing, but this is not true for __atomic or even any __sync which may get to the point of being an external call.

Dave has already tested this patch against PR 51011 which he opened. I believe it did the trick?

bootstraps with no new regressions on x86_64-unknown-linux-gnu... as it should since most of this only makes it into the compiler if ASM_OUTPUT_EXTERNAL is actually defined.

Andrew

        PR other/51011
        * tree.h (is_builtin_name): No longer external.
        * builtins.c (is_builtin_name): Make static.
        * varasm.c (incorporeal_function_p): __sync and __atomic external calls
        are not incorporeal and may need asm label processing.

Index: tree.h
===================================================================
*** tree.h      (revision 181350)
--- tree.h      (working copy)
*************** extern tree build_va_arg_indirect_ref (t
*** 5460,5466 ****
  extern tree build_string_literal (int, const char *);
  extern bool validate_arglist (const_tree, ...);
  extern rtx builtin_memset_read_str (void *, HOST_WIDE_INT, enum machine_mode);
- extern bool is_builtin_name (const char *);
  extern bool is_builtin_fn (tree);
  extern unsigned int get_object_alignment_1 (tree, unsigned HOST_WIDE_INT *);
  extern unsigned int get_object_alignment (tree);
--- 5460,5465 ----
Index: builtins.c
===================================================================
*** builtins.c  (revision 181453)
--- builtins.c  (working copy)
*************** static void expand_builtin_sync_synchron
*** 227,233 ****
  
  /* Return true if NAME starts with __builtin_ or __sync_.  */
  
! bool
  is_builtin_name (const char *name)
  {
    if (strncmp (name, "__builtin_", 10) == 0)
--- 227,233 ----
  
  /* Return true if NAME starts with __builtin_ or __sync_.  */
  
! static bool
  is_builtin_name (const char *name)
  {
    if (strncmp (name, "__builtin_", 10) == 0)
Index: varasm.c
===================================================================
*** varasm.c    (revision 181350)
--- varasm.c    (working copy)
*************** incorporeal_function_p (tree decl)
*** 2109,2115 ****
        return true;
  
        name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl));
!       if (is_builtin_name (name))
        return true;
      }
    return false;
--- 2109,2117 ----
        return true;
  
        name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl));
!       /* Atomic or sync builtins which have survived this far will be
!        resolved externally and therefore are not incorporeal.  */
!       if (strncmp (name, "__builtin_", 10) == 0)
        return true;
      }
    return false;

Reply via email to