OSDN Git Service

* alpha.c (output_epilog [!VMS]): Don't tag global functions if
authorrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 27 Jan 1998 05:11:41 +0000 (05:11 +0000)
committerrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 27 Jan 1998 05:11:41 +0000 (05:11 +0000)
compiling with -fpic -- we want to be able to override symbols
properly.
(alpha_expand_block_move): Fix thinko in last change.
* alpha.h (ASM_OUTPUT_MI_THUNK): New define.
* config/alpha/win-nt.h (ASM_OUTPUT_MI_THUNK): New define.
* config/alpha/vms.h (ASM_OUTPUT_MI_THUNK): New undef.

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

gcc/ChangeLog
gcc/config/alpha/alpha.c
gcc/config/alpha/alpha.h
gcc/config/alpha/vms.h
gcc/config/alpha/win-nt.h

index 41b87ee..ba970d5 100644 (file)
@@ -1,3 +1,14 @@
+Tue Jan 27 05:05:26 1998  Richard Henderson  <rth@cygnus.com>
+
+       * alpha.c (output_epilog [!VMS]): Don't tag global functions if
+       compiling with -fpic -- we want to be able to override symbols
+       properly.
+       (alpha_expand_block_move): Fix thinko in last change.
+
+       * alpha.h (ASM_OUTPUT_MI_THUNK): New define.
+       * config/alpha/win-nt.h (ASM_OUTPUT_MI_THUNK): New define.
+       * config/alpha/vms.h (ASM_OUTPUT_MI_THUNK): New undef.
+       
 Tue Jan 27 03:21:23 1998  Richard Henderson  <rth@cygnus.com>
 
        * alpha.md (abssf, absdf): Revert last change.
index 0762de4..c5d1325 100644 (file)
@@ -1616,9 +1616,11 @@ alpha_expand_block_move (operands)
 
   /* Ideally we would do nice things when noticing the addressof.  */
   if (GET_CODE (XEXP (orig_src, 0)) == ADDRESSOF)
-    orig_src = copy_addr_to_reg (XEXP (orig_src, 0));
+    orig_src = change_address (orig_src, GET_MODE (orig_src),
+                              copy_addr_to_reg (XEXP (orig_src, 0)));
   if (GET_CODE (XEXP (orig_dst, 0)) == ADDRESSOF)
-    orig_dst = copy_addr_to_reg (XEXP (orig_dst, 0));
+    orig_dst = change_address (orig_dst, GET_MODE (orig_dst),
+                              copy_addr_to_reg (XEXP (orig_dst, 0)));
 
   /* Handle a block of contiguous words first.  */
 
@@ -3400,8 +3402,15 @@ output_epilog (file, size)
     }
   inside_function = FALSE;
 
-  /* Show that we know this function if it is called again.  */
-  SYMBOL_REF_FLAG (XEXP (DECL_RTL (current_function_decl), 0)) = 1;
+  /* Show that we know this function if it is called again. 
+
+     Don't do this for global functions in object files destined for a
+     shared library because the function may be overridden by the application
+     or other libraries.
+     ??? Is this just ELF?  */
+
+  if (!flag_pic || !TREE_PUBLIC (current_function_decl))
+    SYMBOL_REF_FLAG (XEXP (DECL_RTL (current_function_decl), 0)) = 1;
 }
 #endif /* !OPEN_VMS */
 \f
index aee060d..75b1f1e 100644 (file)
@@ -2030,6 +2030,48 @@ literal_section ()                                               \
 #define ASM_OPEN_PAREN "("
 #define ASM_CLOSE_PAREN ")"
 
