re PR target/47558 (163267 breaks exception traceback in xplor-nih)
authorMike Stump <mikestump@comcast.net>
Mon, 7 Feb 2011 20:41:50 +0000 (20:41 +0000)
committerMike Stump <mrs@gcc.gnu.org>
Mon, 7 Feb 2011 20:41:50 +0000 (20:41 +0000)
PR target/47558
Add __ieee_divdc3 entry point.
* config/i386/darwin.h (DECLARE_LIBRARY_RENAMES): Retain ___divdc3
entry point.
(SUBTARGET_INIT_BUILTINS): Call darwin_rename_builtins.
* config/i386/i386.c (TARGET_INIT_LIBFUNCS): Likewise.
* config/darwin.c (darwin_rename_builtins): Add.
* config/darwin-protos.h (darwin_rename_builtins): Add.

From-SVN: r169902

gcc/ChangeLog
gcc/config/darwin-protos.h
gcc/config/darwin.c
gcc/config/i386/darwin.h
gcc/config/i386/i386.c

index 73d70a782b8cede3b708f6813994f3a1bd201631..e46a0604085a5f70882dcb1d222187a39fb42249 100644 (file)
@@ -1,3 +1,14 @@
+2011-02-07  Mike Stump  <mikestump@comcast.net>
+
+       PR target/47558
+       Add __ieee_divdc3 entry point.
+       * config/i386/darwin.h (DECLARE_LIBRARY_RENAMES): Retain ___divdc3
+       entry point.
+       (SUBTARGET_INIT_BUILTINS): Call darwin_rename_builtins.
+       * config/i386/i386.c (TARGET_INIT_LIBFUNCS): Likewise.
+       * config/darwin.c (darwin_rename_builtins): Add.
+       * config/darwin-protos.h (darwin_rename_builtins): Add.
+
 2011-02-07  Michael Meissner  <meissner@linux.vnet.ibm.com>
 
        PR target/47636
index bf81ed97c4c137c77a64c06d8d4dcea61d87c928..00230994ad5750d410d7a1b24621b22e1d6e534e 100644 (file)
@@ -124,3 +124,4 @@ extern bool darwin_use_anchors_for_symbol_p (const_rtx symbol);
 extern bool darwin_kextabi_p (void);
 extern void darwin_override_options (void);
 extern void darwin_patch_builtins (void);
+extern void darwin_rename_builtins (void);
index cd6a815a4835902fc5fb26f844590e7f6ee67da9..8ccf18c4426729434538486fc14d4293e47ab1df 100644 (file)
@@ -2823,6 +2823,34 @@ darwin_fold_builtin (tree fndecl, int n_args, tree *argp,
   return NULL_TREE;
 }
 
+void
+darwin_rename_builtins (void)
+{
+  /* The system ___divdc3 routine in libSystem on darwin10 is not
+     accurate to 1ulp, ours is, so we avoid ever using the system name
+     for this routine and instead install a non-conflicting name that
+     is accurate.
+
+     When -ffast-math or -funsafe-math-optimizations is given, we can
+     use the faster version.  */
+  if (!flag_unsafe_math_optimizations)
+    {
+      int dcode = (BUILT_IN_COMPLEX_DIV_MIN
+                  + DCmode - MIN_MODE_COMPLEX_FLOAT);
+      tree fn = built_in_decls[dcode];
+      /* Fortran and c call TARGET_INIT_BUILTINS and
+        TARGET_INIT_LIBFUNCS at different times, so we have to put a
+        call into each to ensure that at least one of them is called
+        after build_common_builtin_nodes.  A better fix is to add a
+        new hook to run after build_common_builtin_nodes runs.  */
+      if (fn)
+       set_user_assembler_name (fn, "___ieee_divdc3");
+      fn = implicit_built_in_decls[dcode];
+      if (fn)
+       set_user_assembler_name (fn, "___ieee_divdc3");
+    }
+}
+
 static hashval_t
 cfstring_hash (const void *ptr)
 {
index a9a2da4040e6688fb6d2470a528a3de864eab4e3..9cf51e326006fd58fb6f2c9149a260edb1c2f683 100644 (file)
@@ -309,5 +309,14 @@ do {                                                                       \
 #define SUBTARGET_INIT_BUILTINS                                        \
 do {                                                           \
   darwin_init_cfstring_builtins ((unsigned) (IX86_BUILTIN_MAX));\
+  darwin_rename_builtins ();                                   \
 } while(0)
 
+/* The system ___divdc3 routine in libSystem on darwin10 is not
+   accurate to 1ulp, ours is, so we avoid ever using the system name
+   for this routine and instead install a non-conflicting name that is
+   accurate.  See darwin_rename_builtins.  */
+#ifdef L_divdc3
+#define DECLARE_LIBRARY_RENAMES \
+  asm(".text; ___divdc3: jmp ___ieee_divdc3 ; .globl ___divdc3");
+#endif
index 4d927c2b259b7e3c2b5691f3791f3ec82b6a8657..12c7062e5ae43b644c063e203d5aea2301016252 100644 (file)
@@ -35040,6 +35040,11 @@ ix86_autovectorize_vector_sizes (void)
 #undef TARGET_CONDITIONAL_REGISTER_USAGE
 #define TARGET_CONDITIONAL_REGISTER_USAGE ix86_conditional_register_usage
 
+#if TARGET_MACHO
+#undef TARGET_INIT_LIBFUNCS
+#define TARGET_INIT_LIBFUNCS darwin_rename_builtins
+#endif
+
 struct gcc_target targetm = TARGET_INITIALIZER;
 \f
 #include "gt-i386.h"