Thread-Local Storage: ARC gcc patch

来源:互联网 发布:通达信 沪深日线数据 编辑:程序博客网 时间:2024/04/28 05:59

以下是我2008年做的、使ARC gcc支持Thread-Local Storage的补丁,供有兴趣的人员参考。

 

--------------------

diff -ruN gcc-4.2.1.orig/ChangeLog.ARC gcc-4.2.1/ChangeLog.ARC

--- gcc-4.2.1.orig/ChangeLog.ARC2008-10-11 00:39:27.000000000 +0800

+++ gcc-4.2.1/ChangeLog.ARC2010-04-02 15:58:41.000000000 +0800

@@ -1,3 +1,12 @@

+2008-09-03 joshua zhan

+* arc/constraints.md

+* arc/arc.md

+* arc/arc.h

+* arc/arc.c

+

+2008-08-30 joshua zhan

+* merge candidate8_fix4

+

 2007-09-17  J"orn Rennecke  <joern.rennecke@arc.com>

 

 * configure.in (FLAGS_FOR_TARGET):

diff -ruN gcc-4.2.1.orig/configure.in gcc-4.2.1/configure.in

--- gcc-4.2.1.orig/configure.in2008-10-11 00:39:27.000000000 +0800

+++ gcc-4.2.1/configure.in2008-12-16 15:17:45.000000000 +0800

@@ -2481,4 +2481,3 @@

 AC_SUBST(htmldir)

 

 AC_OUTPUT(Makefile)

-

diff -ruN gcc-4.2.1.orig/gcc/config/arc/arc.c gcc-4.2.1/gcc/config/arc/arc.c

--- gcc-4.2.1.orig/gcc/config/arc/arc.c2008-11-10 23:01:37.000000000 +0800

+++ gcc-4.2.1/gcc/config/arc/arc.c2010-04-02 16:01:26.000000000 +0800

@@ -101,10 +101,16 @@

 #define MAX_INSNS_SKIPPED 3

 

 /* The values of unspec's first field */

