]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR target/14346 ([3.3 only] With -fpic/-fPIC, thunks jump through PLT, not directl...
authorHans-Peter Nilsson <hp@axis.com>
Sun, 29 Feb 2004 21:46:28 +0000 (21:46 +0000)
committerHans-Peter Nilsson <hp@gcc.gnu.org>
Sun, 29 Feb 2004 21:46:28 +0000 (21:46 +0000)
PR target/14346
* config/cris/cris.c (cris_asm_output_mi_thunk): For PIC, prepend
TAB to jumping "add.d" insn.  Avoid PLT indirection by equating a
local symbol and jumping through it.

From-SVN: r78675

gcc/ChangeLog
gcc/config/cris/cris.c

index 2cbc69d61edeb4715298fcfcfa84c12f41fa2cf9..806e5e99c9cfcbeecb3c40b04683540e4d6271ab 100644 (file)
@@ -1,3 +1,10 @@
+2004-02-29  Hans-Peter Nilsson  <hp@axis.com>
+
+       PR target/14346
+       * config/cris/cris.c (cris_asm_output_mi_thunk): For PIC, prepend
+       TAB to jumping "add.d" insn.  Avoid PLT indirection by equating a
+       local symbol and jumping through it.
+
 2004-02-29  Gabriel Dos Reis  <gdr@integrable-solutions.net>
 
        Backport from mainline:
index 9f620ca080b48697b4254421f936bd5804254d18..9973c7b9ed162a7d9ccc71480947b00a387db220 100644 (file)
@@ -1,5 +1,5 @@
 /* Definitions for GCC.  Part of the machine description for CRIS.
-   Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+   Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
    Contributed by Axis Communications.  Written by Hans-Peter Nilsson.
 
 This file is part of GCC.
@@ -2635,10 +2635,24 @@ cris_asm_output_mi_thunk (stream, thunkdecl, delta, vcall_offset, funcdecl)
     {
       const char *name = XSTR (XEXP (DECL_RTL (funcdecl), 0), 0);
 
+      /* We have no other relative (to either PC or GOT) reloc than one
+        that requests a PLT entry.  Since we don't set up the GOT
+        register, the jump absolutely must not be redirected through a
+        PLT entry.  We manage anyway by going through a local symbol.
+        This depends on the assembler to not short-circuit equalities
+        set by the ".set" directive (at least not for PIC relocs) and
+        on the linker to direct R_CRIS_32_PLT_PCREL relocs *directly*
+        to the symbol for local symbols, instead of through a PLT
+        entry.  */
       name = (* targetm.strip_name_encoding) (name);
-      fprintf (stream, "add.d ");
+      fprintf (stream, "\tadd.d ");
       assemble_name (stream, name);
-      fprintf (stream, "%s,$pc\n", CRIS_PLT_PCOFFSET_SUFFIX);
+      fprintf (stream, "..xth%s,$pc\n", CRIS_PLT_PCOFFSET_SUFFIX);
+      fprintf (stream, "\t.set ");
+      assemble_name (stream, name);
+      fprintf (stream, "..xth,");
+      assemble_name (stream, name);
+      fprintf (stream, "\n");
     }
   else
     {