arm.h (NEED_PLT_GOT): New macro.
authorPhilip Blundell <pb@nexus.co.uk>
Sat, 8 May 1999 09:40:05 +0000 (09:40 +0000)
committerRichard Earnshaw <rearnsha@gcc.gnu.org>
Sat, 8 May 1999 09:40:05 +0000 (09:40 +0000)
* config/arm/arm.h (NEED_PLT_GOT): New macro.  Set to 0 if not
already defined.
* config/arm/elf.h (NEED_PLT_GOT): Define to flag_pic.
* config/arm/arm.md (call_symbol, call_value_symbol et al.): If
NEED_PLT_GOT is true, add explicit "(PLT)" to generated branches.
* config/arm/arm.c (output_func_epilogue,
output_return_instruction): Likewise for calls to abort.

From-SVN: r26839

gcc/ChangeLog
gcc/config/arm/arm.c
gcc/config/arm/arm.h
gcc/config/arm/arm.md
gcc/config/arm/elf.h

index e5f28311099c068fd0bcf1d28b4e8edcf47a7eb8..fc52fc1b11e5c11c70c3534e0dba245bcd87cf56 100644 (file)
@@ -1,3 +1,14 @@
+Sat May  8 06:23:21 1999  Philip Blundell  <pb@nexus.co.uk>
+
+       Based on patch by Scott Bambrough:
+       * config/arm/arm.h (NEED_PLT_GOT): New macro.  Set to 0 if not
+       already defined.
+       * config/arm/elf.h (NEED_PLT_GOT): Define to flag_pic.
+       * config/arm/arm.md (call_symbol, call_value_symbol et al.): If 
+       NEED_PLT_GOT is true, add explicit "(PLT)" to generated branches.
+       * config/arm/arm.c (output_func_epilogue, 
+       output_return_instruction): Likewise for calls to abort.
+
 Sat May  8 01:57:58 1999  Donn Terry (donn@interix.com)
 
        * calls.c (rtx_for_function_call): Extend function pointer being
index 03891cd0eb114fe6881020ea4aed1b6c26a736a2..e2fe037ad56fbde78913b43dbfbfa72f0898e65a 100644 (file)
@@ -5299,7 +5299,8 @@ output_return_instruction (operand, really_return, reverse)
 
       /* Otherwise, trap an attempted return by aborting. */
       ops[0] = operand;
-      ops[1] = gen_rtx_SYMBOL_REF (Pmode, "abort");
+      ops[1] = gen_rtx_SYMBOL_REF (Pmode, NEED_PLT_GOT ? "abort(PLT)" 
+                                  : "abort");
       assemble_external_libcall (ops[1]);
       output_asm_insn (reverse ? "bl%D0\t%a1" : "bl%d0\t%a1", ops);
       return "";
@@ -5553,7 +5554,8 @@ output_func_epilogue (f, frame_size)
   /* A volatile function should never return.  Call abort.  */
   if (TARGET_ABORT_NORETURN && volatile_func)
     {
-      rtx op = gen_rtx_SYMBOL_REF (Pmode, "abort");
+      rtx op;
+      op = gen_rtx_SYMBOL_REF (Pmode, NEED_PLT_GOT ? "abort(PLT)" : "abort");
       assemble_external_libcall (op);
       output_asm_insn ("bl\t%a0", &op);
       goto epilogue_done;
index b15fe2178b640c45214d7074d7c0746f17c8d316..ad2b865501a2814b4047b4741cbded40e960345e 100644 (file)
@@ -476,6 +476,11 @@ extern int arm_is_6_or_7;
 #define TARGET_MEM_FUNCTIONS 1
 
 #define OVERRIDE_OPTIONS  arm_override_options ()
+
+/* Nonzero if PIC code requires explicit qualifiers to generate
+   PLT and GOT relocs rather than the assembler doing so implicitly.
+   Subtargets can override this if required.  */
+#define NEED_PLT_GOT   0
 \f
 /* Target machine storage Layout.  */
 
index cf132bc0af5ad7d638697af12960017e999b3df6..5696e11c302106d35ac5491a0838141c3c7c9c64 100644 (file)
         (match_operand:SI 1 "general_operand" "g"))
    (clobber (reg:SI 14))]
   "GET_CODE (operands[0]) == SYMBOL_REF"
-  "bl%?\\t%a0"
+  "*
+  {
+    return NEED_PLT_GOT ? \"bl%?\\t%a0(PLT)\" : \"bl%?\\t%a0\";
+  }"
 [(set_attr "type" "call")])
 
 (define_insn "*call_value_symbol"
        (match_operand:SI 2 "general_operand" "g")))
    (clobber (reg:SI 14))]
   "GET_CODE(operands[1]) == SYMBOL_REF"
-  "bl%?\\t%a1"
+  "*
+  {
+    return NEED_PLT_GOT ? \"bl%?\\t%a1(PLT)\" : \"bl%?\\t%a1\";
+  }"
 [(set_attr "type" "call")])
 
 ;; Often the return insn will be the same as loading from memory, so set attr
   }
 
   output_return_instruction (NULL, FALSE, FALSE);
-  return \"b%?\\t%a0\";
+  return NEED_PLT_GOT ? \"b%?\\t%a0(PLT)\" : \"b%?\\t%a0\";
 }"
 [(set_attr "type" "call")
  (set_attr "length" "8")])
   }
 
   output_return_instruction (NULL, FALSE, FALSE);
-  return \"b%?\\t%a1\";
+  return NEED_PLT_GOT ? \"b%?\\t%a1(PLT)\" : \"b%?\\t%a1\";
 }"
 [(set_attr "type" "call")
  (set_attr "length" "8")])
index e6d8eb762309589ae5e40a21dea05a54b939bac4..d2ba8bb1da8db84bcc80499ce484c7262d6404a7 100644 (file)
@@ -335,4 +335,7 @@ do {                                                \
   do { fputs ("\t.weak\t", FILE); assemble_name (FILE, NAME); \
        fputc ('\n', FILE); } while (0)
 
+/* For PIC code we need to explicitly specify (PLT) and (GOT) relocs.  */
+#define NEED_PLT_GOT   flag_pic
+
 #include "arm/aout.h"