-enum { 

+enum arc_unspec_type { 

   ARC_UNSPEC_PLT = 3, 

   ARC_UNSPEC_GOT, 

-  ARC_UNSPEC_GOTOFF

+  ARC_UNSPEC_GOTOFF,

+  /* joshua zhan 2008/10/21 */

+  ARC_UNSPEC_TLSGD,

+  ARC_UNSPEC_TLSLD,

+  ARC_UNSPEC_TLSLDO,

+  ARC_UNSPEC_TLSIE,

+  ARC_UNSPEC_TLSLE,

 } ;

 

 

@@ -322,6 +328,11 @@

 

 static const char *arc_invalid_within_doloop (rtx);

 

+/* joshua zhan 2008/08/27 */

+static int tls_symbolic_operand (rtx);

+static rtx arc_legitimize_tls_address (rtx x, enum tls_model model);

+static rtx arc_tls_get_addr (void);

+

 /* Implements target hook vector_mode_supported_p.  */

 static bool

 arc_vector_mode_supported_p (enum machine_mode mode)

@@ -426,7 +437,7 @@

 #undef TARGET_FUNCTION_VALUE

 #define TARGET_FUNCTION_VALUE arc_function_value

 

-#ifdef USE_UCLIBC

+#if defined(USE_UCLIBC) || defined(USE_GLIBC)

 #define DEFAULT_NO_SDATA MASK_NO_SDATA_SET

 #else

 #define DEFAULT_NO_SDATA 0

@@ -449,6 +460,12 @@

 #undef TARGET_DELEGITIMIZE_ADDRESS

 #define TARGET_DELEGITIMIZE_ADDRESS arc_delegitimize_address

 

+/* joshua zhan 2008/08/08 */

+#ifdef HAVE_AS_TLS

+#undef TARGET_HAVE_TLS

+#define TARGET_HAVE_TLS true

+#endif

+

 /* Try to keep the (mov:DF _, reg) as early as possible so 

    that the d<add/sub/mul>h-lr insns appear together and can

    use the peephole2 pattern

@@ -548,7 +565,7 @@

      select -mA5 as default. */

   if (!target_found)

     {

-#ifndef USE_UCLIBC

+#if !defined(USE_UCLIBC) && !defined(USE_GLIBC)

       target_flags |= MASK_A5;

       arc_cpu_string = "A5";

       arc_cpu = PROCESSOR_A5;

@@ -3096,7 +3113,7 @@

     case 'B' /* Branch - must not use sda references.  */ :

       if (CONSTANT_P (x))

 {

-          output_addr_const (file, x); 

+          output_addr_const (file, x); 

   return;

 

       break;

@@ -4428,7 +4445,13 @@

 

   /* Must be @GOT or @GOTOFF.  */

   if (XINT (addr, 1) != ARC_UNSPEC_GOT

-      && XINT (addr, 1) != ARC_UNSPEC_GOTOFF)

+      && XINT (addr, 1) != ARC_UNSPEC_GOTOFF

+      /* joshua zhan 2008/10/21 */

+      && XINT (addr, 1) != ARC_UNSPEC_TLSGD

+      && XINT (addr, 1) != ARC_UNSPEC_TLSLD

+      && XINT (addr, 1) != ARC_UNSPEC_TLSLDO

+      && XINT (addr, 1) != ARC_UNSPEC_TLSIE

+      && XINT (addr, 1) != ARC_UNSPEC_TLSLE)

     return 0;

 

   if (GET_CODE (XVECEXP (addr, 0, 0)) != SYMBOL_REF

@@ -4512,7 +4535,12 @@

   rtx addr = orig;

   rtx new = orig;

   rtx base;

-  

+  enum tls_model model = tls_symbolic_operand (addr);

+

+  /* joshua zhan 2008/10/21 */

+  if (model)

+    return arc_legitimize_tls_address (orig, model);

+

   if (oldx == orig)

     oldx = NULL;

 

@@ -4571,6 +4599,10 @@

 {

   rtx op0 = XEXP (addr, 0), op1 = XEXP (addr, 1);

 

+          /* joshua zhan 2008/10/21 */

+          if (tls_symbolic_operand (op0))

+            return arc_legitimize_tls_address (op0, tls_symbolic_operand (op0));;

+

   /* Check first to see if this is a constant offset from a @GOTOFF

      symbol reference.  */

   if ((GET_CODE (op0) == LABEL_REF

@@ -4736,6 +4768,23 @@

  case ARC_UNSPEC_PLT:

    fputs ("@plt", file);

    break;

+ /* joshua zhan 2008/10/21 */

+ case ARC_UNSPEC_TLSGD:

+  fputs ("@tlsgd", file);

+  break;

+ case ARC_UNSPEC_TLSLD:

+  fputs ("@tlsldm", file);

+  break;

+ case ARC_UNSPEC_TLSLDO:

+  fputs ("@dtpoff", file);

+  break;

+ case ARC_UNSPEC_TLSIE:

+  fputs ("@gottpoff", file);

+  break;

+ case ARC_UNSPEC_TLSLE:

+  fputs ("@tpoff", file);

+  break;

+

  default:

   fprintf(stderr, "%d seen/n",XINT (x,1));

    output_operand_lossage ("invalid UNSPEC as operand");

@@ -5022,6 +5071,12 @@

   case ARC_UNSPEC_GOTOFF:

   case ARC_UNSPEC_GOT:

   case UNSPEC_PROF:

+  /* joshua zhan 2008/10/21 */

+  case ARC_UNSPEC_TLSGD:

+  case ARC_UNSPEC_TLSLD:

+  case ARC_UNSPEC_TLSLDO:

+  case ARC_UNSPEC_TLSIE:

+  case ARC_UNSPEC_TLSLE:

     return true;

 

   default:

@@ -7619,3 +7674,139 @@

 {

   return gen_rtx_REG (SImode, TARGET_BIG_ENDIAN ? 58: 59);

 }

+

+/* joshua zhan 2008/08/08 */

+

+/* Return the TLS type for TLS symbols, 0 for otherwise. */

+int

+tls_symbolic_operand (rtx op)

+{

+  if (GET_CODE (op) == SYMBOL_REF)

+    return SYMBOL_REF_TLS_MODEL (op);

+  else

+    return 0;

+}

+

+/* arc_call_tls_get_addr() borrowed from mips.c, joshua zhan 2008/10/25 */

+

+/* Emit a call to __tls_get_addr.  SYM is the TLS symbol we are

+   referencing, and TYPE is the symbol type to use (either global

+   dynamic or local dynamic).  V0 is an RTX for the return value

+   location.  The entire insn sequence is returned.  */

+

+static /*GTY(())*/ rtx arc_tls_symbol;

+

+static rtx

+arc_call_tls_get_addr (rtx loc, enum arc_unspec_type unspec, rtx v0)

+{

+  rtx insn, tga, a0;

+

+  a0 = gen_rtx_REG (Pmode, REG_R0);

+

+  if (!arc_tls_symbol)

+    arc_tls_symbol = init_one_libfunc ("__tls_get_addr");

+

+  start_sequence ();

+

+  tga = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, loc), unspec);

+  tga = gen_rtx_CONST (Pmode, tga);

+  tga = gen_rtx_PLUS (Pmode, pic_offset_table_rtx, tga);

+  emit_move_insn (a0, tga);

+  tga = gen_rtx_MEM (Pmode, arc_tls_symbol);

+  insn = emit_call_insn (gen_call_value (v0, tga, const0_rtx));

+  CONST_OR_PURE_CALL_P (insn) = 1;

+  use_reg (&CALL_INSN_FUNCTION_USAGE (insn), v0);

+  use_reg (&CALL_INSN_FUNCTION_USAGE (insn), a0);

+  insn = get_insns ();

+

+  end_sequence ();

+

+  return insn;

+}

+

+static /*GTY(())*/ rtx arc_load_tp;

+

+static rtx

+arc_call_tls_ie (rtx loc, rtx v0)

+{

+  rtx insn, tga, tmp1;

+

+  if (!arc_load_tp)

+    arc_load_tp = init_one_libfunc ("arc_load_tp");

+

+  start_sequence ();

+

+  /* bl load_tp */

+  tga = gen_rtx_MEM (Pmode, arc_load_tp);

+  insn = emit_call_insn (gen_call_value (v0, tga, const0_rtx));

+  use_reg (&CALL_INSN_FUNCTION_USAGE (insn), v0);

+

+  insn = get_insns ();

+

+  end_sequence ();

+

+  return insn;

+}

+

+static rtx

+arc_legitimize_tls_address (rtx loc, enum tls_model model)

+{

+  rtx dest, tga, insn, v0, eqv, addend;

+

+  v0 = gen_rtx_REG (Pmode, REG_R0);

+

+  /* joshua zhan 2008/10/21 */

+  switch (model)

+    {

+    case TLS_MODEL_GLOBAL_DYNAMIC:

+      current_function_uses_pic_offset_table = 1;

+      insn = arc_call_tls_get_addr (loc, ARC_UNSPEC_TLSGD, v0);

+      dest = gen_reg_rtx (Pmode);

+      emit_libcall_block (insn, dest, v0, loc);

+      break;

+

+    case TLS_MODEL_LOCAL_DYNAMIC:

+      current_function_uses_pic_offset_table = 1;

+      insn = arc_call_tls_get_addr (loc, ARC_UNSPEC_TLSLD, v0);

+      /* Attach a unique REG_EQUIV, to allow the RTL optimizers to

+ share the LDM result with other LD model accesses.  */

+      eqv = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, const1_rtx), ARC_UNSPEC_TLSLD);

+      dest = gen_reg_rtx (Pmode);

+      emit_libcall_block (insn, dest, v0, eqv);

+

+      /* Load the addend.  */

+      addend = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, loc), ARC_UNSPEC_TLSLDO);

+      addend = force_reg (SImode, gen_rtx_CONST (SImode, addend));

+      emit_move_insn (dest, gen_rtx_PLUS (Pmode, dest, addend));

+      break;

+

+    case TLS_MODEL_INITIAL_EXEC:

+      current_function_uses_pic_offset_table = 1;

+      /* add r#, gp, @x@gottpoff */

+      tga = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, loc), ARC_UNSPEC_TLSIE);

+      tga = gen_rtx_CONST (Pmode, tga);

+      tga = gen_rtx_PLUS (Pmode, pic_offset_table_rtx, tga);

+      dest = gen_reg_rtx (Pmode);

+      emit_move_insn (dest, tga);

+

+      /* ld r#, [r#] */

+      emit_move_insn (dest, gen_rtx_MEM (Pmode, dest));

+

+      /* add r#, r25, r# */

+      emit_move_insn (dest, gen_rtx_PLUS (Pmode, gen_rtx_REG (Pmode, REG_TP), dest));

+      break;

+

+    case TLS_MODEL_LOCAL_EXEC:

+      dest = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, loc), ARC_UNSPEC_TLSLE);

+      dest = gen_rtx_CONST (Pmode, dest);

+      tga = gen_reg_rtx (Pmode);

+      emit_move_insn (tga, gen_rtx_PLUS (Pmode, gen_rtx_REG (Pmode, REG_TP), dest));

+      dest = tga;

+      break;

+

