patches/gcc/3.4.6/190-all_sh-pr16665-fix.patch
author "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Tue Aug 02 18:28:10 2011 +0200 (2011-08-02)
changeset 2590 b64cfb67944e
parent 402 197e1b49586e
permissions -rw-r--r--
scripts/functions: svn retrieval first tries the mirror for tarballs

The svn download helper looks for the local tarballs dir to see if it
can find a pre-downloaded tarball, and if it does not find it, does
the actual fetch to upstream via svn.

In the process, it does not even try to get a tarball from the local
mirror, which can be useful if the mirror has been pre-populated
manually (or with a previously downloaded tree).

Fake a tarball get with the standard tarball-download helper, but
without specifying any upstream URL, which makes the helper directly
try the LAN mirror.

Of course, if no mirror is specified, no URL wil be available, and
the standard svn retrieval will kick in.

Reported-by: ANDY KENNEDY <ANDY.KENNEDY@adtran.com>
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
yann@402
     1
diff -durN gcc-3.4.6.orig/gcc/config/sh/sh.c gcc-3.4.6/gcc/config/sh/sh.c
yann@402
     2
--- gcc-3.4.6.orig/gcc/config/sh/sh.c	2004-09-03 08:51:30.000000000 +0200
yann@402
     3
+++ gcc-3.4.6/gcc/config/sh/sh.c	2007-08-15 23:01:48.000000000 +0200
yann@402
     4
@@ -9107,6 +9107,15 @@
yann@402
     5
     }
yann@402
     6
   this = FUNCTION_ARG (cum, Pmode, ptr_type_node, 1);
yann@402
     7
 
yann@402
     8
+  /* In PIC case, we set PIC register to compute the target address.  We
yann@402
     9
+     can use a scratch register to save and restore the original value  
yann@402
    10
+     except for SHcompact.  For SHcompact, use stack.  */
yann@402
    11
+  if (flag_pic && TARGET_SHCOMPACT)
yann@402
    12
+    {
yann@402
    13
+      push (PIC_OFFSET_TABLE_REGNUM);
yann@402
    14
+      emit_insn (gen_GOTaddr2picreg ());
yann@402
    15
+    }
yann@402
    16
+
yann@402
    17
   /* For SHcompact, we only have r0 for a scratch register: r1 is the
yann@402
    18
      static chain pointer (even if you can't have nested virtual functions
yann@402
    19
      right now, someone might implement them sometime), and the rest of the
yann@402
    20
@@ -9189,8 +9198,24 @@
yann@402
    21
       assemble_external (function);
yann@402
    22
       TREE_USED (function) = 1;
yann@402
    23
     }
yann@402
    24
+  /* We can use scratch1 to save and restore the original value of
yann@402
    25
+     PIC register except for SHcompact.  */
yann@402
    26
+  if (flag_pic && ! TARGET_SHCOMPACT)
yann@402
    27
+    {
yann@402
    28
+      emit_move_insn (scratch1,
yann@402
    29
+		      gen_rtx_REG (Pmode, PIC_OFFSET_TABLE_REGNUM));
yann@402
    30
+      emit_insn (gen_GOTaddr2picreg ());
yann@402
    31
+    }
yann@402
    32
   funexp = XEXP (DECL_RTL (function), 0);
yann@402
    33
   emit_move_insn (scratch2, funexp);
yann@402
    34
+  if (flag_pic)
yann@402
    35
+    {
yann@402
    36
+      if (! TARGET_SHCOMPACT)
yann@402
    37
+	emit_move_insn (gen_rtx_REG (Pmode, PIC_OFFSET_TABLE_REGNUM),
yann@402
    38
+			scratch1);
yann@402
    39
+      else
yann@402
    40
+	pop (PIC_OFFSET_TABLE_REGNUM);
yann@402
    41
+    }
yann@402
    42
   funexp = gen_rtx_MEM (FUNCTION_MODE, scratch2);
yann@402
    43
   sibcall = emit_call_insn (gen_sibcall (funexp, const0_rtx, NULL_RTX));
yann@402
    44
   SIBLING_CALL_P (sibcall) = 1;