This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Fix ppc -m32 -fpic -mlongcall -msecure-plt (PR target/35100)
- From: Jakub Jelinek <jakub at redhat dot com>
- To: David Edelsohn <dje at watson dot ibm dot com>, Alan Modra <amodra at bigpond dot net dot au>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Thu, 31 Jul 2008 09:01:41 -0400
- Subject: [PATCH] Fix ppc -m32 -fpic -mlongcall -msecure-plt (PR target/35100)
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
Hi!
Both the gen_call and gen_call_value expanders use the secure PLT
sequences when doing direct calls, even when the call is a longcall.
Unfortunately that means the call insns never match, as they have
CALL_LONG bit set in the last operand and all the insns assert that
it is not set.
Using a direct call for longcalls is IMHO undesirable, as if the call
is e.g. defined as hidden, but more than 32MB away from the call insn,
the relocation will overflow.
So, this patch just lets rs6000_longcall_ref create the indirect call
operand even if -msecure-plt.
Bootstrap/regtesting on powerpc-linux started, ok for trunk/4.3 if
it succeeds?
2008-07-31 Jakub Jelinek <jakub@redhat.com>
PR target/35100
* config/rs6000/rs6000.md (call, call_value): Don't use the
-msecure-plt sequence for longcalls.
* gcc.target/powerpc/longcall-1.c: New test.
--- gcc/config/rs6000/rs6000.md.jj 2008-06-30 17:35:13.000000000 +0200
+++ gcc/config/rs6000/rs6000.md 2008-07-31 14:36:31.000000000 +0200
@@ -10748,7 +10748,8 @@
if (DEFAULT_ABI == ABI_V4 && TARGET_SECURE_PLT
&& flag_pic
&& GET_CODE (operands[0]) == SYMBOL_REF
- && !SYMBOL_REF_LOCAL_P (operands[0]))
+ && !SYMBOL_REF_LOCAL_P (operands[0])
+ && (INTVAL (operands[2]) & CALL_LONG) == 0)
{
rtx call;
rtvec tmp;
@@ -10819,7 +10820,8 @@
if (DEFAULT_ABI == ABI_V4 && TARGET_SECURE_PLT
&& flag_pic
&& GET_CODE (operands[1]) == SYMBOL_REF
- && !SYMBOL_REF_LOCAL_P (operands[1]))
+ && !SYMBOL_REF_LOCAL_P (operands[1])
+ && (INTVAL (operands[3]) & CALL_LONG) == 0)
{
rtx call;
rtvec tmp;
--- gcc/testsuite/gcc.target/powerpc/longcall-1.c.jj 2008-07-31 14:30:52.000000000 +0200
+++ gcc/testsuite/gcc.target/powerpc/longcall-1.c 2008-07-31 14:33:21.000000000 +0200
@@ -0,0 +1,13 @@
+/* PR target/35100 */
+/* { dg-do compile { target fpic } } */
+/* { dg-options "-fpic" } */
+
+void foo (void) __attribute__((__longcall__));
+int baz (void) __attribute__((__longcall__));
+
+int
+bar (void)
+{
+ foo ();
+ return baz () + 1;
+}
Jakub