+    default:

+      gcc_unreachable();

+    }

+

+  return dest;

+}

diff -ruN gcc-4.2.1.orig/gcc/config/arc/arc.h gcc-4.2.1/gcc/config/arc/arc.h

--- gcc-4.2.1.orig/gcc/config/arc/arc.h2008-10-11 00:38:00.000000000 +0800

+++ gcc-4.2.1/gcc/config/arc/arc.h2010-04-02 16:01:49.000000000 +0800

@@ -75,8 +75,10 @@

 /* Print subsidiary information on the compiler version in use.  */

 #ifndef USE_UCLIBC

 #define TARGET_VERSION fprintf (stderr, " (arc)")

-#else

+#elif defined(USE_UCLIBC)

 #define TARGET_VERSION fprintf (stderr, " (ARC GNU Linux / uClibc with ELF)")

+#elif defined(USE_GLIBC)

+#define TARGET_VERSION fprintf (stderr, " (ARC GNU Linux / glibc with ELF)")

 #endif

 

 

@@ -101,14 +103,14 @@

 } while(0)

 

 /* Additional flags for the preprocessor.  */

-#ifndef USE_UCLIBC

+#if !defined(USE_UCLIBC) && !defined(USE_GLIBC)

 #define CPP_SPEC "/

 %{mA4:-D__A4__} %{mA5:-D__A5__} %{mA6:-D__A6__ -D__ARC600__} %{mA7:-D__A7__ -D__ARC700__} /

 %{mARC600:-D__A6__ -D__ARC600__} %{mARC700:-D__A7__ -D__ARC700__} /

 %{mmixed-code|!mA4:%{!mA5:%{!mA6:%{!mARC600:%{!mA7:%{!mARC700:-D__A5__}}}}}} /

 "

 

-#else

+#elif defined(USE_UCLIBC)

 #define TARGET_CPU_arc700 2

 

 #define CPP_SPEC "/

@@ -117,6 +119,15 @@

 %{!mA4:%{!mA5:%{!mA6:%{!mARC600:%{!mA7:%{!mARC700:%{!mmixed-code:-D__A5__}}}}}}} /

 %{mmixed-code:%{!mA5:%{!mA6:%{!mARC600:%{!mA7:%{!mARC700:-D__A5__}}}}}} /

 "

+#elif defined(USE_GLIBC)

+#define TARGET_CPU_arc700 2

+

+#define CPP_SPEC "/

+%{mA7:-D__A7__ -D__ARC700__ -D__linux__} /

+%{mARC700:-D__A7__ -D__ARC700__ -D__linux__} /

+%{!mA4:%{!mA5:%{!mA6:%{!mARC600:%{!mA7:%{!mARC700:%{!mmixed-code:-D__A5__}}}}}}} /

+%{mmixed-code:%{!mA5:%{!mA6:%{!mARC600:%{!mA7:%{!mARC700:-D__A5__}}}}}} /

+"

 

 #endif 

 

@@ -127,7 +138,7 @@

 %{EB:%{EL:%emay not use both -EB and -EL}} /

 %{EB:-mbig-endian} %{EL:-mlittle-endian} /

 "

-#ifndef USE_UCLIBC

+#if !defined(USE_UCLIBC) && !defined(USE_GLIBC)

 

 #define ASM_SPEC  "/

 %{v} %{mbig-endian|EB:-EB} %{EL} %{mA4} %{mA5} %{mA6} %{mARC600} /

@@ -152,61 +163,64 @@

 #endif

 

 #ifdef USE_UCLIBC

-#if 1

-/* Note that the default is to link against dynamic libraries, if they are

+#if 0

+/* Note that the default is to link against dynamic libraries, if they

    available.  While it is a bit simpler to get started with static linking,

    it is much easier to comply with the LGPL when you use dynamic linking, and

    thus get a product that you can legally ship.  */

-#define STATIC_LINK_SPEC "%{static:-Bstatic}"

+#define LINK_SPEC "%{h*} %{version:-v} /

+                   %{b} %{Wl,*:%*}     /

+                   %{static:-Bstatic}  /

+                   %{symbolic:-Bsymbolic} /

+                   %{rdynamic:-export-dynamic}/

+                   %{!dynamic-linker:-dynamic-linker /lib/ld-uClibc.so.0}/

+                   -X %{mbig-endian:-EB} /

+                   %{EB} %{EL} /

+   %{pg|p|profile:-marclinux_prof;: -marclinux}"

 #else /* Make ease of use of producing something the main concern.  */

-#define STATIC_LINK_SPEC "%{!mdynamic:%{!shared:-Bstatic}}"

-#endif

 #define LINK_SPEC "%{h*} %{version:-v} /

                    %{b} %{Wl,*:%*}     /

-   "STATIC_LINK_SPEC" /

+                   %{!mdynamic:%{!shared:-Bstatic}}  /

                    %{symbolic:-Bsymbolic} /

                    %{rdynamic:-export-dynamic}/

                    %{!dynamic-linker:-dynamic-linker /lib/ld-uClibc.so.0}/

                    -X %{mbig-endian:-EB} /

                    %{EB} %{EL} /

-                   %{shared:-shared}/

    %{pg|p|profile:-marclinux_prof;: -marclinux}"

-/* Like the standard LINK_COMMAND_SPEC, but add -lgcc_s when building

-   a shared library with -nostdlib, so that the hidden functions of libgcc

-   will be incorporated.  */

-#define LINK_COMMAND_SPEC "/

-%{!fsyntax-only:%{!c:%{!M:%{!MM:%{!E:%{!S:/

-    %(linker) %l " LINK_PIE_SPEC "%X %{o*} %{A} %{d} %{e*} %{m} %{N} %{n} %{r}/

-    %{s} %{t} %{u*} %{x} %{z} %{Z} %{!A:%{!nostdlib:%{!nostartfiles:%S}}}/

-    %{static:} %{L*} %(mfwrap) %(link_libgcc) %o/

-    %{fopenmp:%:include(libgomp.spec)%(link_gomp)} %(mflib)/

-    %{fprofile-arcs|fprofile-generate|coverage:-lgcov}/

-    %{!nostdlib:%{!nodefaultlibs:%(link_ssp) %(link_gcc_c_sequence)}}/

-    %{shared:%{nostdlib:%{!really-nostdlib: -lgcc_s }}} /

-    %{!A:%{!nostdlib:%{!nostartfiles:%E}}} %{T*} }}}}}}"

-

+#endif

+#elif defined(USE_GLIBC)

+#define LINK_SPEC "%{h*} %{version:-v} /

+                   %{b} %{Wl,*:%*}     /

+                   %{symbolic:-Bsymbolic} /

