Commit 63d77adf by Richard Kenner

Make both assembler syntaxes do the same for PIC calls.

From-SVN: r10410
parent c57eee67
...@@ -5827,23 +5827,22 @@ ...@@ -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 ;; PIC calls are handled by loading the address of the function into a
;; register (via movsi), then emitting a register indirect call using ;; register (via movsi), then emitting a register indirect call using
;; the "jsr" function call syntax. ;; the "jsr" function call syntax.
;; ;;
;; It is important to note that the "jsr" syntax is always used for ;; When outputting MIT syntax (e.g. on Suns), we add a bogus extra
;; PIC calls, even on machines in which GCC normally uses the "jbsr" ;; operand to the jbsr statement to indicate that this call should
;; syntax for non-PIC calls. This keeps at least 1 assembler (Sun) ;; go through the PLT (why? because this is the way that Sun does it).
;; from emitting incorrect code for a PIC call.
;; ;;
;; We have different patterns for PIC calls and non-PIC calls. The ;; We have different patterns for PIC calls and non-PIC calls. The
;; different patterns are only used to choose the right syntax ;; different patterns are only used to choose the right syntax.
;; ("jsr" vs "jbsr").
;; ;;
;; On svr4 m68k, PIC stuff is done differently. To be able to support ;; The svr4 m68k assembler recognizes this syntax: `bsr FUNC@PLTPC' and it
;; 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
;; will create the correct relocation entry (R_68K_PLT32) for `FUNC', ;; will create the correct relocation entry (R_68K_PLT32) for `FUNC',
;; that tells the linker editor to create an entry for `FUNC' in PLT ;; that tells the linker editor to create an entry for `FUNC' in PLT
;; section at link time. However, all global objects reference are still ;; section at link time. However, all global objects reference are still
...@@ -5875,12 +5874,7 @@ ...@@ -5875,12 +5874,7 @@
" "
{ {
if (flag_pic && GET_CODE (XEXP (operands[0], 0)) == SYMBOL_REF) if (flag_pic && GET_CODE (XEXP (operands[0], 0)) == SYMBOL_REF)
#ifdef MOTOROLA
SYMBOL_REF_FLAG (XEXP (operands[0], 0)) = 1; 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. ;; This is a normal call sequence.
...@@ -5911,9 +5905,9 @@ ...@@ -5911,9 +5905,9 @@
"flag_pic" "flag_pic"
"* "*
#ifdef MOTOROLA
if (GET_CODE (operands[0]) == MEM if (GET_CODE (operands[0]) == MEM
&& GET_CODE (XEXP (operands[0], 0)) == SYMBOL_REF) && GET_CODE (XEXP (operands[0], 0)) == SYMBOL_REF)
#ifdef MOTOROLA
#ifdef HPUX_ASM #ifdef HPUX_ASM
return \"bsr.l %0\"; return \"bsr.l %0\";
#else #else
...@@ -5923,6 +5917,10 @@ ...@@ -5923,6 +5917,10 @@
return \"bsr %0@PLTPC\"; return \"bsr %0@PLTPC\";
#endif #endif
#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 #endif
return \"jsr %0\"; return \"jsr %0\";
") ")
...@@ -5939,12 +5937,7 @@ ...@@ -5939,12 +5937,7 @@
" "
{ {
if (flag_pic && GET_CODE (XEXP (operands[1], 0)) == SYMBOL_REF) if (flag_pic && GET_CODE (XEXP (operands[1], 0)) == SYMBOL_REF)
#ifdef MOTOROLA
SYMBOL_REF_FLAG (XEXP (operands[1], 0)) = 1; 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 ;; This is a normal call_value
...@@ -5975,9 +5968,9 @@ ...@@ -5975,9 +5968,9 @@
;; Operand 2 not really used on the m68000. ;; Operand 2 not really used on the m68000.
"flag_pic" "flag_pic"
"* "*
#ifdef MOTOROLA
if (GET_CODE (operands[1]) == MEM if (GET_CODE (operands[1]) == MEM
&& GET_CODE (XEXP (operands[1], 0)) == SYMBOL_REF) && GET_CODE (XEXP (operands[1], 0)) == SYMBOL_REF)
#ifdef MOTOROLA
#ifdef HPUX_ASM #ifdef HPUX_ASM
return \"bsr.l %1\"; return \"bsr.l %1\";
#else #else
...@@ -5987,6 +5980,10 @@ ...@@ -5987,6 +5980,10 @@
return \"bsr %1@PLTPC\"; return \"bsr %1@PLTPC\";
#endif #endif
#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 #endif
return \"jsr %1\"; return \"jsr %1\";
") ")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment