}")
+;; For PIC calls, in order to be able to support
+;; dynamic linker LAZY BINDING, all the procedure calls need to go
+;; through the PLT (Procedure Linkage Table) section in PIC mode.
+;;
;; PIC calls are handled by loading the address of the function into a
;; register (via movsi), then emitting a register indirect call using
;; the "jsr" function call syntax.
;;
-;; It is important to note that the "jsr" syntax is always used for
-;; PIC calls, even on machines in which GCC normally uses the "jbsr"
-;; syntax for non-PIC calls. This keeps at least 1 assembler (Sun)
-;; from emitting incorrect code for a PIC call.
+;; When outputting MIT syntax (e.g. on Suns), we add a bogus extra
+;; operand to the jbsr statement to indicate that this call should
+;; go through the PLT (why? because this is the way that Sun does it).
;;
;; We have different patterns for PIC calls and non-PIC calls. The
-;; different patterns are only used to choose the right syntax
-;; ("jsr" vs "jbsr").
+;; different patterns are only used to choose the right syntax.
;;
-;; On svr4 m68k, PIC stuff is done differently. To be able to support
-;; dynamic linker LAZY BINDING, all the procedure calls need to go
-;; through the PLT (Procedure Linkage Table) section in PIC mode. The
-;; svr4 m68k assembler recognizes this syntax: `bsr FUNC@PLTPC' and it
+;; The svr4 m68k assembler recognizes this syntax: `bsr FUNC@PLTPC' and it
;; will create the correct relocation entry (R_68K_PLT32) for `FUNC',
;; that tells the linker editor to create an entry for `FUNC' in PLT
;; section at link time. However, all global objects reference are still
"
{
if (flag_pic && GET_CODE (XEXP (operands[0], 0)) == SYMBOL_REF)
-#ifdef MOTOROLA
SYMBOL_REF_FLAG (XEXP (operands[0], 0)) = 1;
-#else
- operands[0] = gen_rtx (MEM, GET_MODE (operands[0]),
- force_reg (Pmode, XEXP (operands[0], 0)));
-#endif
}")
;; This is a normal call sequence.
"flag_pic"
"*
-#ifdef MOTOROLA
if (GET_CODE (operands[0]) == MEM
&& GET_CODE (XEXP (operands[0], 0)) == SYMBOL_REF)
+#ifdef MOTOROLA
#ifdef HPUX_ASM
return \"bsr.l %0\";
#else
return \"bsr %0@PLTPC\";
#endif
#endif
+#else
+ /* The ',a1' is a dummy argument telling the Sun assembler we want PIC,
+ GAS just plain ignores it. */
+ return \"jbsr %0,a1\";
#endif
return \"jsr %0\";
")
"
{
if (flag_pic && GET_CODE (XEXP (operands[1], 0)) == SYMBOL_REF)
-#ifdef MOTOROLA
SYMBOL_REF_FLAG (XEXP (operands[1], 0)) = 1;
-#else
- operands[1] = gen_rtx (MEM, GET_MODE (operands[1]),
- force_reg (Pmode, XEXP (operands[1], 0)));
-#endif
}")
;; This is a normal call_value
;; Operand 2 not really used on the m68000.
"flag_pic"
"*
-#ifdef MOTOROLA
if (GET_CODE (operands[1]) == MEM
&& GET_CODE (XEXP (operands[1], 0)) == SYMBOL_REF)
+#ifdef MOTOROLA
#ifdef HPUX_ASM
return \"bsr.l %1\";
#else
return \"bsr %1@PLTPC\";
#endif
#endif
+#else
+ /* The ',a1' is a dummy argument telling the Sun assembler we want PIC
+ GAS just plain ignores it. */
+ return \"jbsr %1,a1\";
#endif
return \"jsr %1\";
")