+                   %{shared:-shared} /

+                   %{static:-static} /

+                   %{rdynamic:-export-dynamic}/

+                   %{!dynamic-linker:-dynamic-linker /lib/ld.so.1}/

+                   -X %{mbig-endian:-EB} /

+                   %{EB} %{EL} /

+   %{pg|p|profile:-marclinux_prof;: -marclinux}"

 #else

 #define LINK_SPEC "%{v} %{mbig-endian:-EB} %{EB} %{EL}/

   %{pg|p:-marcelf_prof;mA7|mARC700: -marcelf}"

 #endif

 

-#ifndef USE_UCLIBC

+#if !defined(USE_UCLIBC) && !defined(USE_GLIBC)

 #define STARTFILE_SPEC "%{!shared:crt0.o%s} crti%O%s %{pg|p:crtg.o%s} crtbegin.o%s"

-#else

+#elif defined(USE_UCLIBC) || defined(USE_GLIBC)

 #define STARTFILE_SPEC   "%{!shared:%{!mkernel:crt1.o%s}} crti.o%s /

   %{!shared:%{pg|p|profile:crtg.o%s} crtbegin.o%s} %{shared:crtbeginS.o%s}"

 

 #endif

 

-#ifndef USE_UCLIBC

+#if !defined(USE_UCLIBC) && !defined(USE_GLIBC)

 #define ENDFILE_SPEC "%{pg|p:crtgend.o%s} crtend.o%s crtn%O%s"

-#else

+#elif defined(USE_UCLIBC) || defined(USE_GLIBC)

 #define ENDFILE_SPEC "%{!shared:%{pg|p|profile:crtgend.o%s} crtend.o%s} /

   %{shared:crtendS.o%s} crtn.o%s"

 

 #endif 

 

-#ifdef USE_UCLIBC

+#if defined(USE_UCLIBC) || defined(USE_GLIBC)

 #undef LIB_SPEC

 #define LIB_SPEC  /

   "%{pthread:-lpthread} /

@@ -219,7 +233,7 @@

 #endif

 

 

-#ifdef USE_UCLIBC

+#if defined(USE_UCLIBC) || defined(USE_GLIBC)

 #define DRIVER_SELF_SPECS "%{!mA*:-mA7}"

 #endif

 

@@ -282,7 +296,7 @@

 #define ARC_EXTENSION_CPU(cpu) 0

 

 #ifndef MULTILIB_DEFAULTS

-#ifndef USE_UCLIBC

+#if !defined(USE_UCLIBC) && !defined(USE_GLIBC)

 #define MULTILIB_DEFAULTS { "mA5", "EL" }

 #else

 #define MULTILIB_DEFAULTS { "mARC700", "EL" }

@@ -525,11 +539,14 @@

 /*    reference : init_reg_sets() in regclass.c:290 */

 /* Present implementations only have VR0-VR23 only */

 /* ??? FIXME: r27 and r31 should not be fixed registers.  */

+

+/* 0 --> 1 for r25, joshua zhan 2008/11/17 */

