From 63d77adf435de2c2f21672da6c39927653bf8333 Mon Sep 17 00:00:00 2001 From: Richard Kenner Date: Thu, 28 Sep 1995 14:05:08 -0400 Subject: [PATCH] Make both assembler syntaxes do the same for PIC calls. From-SVN: r10410 --- gcc/config/m68k/m68k.md | 41 +++++++++++++++++++---------------------- 1 file changed, 19 insertions(+), 22 deletions(-) diff --git a/gcc/config/m68k/m68k.md b/gcc/config/m68k/m68k.md index 4664f201e5b9..4c54862370c4 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\"; ") -- 2.47.2