aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Kenner <kenner@gcc.gnu.org>1995-09-28 14:05:08 -0400
committerRichard Kenner <kenner@gcc.gnu.org>1995-09-28 14:05:08 -0400
commit63d77adf435de2c2f21672da6c39927653bf8333 (patch)
treea2d275165a1fce1b60a0cf5d7a3a7d1cb01ccc1b /gcc
parentc57eee671195eb511c607b0b61d0f4b560a0db68 (diff)
downloadgcc-63d77adf435de2c2f21672da6c39927653bf8333.zip
gcc-63d77adf435de2c2f21672da6c39927653bf8333.tar.gz
gcc-63d77adf435de2c2f21672da6c39927653bf8333.tar.bz2
Make both assembler syntaxes do the same for PIC calls.
From-SVN: r10410
Diffstat (limited to 'gcc')
-rw-r--r--gcc/config/m68k/m68k.md41
1 files changed, 19 insertions, 22 deletions
diff --git a/gcc/config/m68k/m68k.md b/gcc/config/m68k/m68k.md
index 4664f20..4c54862 100644
--- a/gcc/config/m68k/m68k.md
+++ b/gcc/config/m68k/m68k.md
@@ -5827,23 +5827,22 @@
}")
+;; 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
@@ -5875,12 +5874,7 @@
"
{
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.
@@ -5911,9 +5905,9 @@
"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
@@ -5923,6 +5917,10 @@
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\";
")
@@ -5939,12 +5937,7 @@
"
{
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
@@ -5975,9 +5968,9 @@
;; 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
@@ -5987,6 +5980,10 @@
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\";
")