+

 #define FIXED_REGISTERS /

 { 0, 0, 0, 0, 0, 0, 0, 0,/

   0, 0, 0, 0, 0, 0, 0, 0,/

   0, 0, 0, 0, 0, 0, 0, 0,/

-  0, 0, 1, 1, 1, 1, 1, 1,/

+  0, 1, 1, 1, 1, 1, 1, 1,/

 /

   1, 1, 1, 1, 1, 1, 1, 1,/

   0, 0, 0, 0, 1, 1, 1, 1,/

@@ -560,12 +577,14 @@

 /* Size of this and value of FIRST_PSEUDO_REGISTER should be equal, *// */

 /* hence the added another '1' at the end */

 /*    reference : init_reg_sets() in regclass.c:290 */

+

+/* 0 --> 1 for r25, joshua zhan 2008/11/17 */

 #define CALL_USED_REGISTERS     /

 {                               /

   1, 1, 1, 1, 1, 1, 1, 1,/

   1, 1, 1, 1, 1, 0, 0, 0,/

   0, 0, 0, 0, 0, 0, 0, 0,/

-  0, 0, 1, 1, 1, 1, 1, 1,/

+  0, 1, 1, 1, 1, 1, 1, 1,/

 /

   1, 1, 1, 1, 1, 1, 1, 1,/

   1, 1, 1, 1, 1, 1, 1, 1,/

@@ -593,6 +612,7 @@

 /* If defined, an initializer for a vector of integers, containing the

    numbers of hard registers in the order in which GNU CC should

    prefer to use them (from most preferred to least).  */

+

 #define REG_ALLOC_ORDER /

 { 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 0, 1,/

   16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, /

@@ -669,6 +689,7 @@

    NO_REGS, 

    R0_REG,/* 'x' */

    GP_REG,/* 'Rgp' */

+   TP_REG,/* 't' joshua zhan 2008/09/03 */

    FP_REG,/* 'f' */

    SP_REG,/* 'b' */

    LPCOUNT_REG, /* 'l' */

@@ -695,6 +716,7 @@

   "NO_REGS",            /

   "R0_REG",              /

   "GP_REG",              /

+  "TP_REG",              /

   "FP_REG",              /

   "SP_REG",  /

   "LPCOUNT_REG",  /

@@ -721,6 +743,7 @@

   {0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000},     /* No Registers *//

   {0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000},      /* 'x', r0 register , r0 *//

   {0x04000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000},      /* 'Rgp', Global Pointer, r26 *//

+  {0x02000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000},      /* 't', Thread Pointer, r25 , joshua zhan 2008/09/03*//

   {0x08000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000},      /* 'f', Frame Pointer, r27 *//

   {0x10000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000},      /* 'b', Stack Pointer, r28 *//

   {0x00000000, 0x10000000, 0x00000000, 0x00000000, 0x00000000},      /* 'l', LPCOUNT Register, r60 *//

@@ -1669,6 +1692,7 @@

 extern char rname56[], rname57[], rname58[], rname59[];

 /* How to refer to registers in assembler output.

    This sequence is indexed by compiler's hard-register-number (see above).  */

+/* TODO: change r25 to tp, joshua zhan 2008/12/03 */

 #define REGISTER_NAMES/

 {  "r0",   "r1",   "r2",   "r3",       "r4",     "r5",     "r6",    "r7",/

    "r8",   "r9",  "r10",  "r11",      "r12",    "r13",    "r14",   "r15",/

@@ -1816,7 +1840,6 @@

    information, but it does not yet work with exception handling. */

 #define DWARF2_UNWIND_INFO 0

 

-

 /* Turn off splitting of long stabs.  */

 #define DBX_CONTIN_LENGTH 0

 

diff -ruN gcc-4.2.1.orig/gcc/config/arc/arc.md gcc-4.2.1/gcc/config/arc/arc.md

--- gcc-4.2.1.orig/gcc/config/arc/arc.md2008-12-11 04:54:43.000000000 +0800

+++ gcc-4.2.1/gcc/config/arc/arc.md2010-04-02 16:03:08.000000000 +0800

@@ -115,8 +115,20 @@

 ;;  ----------------------------------------------------------------------------

 

 

-(define_constants

-  [(UNSPEC_NORM 11) ; norm generation through builtins. candidate for scheduling

+(define_constants [

+   ;; see arc.h, do we have to redefine constants here? joshua zhan 2008/09/03

+   (REG_R0 0)

+   (REG_R1 1)

+   (REG_R2 2)

+   (REG_R3 3)

+   (REG_R4 4)

+   (REG_R5 5)

+   (REG_R6 6)

+   (REG_R7 7)

+   (REG_TP 25)

+   (REG_GP 26)

+

+   (UNSPEC_NORM 11) ; norm generation through builtins. candidate for scheduling

    (UNSPEC_NORMW 12) ; normw generation through builtins. candidate for scheduling

    (UNSPEC_SWAP 13) ; swap generation through builtins. candidate for scheduling

    (UNSPEC_MUL64 14) ; mul64 generation through builtins. candidate for scheduling

@@ -139,6 +151,16 @@

    (VUNSPEC_UNIMP_S 28) ; blockage insn for unimp_s generation

    (VUNSPEC_EPILOGUE 29)

    (ARC_UNSPEC_PROLOGUE_USE 30)

+

+  ; TLS support, joshua zhan

+   (UNSPEC_TLSGD 31)

+   (UNSPEC_TLSLDM 32)

+   (UNSPEC_TLSIE 33)

+   (UNSPEC_TLSLE 34)

+   (UNSPEC_DTPOFF 35)

+   (UNSPEC_GOTTPOFF 36)

+   (UNSPEC_TPOFF 37)

+

    (LP_COUNT 60)

    (LP_START 144)

    (LP_END 145)

diff -ruN gcc-4.2.1.orig/gcc/config/arc/constraints.md gcc-4.2.1/gcc/config/arc/constraints.md

--- gcc-4.2.1.orig/gcc/config/arc/constraints.md2008-10-11 00:38:00.000000000 +0800

+++ gcc-4.2.1/gcc/config/arc/constraints.md2010-04-02 16:03:31.000000000 +0800

@@ -255,3 +255,7 @@

    Integer constant zero"

   (and (match_code "const_int")

        (match_test "IS_ZERO (ival)")))

+

+; joshua zhan 2008/09/03

+(define_register_constraint "t" "TP_REG"

+  "@code{r25} register.") 

diff -ruN gcc-4.2.1.orig/gcc/config/arc/gmon/gmon.c gcc-4.2.1/gcc/config/arc/gmon/gmon.c

--- gcc-4.2.1.orig/gcc/config/arc/gmon/gmon.c2008-10-11 00:38:00.000000000 +0800

+++ gcc-4.2.1/gcc/config/arc/gmon/gmon.c2010-04-02 16:04:00.000000000 +0800

@@ -56,6 +56,22 @@

 #define weak_alias(fun,aliasid) extern __typeof(fun) aliasid __attribute__ ((weak, alias (#fun)));

 #define __libc_enable_secure 0

 

+/* gcc full build error, joshua zhan 2008/10/18 */

+#define GMON_TEMP

+#if defined(GMON_TEMP)

+#include <sys/gmon.h>

+#include <sys/gmon_out.h>

+#if !defined(attribute_hidden) && defined HAVE_VISIBILITY_ATTRIBUTE /

+    && (defined SHARED || defined LIBC_NONSHARED)

+# define attribute_hidden __attribute__ ((visibility ("hidden")))

+#else

+# define attribute_hidden

+#endif

+#endif

+#include <unistd.h>

+#ifndef STDERR_FILENO

+#defineSTDERR_FILENO2/* Standard error output.  */

+#endif

 /*  Head of basic-block list or NULL. */

 struct __bb *__bb_head attribute_hidden;

 

@@ -198,6 +214,20 @@

 weak_alias (__monstartup, monstartup)

 

 

+/* temp fix, joshua zhan 2008/10/18 */

+#if defined(GMON_TEMP)

+#include <sys/gmon.h>

+struct arc_gmon_hist_hdr

+{

+  char low_pc[4];

+  char high_pc[4];

+  char hist_size[4];

+  char prof_rate[4];

+  char dimen[15];

+  char dimen_abbrev;

+};

+#endif

+

 static void

 internal_function

 write_hist (int fd)

@@ -229,6 +259,15 @@

 }

 

 

+/* temp fix, joshua zhan 2008/10/18 */

+#if defined(GMON_TEMP)

+#include <sys/gmon.h>

+#include <sys/gmon_out.h>

+extern u_long __arc_profile_desc_secstart[], __arc_profile_desc_secend[];

+extern u_long __arc_profile_forward_secstart[], __arc_profile_forward_secend[];

+extern u_long __arc_profile_counters_secstart[];

+#endif

+

 static void

 internal_function

 write_call_graph (int fd)

diff -ruN gcc-4.2.1.orig/gcc/config/arc/gmon/mcount.c gcc-4.2.1/gcc/config/arc/gmon/mcount.c

--- gcc-4.2.1.orig/gcc/config/arc/gmon/mcount.c2008-10-11 00:38:00.000000000 +0800

+++ gcc-4.2.1/gcc/config/arc/gmon/mcount.c2010-04-02 16:04:21.000000000 +0800

@@ -35,6 +35,7 @@

 #include <unistd.h>

 #include <sys/param.h>

 #endif

+

 #include <sys/gmon.h>

 

 /* This file provides the machine-dependent definitions of the _MCOUNT_DECL

@@ -43,6 +44,23 @@

 

 #include <atomic.h>

 

+/* copied from glibc/include/sys/gmon.h

+  joshua zhan 2008/10/20 */

+extern void __write_profiling (void);

+extern void write_profiling (void);

+

+struct __bb;

+extern void __bb_init_func (struct __bb *bb);

+extern void __bb_exit_func (void);

+

+#if defined HAVE_VISIBILITY_ATTRIBUTE /

+    && (defined SHARED || defined LIBC_NONSHARED)

+# define attribute_hidden __attribute__ ((visibility ("hidden")))

+#else

+# define attribute_hidden

+#endif

+extern struct gmonparam _gmonparam attribute_hidden;

+

 /*

  * mcount is called on entry to each function compiled with the profiling

  * switch set.  _mcount(), which is declared in a machine-dependent way

diff -ruN gcc-4.2.1.orig/gcc/config/arc/t-arc700-glibc gcc-4.2.1/gcc/config/arc/t-arc700-glibc

--- gcc-4.2.1.orig/gcc/config/arc/t-arc700-glibc1970-01-01 08:00:00.000000000 +0800

+++ gcc-4.2.1/gcc/config/arc/t-arc700-glibc2009-01-08 10:31:26.000000000 +0800

@@ -0,0 +1,44 @@

+CRTSTUFF_T_CFLAGS += -mno-sdata

+MULTILIB_EXTRA_OPTS = mno-sdata

+

+# Compile crtbeginS.o and crtendS.o with pic.

+CRTSTUFF_T_CFLAGS_S = $(CRTSTUFF_T_CFLAGS) -mA7 -fPIC

+

+# Compile libgcc2.a with pic.

+TARGET_LIBGCC2_CFLAGS = -mA7 -fPIC

+

+PROFILE_OSDEP = $(T)prof-freq.o

+

+# Override t-slibgcc-elf-ver to hide some lib1func

+# routines which should not be called via PLT.

+SHLIB_MAPFILES = /

+$(srcdir)/libgcc-std.ver /

+$(srcdir)/config/arc/libgcc-excl.ver

+

+# Override SHLIB_LINK and SHLIB_INSTALL to use linker script

+# libgcc_s.so.

+# We don't use $(SHLIB_LC) here because we have to build the compiler before

+# we can build the C library.

+SHLIB_LINK = $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) -shared -nodefaultlibs /

+-Wl,--soname=$(SHLIB_SONAME) /

+-Wl,--version-script=$(SHLIB_MAP) /

+-o $(SHLIB_DIR)/$(SHLIB_SONAME).tmp @multilib_flags@ /

+$(SHLIB_OBJS) && /

+rm -f $(SHLIB_DIR)/$(SHLIB_SOLINK) && /

+if [ -f $(SHLIB_DIR)/$(SHLIB_SONAME) ]; then /

+  mv -f $(SHLIB_DIR)/$(SHLIB_SONAME) /

+$(SHLIB_DIR)/$(SHLIB_SONAME).backup; /

+else true; fi && /

+mv $(SHLIB_DIR)/$(SHLIB_SONAME).tmp $(SHLIB_DIR)/$(SHLIB_SONAME) && /

+(echo "/* GNU ld script"; /

+ echo "   Use the shared library, but some functions are only in"; /

+ echo "   the static library.  */"; /

+ echo "GROUP ( $(SHLIB_SONAME) libgcc.a )" /

+) > $(SHLIB_DIR)/$(SHLIB_SOLINK)

+SHLIB_INSTALL = /

+$$(mkinstalldirs) $$(DESTDIR)$$(slibdir)$(SHLIB_SLIBDIR_QUAL); /

+$(INSTALL_DATA) $(SHLIB_DIR)/$(SHLIB_SONAME) /

+  $$(DESTDIR)$$(slibdir)$(SHLIB_SLIBDIR_QUAL)/$(SHLIB_SONAME); /

+rm -f $$(DESTDIR)$$(slibdir)$(SHLIB_SLIBDIR_QUAL)/$(SHLIB_SOLINK); /

+$(INSTALL_DATA) $(SHLIB_DIR)/$(SHLIB_SOLINK) /

+  $$(DESTDIR)$$(slibdir)$(SHLIB_SLIBDIR_QUAL)/$(SHLIB_SOLINK)

diff -ruN gcc-4.2.1.orig/gcc/config/arc/t-arc-glibc gcc-4.2.1/gcc/config/arc/t-arc-glibc

--- gcc-4.2.1.orig/gcc/config/arc/t-arc-glibc1970-01-01 08:00:00.000000000 +0800

+++ gcc-4.2.1/gcc/config/arc/t-arc-glibc2010-04-02 16:11:33.000000000 +0800

@@ -0,0 +1,77 @@

+CROSS_LIBGCC1 = libgcc1-asm.a

+LIB1ASMSRC = arc/lib1funcs.asm

+LIB1ASMFUNCS = _mulsi3 _umulsidi3 _udivsi3 _divsi3 _umodsi3 _modsi3 /

+  _divmod_tools _clzsi2 _millicodethunk /

+  _adddf3 _muldf3 _addsf3 _mulsf3 _divsf3 _divdf3 _truncdfsf2 _extendsfdf2 /

+  _eqdf2 _eqsf2 _gedf2 _gesf2 _gtdf2 _gtsf2 _uneqdf2 _uneqsf2 _ordsf2 _orddf2 /

+  _fixdfsi _fixsfsi _floatsidf _floatsisf _fixunsdfsi _floatunsidf

+

+#LIBGCC2_CFLAGS = -g1 -O2 $(LIBGCC2_INCLUDES) $(GCC_CFLAGS)

+

+# These are really part of libgcc1, but this will cause them to be

+# built correctly, so...

+

+LIB2FUNCS_EXTRA = fp-bit.c dp-bit.c

+

+dp-bit.c: $(srcdir)/config/fp-bit.c

+echo '#ifndef __big_endian__' > dp-bit.c

+echo '#define FLOAT_BIT_ORDER_MISMATCH' >> dp-bit.c

+echo '#endif' >> dp-bit.c

+echo '#include "config/arc/dp-hack.h"' >> dp-bit.c

+cat $(srcdir)/config/fp-bit.c >> dp-bit.c

+

+fp-bit.c: $(srcdir)/config/fp-bit.c

+echo '#define FLOAT' > fp-bit.c

+echo '#ifndef __big_endian__' >> fp-bit.c

+echo '#define FLOAT_BIT_ORDER_MISMATCH' >> fp-bit.c

+echo '#endif' >> fp-bit.c

+echo '#include "config/arc/fp-hack.h"' >> fp-bit.c

+cat $(srcdir)/config/fp-bit.c >> fp-bit.c

+

+# .init/.fini section routines

+

+# we use glibc's crti.o & crtn.o

+# joshua zhan 2008/11/30

+

+$(T)crtg.o: $(srcdir)/config/arc/crtg.asm $(GCC_PASSES)

+$(GCC_FOR_TARGET) $(GCC_CFLAGS) $(MULTILIB_CFLAGS) $(INCLUDES) /

+-c -o $@  -x assembler-with-cpp $<

+

+$(T)crtgend.o: $(srcdir)/config/arc/crtgend.asm $(GCC_PASSES)

+$(GCC_FOR_TARGET) $(GCC_CFLAGS) $(MULTILIB_CFLAGS) $(INCLUDES) /

+-c -o $@  -x assembler-with-cpp $<

+

+$(T)mcount.o: $(srcdir)/config/arc/gmon/mcount.c $(GCC_PASSES)

+$(GCC_FOR_TARGET) -isystem $(srcdir)/config/arc/gmon $(GCC_CFLAGS) /

+$(MULTILIB_CFLAGS) $(INCLUDES) -c -o $@ $< /

+-fcall-saved-r0 -fcall-saved-r1 -fcall-saved-r2 -fcall-saved-r3 /

+-fcall-saved-r4 -fcall-saved-r5 -fcall-saved-r6 -fcall-saved-r7 /

+-fomit-frame-pointer

+

+$(T)gmon.o: $(srcdir)/config/arc/gmon/gmon.c $(GCC_PASSES)

+$(GCC_FOR_TARGET) -isystem $(srcdir)/config/arc/gmon $(GCC_CFLAGS) /

+$(MULTILIB_CFLAGS) -mno-sdata $(INCLUDES) -c -o $@ $< /

+-Wno-extra # suppress inane warning about missing initializer.

+# Adding initializers for the remaining elements of gmonparam would

+# make the code more brittle.

+

+$(T)prof-freq-stub.o: $(srcdir)/config/arc/gmon/prof-freq-stub.S $(GCC_PASSES)

+$(GCC_FOR_TARGET) -isystem $(srcdir)/config/arc/gmon $(GCC_CFLAGS) /

+$(MULTILIB_CFLAGS) $(INCLUDES) -c -o $@ $<

+

+$(T)prof-freq.o: $(srcdir)/config/arc/gmon/prof-freq.c $(GCC_PASSES)

+$(GCC_FOR_TARGET) -isystem $(srcdir)/config/arc/gmon $(GCC_CFLAGS) /

+$(MULTILIB_CFLAGS) $(INCLUDES) -c -o $@ $<

+

+$(T)dcache_linesz.o: $(srcdir)/config/arc/gmon/dcache_linesz.S $(GCC_PASSES)

+$(GCC_FOR_TARGET) -isystem $(srcdir)/config/arc/gmon $(GCC_CFLAGS) /

+$(MULTILIB_CFLAGS) $(INCLUDES) -c -o $@ $<

+

+$(T)profil.o: $(srcdir)/config/arc/gmon/profil.S $(GCC_PASSES)

+$(GCC_FOR_TARGET) -isystem $(srcdir)/config/arc/gmon $(GCC_CFLAGS) /

+$(MULTILIB_CFLAGS) $(INCLUDES) -c -o $@ $<

+

+$(T)libgmon.a: $(T)mcount.o $(T)gmon.o $(T)dcache_linesz.o $(PROFILE_OSDEP)

+$(AR_CREATE_FOR_TARGET) $@ $^

+

+EXTRA_MULTILIB_PARTS = crtend.o crtbegin.o crtendS.o crtbeginS.o libgmon.a crtg.o crtgend.o

diff -ruN gcc-4.2.1.orig/gcc/config.gcc gcc-4.2.1/gcc/config.gcc

--- gcc-4.2.1.orig/gcc/config.gcc2008-10-11 00:37:58.000000000 +0800

+++ gcc-4.2.1/gcc/config.gcc2010-04-02 16:05:42.000000000 +0800

@@ -247,6 +247,10 @@

 am33_2.0-*-linux*)

 cpu_type=mn10300

 ;;

+# joshua zhan 2008/11/25

+arc-*-linux*)

+cpu_type=arc

+;;

 strongarm*-*-*)

 cpu_type=arm

 ;;

@@ -688,11 +692,29 @@

 arc*-*-linux-uclibc*)

 extra_headers="arc-simd.h"

 tm_file="dbxelf.h elfos.h svr4.h linux.h  ${tm_file}"

-tmake_file="${tmake_file} arc/t-arc700-uClibc arc/t-arc"

+tmake_file="arc/t-arc700-uClibc arc/t-arc"

 tm_defines="${tm_defines} USE_UCLIBC"

   extra_parts="crti.o crtn.o crtend.o crtbegin.o crtendS.o crtbeginS.o"

 use_fixproto=yes

         ;;

+# joshua zhan 2008/08/12

+arc-*-linux*)

