patches/gcc/3.4.6/190-all_sh-pr16665-fix.patch
author "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Tue Jan 06 22:22:02 2009 +0000 (2009-01-06)
changeset 1130 78681fe5cdd1
parent 402 197e1b49586e
permissions -rw-r--r--
Update all samples to the latest set of config options.
There might be some small issues here and there due to the split of CT_ExtractAndPatch.

/trunk/samples/x86_64-unknown-linux-gnu/crosstool.config | 14 11 3 0 ++++++++++---
/trunk/samples/sh4-unknown-linux-gnu/crosstool.config | 13 10 3 0 +++++++++---
/trunk/samples/armeb-unknown-linux-uclibc/crosstool.config | 10 7 3 0 ++++++---
/trunk/samples/arm-unknown-elf/crosstool.config | 8 4 4 0 +++---
/trunk/samples/arm-unknown-linux-gnueabi/crosstool.config | 14 11 3 0 ++++++++++---
/trunk/samples/armeb-unknown-eabi/crosstool.config | 8 4 4 0 +++---
/trunk/samples/ia64-unknown-linux-gnu/crosstool.config | 13 10 3 0 +++++++++---
/trunk/samples/x86_64-unknown-linux-uclibc/crosstool.config | 11 8 3 0 +++++++---
/trunk/samples/armeb-unknown-linux-gnueabi/crosstool.config | 14 11 3 0 ++++++++++---
/trunk/samples/powerpc-e500v2-linux-gnuspe/crosstool.config | 11 8 3 0 +++++++---
/trunk/samples/i686-nptl-linux-gnu/crosstool.config | 14 11 3 0 ++++++++++---
/trunk/samples/powerpc-unknown-linux-gnu/crosstool.config | 14 11 3 0 ++++++++++---
/trunk/samples/arm-unknown-linux-gnu/crosstool.config | 14 11 3 0 ++++++++++---
/trunk/samples/mips-unknown-linux-uclibc/crosstool.config | 10 7 3 0 ++++++---
/trunk/samples/arm-unknown-linux-uclibcgnueabi/crosstool.config | 11 8 3 0 +++++++---
/trunk/samples/arm-iphone-linux-gnueabi/crosstool.config | 5 2 3 0 ++---
/trunk/samples/armeb-unknown-linux-gnu/crosstool.config | 14 11 3 0 ++++++++++---
/trunk/samples/powerpc-unknown_nofpu-linux-gnu/crosstool.config | 14 11 3 0 ++++++++++---
/trunk/samples/powerpc-unknown-linux-uclibc/crosstool.config | 10 7 3 0 ++++++---
/trunk/samples/arm-unknown-linux-uclibc/crosstool.config | 11 8 3 0 +++++++---
/trunk/samples/i586-geode-linux-uclibc/crosstool.config | 11 8 3 0 +++++++---
/trunk/samples/powerpc-405-linux-gnu/crosstool.config | 14 11 3 0 ++++++++++---
/trunk/samples/mips-unknown-elf/crosstool.config | 8 4 4 0 +++---
/trunk/samples/armeb-unknown-linux-uclibcgnueabi/crosstool.config | 11 8 3 0 +++++++---
/trunk/samples/mipsel-unknown-linux-gnu/crosstool.config | 13 10 3 0 +++++++++---
/trunk/samples/arm-unknown-eabi/crosstool.config | 8 4 4 0 +++---
/trunk/samples/alphaev56-unknown-linux-gnu/crosstool.config | 14 11 3 0 ++++++++++---
/trunk/samples/powerpc-860-linux-gnu/crosstool.config | 13 10 3 0 +++++++++---
28 files changed, 237 insertions(+), 88 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;