+/* Output code to add DELTA to the first argument, and then jump to FUNCTION.
+   Used for C++ multiple inheritance.  */
+
+#define ASM_OUTPUT_MI_THUNK(FILE, THUNK_FNDECL, DELTA, FUNCTION)       \
+do {                                                                   \
+  char *fn_name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (FUNCTION)); \
+                                                                       \
+  fprintf (FILE, "\t.ent ");                                           \
+  assemble_name (FILE, alpha_function_name);                           \
+  fputc ('\n', FILE);                                                  \
+  ASM_OUTPUT_LABEL (FILE, alpha_function_name);                                \
+  fprintf (FILE, "\tldgp $29,0($27)\n");                               \
+  fputc ('$', FILE);                                                   \
+  assemble_name (FILE, alpha_function_name);                           \
+  fprintf (FILE, "..ng:\n");                                           \
+  fprintf (FILE, "\t.frame $30,0,$26,0\n");                            \
+  fprintf (FILE, "\t.prologue 1\n");                                   \
+                                                                       \
+  /* Rely on the assembler to macro expand a large delta.  */          \
+  fprintf (FILE, "\tlda $16,%ld($16)\n", (long)(DELTA));               \
+                                                                       \
+  if (current_file_function_operand (XEXP (DECL_RTL (FUNCTION), 0)))   \
+    {                                                                  \
+      fprintf (FILE, "\tbr $31,$");                                    \
+      assemble_name (FILE, fn_name);                                   \
+      fprintf (FILE, "..ng\n");                                                \
+    }                                                                  \
+  else                                                                 \
+    {                                                                  \
+      fprintf (FILE, "\tlda $27,");                                    \
+      assemble_name (FILE, fn_name);                                   \
+      fprintf (FILE, "\n\tjmp $31,($27),");                            \
+      assemble_name (FILE, fn_name);                                   \
+      fputc ('\n', FILE);                                              \
+    }                                                                  \
+                                                                       \
+  fprintf (FILE, "\t.end ");                                           \
+  assemble_name (FILE, alpha_function_name);                           \
+  fputc ('\n', FILE);                                                  \
+} while (0)
+
+\f
 /* Define results of standard character escape sequences.  */
 #define TARGET_BELL 007
 #define TARGET_BS 010
index 6be8ce7..e0bc334 100644 (file)
@@ -455,6 +455,9 @@ do {                                                                        \
 ( (OUTPUT) = (char *) alloca (strlen ((NAME)) + 12),   \
   sprintf ((OUTPUT), "%s___%d", (NAME), (LABELNO)))
 
+/* ??? VMS uses different linkage.  */
+#undef ASM_OUTPUT_MI_THUNK
+
 #undef ASM_SPEC
 #undef ASM_FINAL_SPEC
 #undef LINK_SPEC
index cf2c7bb..cd21c30 100644 (file)
@@ -129,3 +129,40 @@ Boston, MA 02111-1307, USA.  */
   emit_insn (gen_rtx (UNSPEC_VOLATILE, VOIDmode,                       \
                       gen_rtvec (1, const0_rtx), 0));                  \
 }
+
+/* Output code to add DELTA to the first argument, and then jump to FUNCTION.
+   Used for C++ multiple inheritance.  */
+
+#undef ASM_OUTPUT_MI_THUNK
+#define ASM_OUTPUT_MI_THUNK(FILE, THUNK_FNDECL, DELTA, FUNCTION)       \
+do {                                                                   \
+  char *fn_name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (FUNCTION)); \
+                                                                       \
+  fprintf (FILE, "\t.ent ");                                           \
+  assemble_name (FILE, alpha_function_name);                           \
+  fputc ('\n', FILE);                                                  \
+  ASM_OUTPUT_LABEL (FILE, alpha_function_name);                                \
+  fprintf (FILE, "\t.frame $30,0,$26,0\n");                            \
+  fprintf (FILE, "\t.prologue 1\n");                                   \
+                                                                       \
+  /* Rely on the assembler to macro expand a large delta.  */          \
+  fprintf (FILE, "\tlda $16,%ld($16)\n", (long)(DELTA));               \
+                                                                       \
+  if (current_file_function_operand (XEXP (DECL_RTL (FUNCTION), 0)))   \
+    {                                                                  \
+      fprintf (FILE, "\tbr $31,");                                     \
+      assemble_name (FILE, fn_name);                                   \
+      fputc ('\n', FILE);                                              \
+    }                                                                  \
+  else                                                                 \
+    {                                                                  \
+      fprintf (FILE, "\tjmp $31,");                                    \
+      assemble_name (FILE, fn_name);                                   \
+      fputc ('\n', FILE);                                              \
+    }                                                                  \
+                                                                       \
+  fprintf (FILE, "\t.end ");                                           \
+  assemble_name (FILE, alpha_function_name);                           \
+  fputc ('\n', FILE);                                                  \
+} while (0)
+