+extra_headers="arc-simd.h"

+tm_file="dbxelf.h elfos.h svr4.h linux.h  ${tm_file}"

+# gcc bootstrap is different: it doesn't generate libgcc_s.so

+case ${CFLAGS} in

+*-DARC_GCC_BOOTSTRAP*)

+  tmake_file="arc/t-arc-bootstrap arc/t-arc-glibc"

+  ;;

+*)

+  # ${tmake_file}: t-slibgcc-elf-ver t-linux 

+  tmake_file="${tmake_file} arc/t-arc700-glibc arc/t-arc-glibc"

+  ;;

+esac

+tm_defines="${tm_defines} USE_GLIBC"

+extra_parts="crtend.o crtbegin.o crtendS.o crtbeginS.o"

+use_fixproto=yes

+;;

 arm-*-coff* | armel-*-coff*)

 tm_file="arm/semi.h arm/aout.h arm/arm.h arm/coff.h dbxcoff.h"

 tmake_file="arm/t-arm arm/t-arm-coff"

diff -ruN gcc-4.2.1.orig/gcc/configure.ac gcc-4.2.1/gcc/configure.ac

--- gcc-4.2.1.orig/gcc/configure.ac2008-10-11 00:38:06.000000000 +0800

+++ gcc-4.2.1/gcc/configure.ac2010-04-02 16:06:20.000000000 +0800

