patches/gcc/3.4.6/190-all_sh-pr16665-fix.patch
author "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Sat Jan 03 21:11:41 2009 +0000 (2009-01-03)
changeset 1112 c72aecd1a9ef
parent 402 197e1b49586e
permissions -rw-r--r--
Get rid of all stuff related to building a /delivery' traball:
- building a delivery tarball has long been broken (since crostool-Ng is installable)
- get rid of implied do_print_filename, that can be mis-leading now tarballs can not be built

/trunk/scripts/build/kernel/bare-metal.sh | 4 0 4 0 ----
/trunk/scripts/build/kernel/linux.sh | 4 0 4 0 ----
/trunk/scripts/build/tools/000-template.sh | 11 0 11 0 -----------
/trunk/scripts/build/tools/100-libelf.sh | 4 0 4 0 ----
/trunk/scripts/build/tools/200-sstrip.sh | 11 1 10 0 +----------
/trunk/scripts/build/binutils.sh | 4 0 4 0 ----
/trunk/scripts/build/cc/gcc.sh | 5 0 5 0 -----
/trunk/scripts/build/debug/000-template.sh | 11 0 11 0 -----------
/trunk/scripts/build/debug/100-dmalloc.sh | 4 0 4 0 ----
/trunk/scripts/build/debug/400-ltrace.sh | 4 0 4 0 ----
/trunk/scripts/build/debug/300-gdb.sh | 7 0 7 0 -------
/trunk/scripts/build/debug/500-strace.sh | 4 0 4 0 ----
/trunk/scripts/build/debug/200-duma.sh | 4 0 4 0 ----
/trunk/scripts/build/libc/none.sh | 5 0 5 0 -----
/trunk/scripts/build/libc/glibc.sh | 10 0 10 0 ----------
/trunk/scripts/build/libc/uClibc.sh | 6 0 6 0 ------
/trunk/scripts/build/libc/eglibc.sh | 10 0 10 0 ----------
/trunk/scripts/build/gmp.sh | 6 0 6 0 ------
/trunk/scripts/build/mpfr.sh | 6 0 6 0 ------
/trunk/docs/overview.txt | 9 0 9 0 ---------
20 files changed, 1 insertion(+), 128 deletions(-)
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;