@@ -791,7 +791,15 @@

 ], [

  TARGET_SYSTEM_ROOT=

  TARGET_SYSTEM_ROOT_DEFINE=

- CROSS_SYSTEM_HEADER_DIR='$(gcc_tooldir)/sys-include'

+# for ARC, dragotnec 2009/01/18

+  case $target in

+  arc-*-linux-gnu*)

+    CROSS_SYSTEM_HEADER_DIR='$(gcc_tooldir)/include'

+    ;;

+  *)

+    CROSS_SYSTEM_HEADER_DIR='$(gcc_tooldir)/sys-include'

+    ;;

+  esac

 ])

 AC_SUBST(TARGET_SYSTEM_ROOT)

 AC_SUBST(TARGET_SYSTEM_ROOT_DEFINE)

@@ -2144,7 +2152,6 @@

   [Define if your assembler and linker support .hidden.])

 fi

 

-

 # Check if we have .[us]leb128, and support symbol arithmetic with it.

 gcc_GAS_CHECK_FEATURE([.sleb128 and .uleb128], gcc_cv_as_leb128,

   [elf,2,11,0],,

@@ -2228,7 +2235,7 @@

   # Therefore, use diff -b for the comparisons.

   if test x$gcc_cv_objdump != x /

   && $gcc_cv_objdump -s -j .eh_frame conftest.o 2>/dev/null /

-     | tail -3 > conftest.got /

+     | tail -n 3 > conftest.got /

   && { diff -b conftest.lit conftest.got > /dev/null 2>&1 /

     || diff -b conftest.big conftest.got > /dev/null 2>&1; }

   then

@@ -2359,6 +2366,30 @@

 tls_first_minor=15

 tls_as_opt=--fatal-warnings

 ;;

+  # FIXME: tried to use arc-linux-gnu-*, but it didn't work for me, 

+  # joshua zhan 2008/08/08

+  arc*-*-*)

+    conftest_s='

+.section ".tdata","awT",%progbits

+foo:    .word 25

+        .text

+add gp, pcl, @_DYNAMIC@gotpc

+; global dynamic

+add r0,gp,@x@tlsgd

+bl __tls_get_addr@plt

+; local dynamic

+add r0,gp,@x1@tlsldm

+bl __tls_get_addr@plt

+add r0,r0,@x1@dtpoff

+; initial exec

+add r2,gp,@x@gottpoff

+; local exec

+; FIMXE: load tp to r25

+add r0,r25,@x@tpoff'

+        tls_first_major=2

+        tls_first_minor=17

+        tls_as_opt="--fatal-warnings -mA7"

+;;

   arm*-*-*)

     conftest_s='

 .section ".tdata","awT",%progbits

diff -ruN gcc-4.2.1.orig/gcc/final.c gcc-4.2.1/gcc/final.c

--- gcc-4.2.1.orig/gcc/final.c2008-10-11 00:38:20.000000000 +0800

+++ gcc-4.2.1/gcc/final.c2010-04-02 16:06:46.000000000 +0800

@@ -3209,6 +3209,31 @@

 #else

       assemble_name (file, XSTR (x, 0));

 #endif

+

+/* for debugging, joshua zhan 2008/10/26 */

+#if DUMP_VAR_TLS 

+      {

+        enum tls_model model = SYMBOL_REF_TLS_MODEL (x);

+        switch (model) 

+        {

+        case TLS_MODEL_GLOBAL_DYNAMIC:

+          printf("TLS VAR: %s@tlsgd/n", XSTR(x, 0));

+          break;

+        case TLS_MODEL_LOCAL_DYNAMIC:

+          printf("TLS VAR: %s@tlsldm/n", XSTR(x, 0));

+          break;

+        case TLS_MODEL_INITIAL_EXEC:

+          printf("TLS VAR: %s@tlsie/n", XSTR(x, 0));

+          break;

+        case TLS_MODEL_LOCAL_EXEC:

+          printf("TLS VAR: %s@tlsle/n", XSTR(x, 0));

+          break;

+        default:

+          break;

+}

+      }

+#endif

+

       break;

 

     case LABEL_REF:

diff -ruN gcc-4.2.1.orig/libstdc++-v3/configure gcc-4.2.1/libstdc++-v3/configure

--- gcc-4.2.1.orig/libstdc++-v3/configure2008-10-11 00:37:28.000000000 +0800

+++ gcc-4.2.1/libstdc++-v3/configure2008-12-20 14:20:18.000000000 +0800

@@ -3961,9 +3961,9 @@

   p=${PACKAGE-default}

 case $enableval in

 yes) enable_shared=yes ;;

-no) enable_shared=no ;;

+no) enable_shared=yes ;;

 *)

-  enable_shared=no

+  enable_shared=yes

   # Look at the argument we got.  We use all the common list separators.

   IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"

   for pkg in $enableval; do

@@ -3983,9 +3983,9 @@

   p=${PACKAGE-default}

 case $enableval in

 yes) enable_static=yes ;;

-no) enable_static=no ;;

+no) enable_static=yes ;;

 *)

-  enable_static=no

+  enable_static=yes

   # Look at the argument we got.  We use all the common list separators.

   IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"

   for pkg in $enableval; do

@@ -110252,9 +110252,6 @@

   WARN_FLAGS='-Wall -Wextra -Wwrite-strings -Wcast-qual'

 

 

-echo "irf-mark 1"

-echo "enable_shared= "

-echo $enable_shared

 

 if test "$enable_shared" = yes; then

   LIBSUPCXX_PICFLAGS="-prefer-pic"

diff -ruN gcc-4.2.1.orig/libstdc++-v3/libsupc++/tinfo2.cc gcc-4.2.1/libstdc++-v3/libsupc++/tinfo2.cc

--- gcc-4.2.1.orig/libstdc++-v3/libsupc++/tinfo2.cc2009-02-11 00:20:02.000000000 +0800

+++ gcc-4.2.1/libstdc++-v3/libsupc++/tinfo2.cc2009-02-11 11:10:11.000000000 +0800

@@ -33,8 +33,6 @@

 #include "tinfo.h"

 #include "new"// for placement new

 

-#include <iostream>

-

 // We can't rely on having stdlib.h if we're freestanding.

 extern "C" void abort ();

 

@@ -90,7 +88,6 @@

 bool __pointer_type_info::

 __is_pointer_p () const

 {

-  cout << "inside __is_pointer_p()" << endl;

   return true;

 }

 

@@ -105,8 +102,6 @@

             void **thr_obj,

             unsigned outer) const

 {

-  cout << "inside __do_catch()" << endl;

-

   if (*this == *thr_type)

     return true;      // same type

   if (typeid (*this) != typeid (*thr_type))

diff -ruN gcc-4.2.1.orig/libstdc++-v3/libsupc++/tinfo.cc gcc-4.2.1/libstdc++-v3/libsupc++/tinfo.cc

--- gcc-4.2.1.orig/libstdc++-v3/libsupc++/tinfo.cc2009-02-11 00:20:16.000000000 +0800

+++ gcc-4.2.1/libstdc++-v3/libsupc++/tinfo.cc2009-02-11 11:10:11.000000000 +0800

@@ -68,15 +68,12 @@

 

 #endif

 

-#include <iostream>

-

 namespace std {

 

 // return true if this is a type_info for a pointer type

 bool type_info::

 __is_pointer_p () const

 {

-  cout << "in __is_pointer_p()" << endl;

   return false;

 }

 

@@ -91,7 +88,6 @@

 bool type_info::

 __do_catch (const type_info *thr_type, void **, unsigned) const

 {

-  cout << "in __do_catch ()" << endl;

   return *this == *thr_type;

 }

 

原创粉丝点击