diff -crN gcc-4.9-20130512/gcc/config/i386/i386.c gcc-work/gcc/config/i386/i386.c
*** gcc-4.9-20130512/gcc/config/i386/i386.c	2013-05-06 16:53:03.000000000 +0200
--- gcc-work/gcc/config/i386/i386.c	2013-05-14 13:37:14.338020400 +0200
***************
*** 11693,11699 ****
  	      if (XINT (op, 1) == UNSPEC_TP
  	          && TARGET_TLS_DIRECT_SEG_REFS
  	          && seg == SEG_DEFAULT)
! 		seg = TARGET_64BIT ? SEG_FS : SEG_GS;
  	      else
  		return 0;
  	      break;
--- 11693,11699 ----
  	      if (XINT (op, 1) == UNSPEC_TP
  	          && TARGET_TLS_DIRECT_SEG_REFS
  	          && seg == SEG_DEFAULT)
! 		seg = DEFAULT_TLS_SEG_REG;
  	      else
  		return 0;
  	      break;
***************
*** 13645,13651 ****
    if (GET_CODE (x) != PLUS || GET_MODE (x) != Pmode)
      return orig_x;
    if (ix86_decompose_address (x, &addr) == 0
!       || addr.seg != (TARGET_64BIT ? SEG_FS : SEG_GS)
        || addr.disp == NULL_RTX
        || GET_CODE (addr.disp) != CONST)
      return orig_x;
--- 13645,13651 ----
    if (GET_CODE (x) != PLUS || GET_MODE (x) != Pmode)
      return orig_x;
    if (ix86_decompose_address (x, &addr) == 0
!       || addr.seg != (DEFAULT_TLS_SEG_REG)
        || addr.disp == NULL_RTX
        || GET_CODE (addr.disp) != CONST)
      return orig_x;
diff -crN gcc-4.9-20130512/gcc/config/i386/i386.h gcc-work/gcc/config/i386/i386.h
*** gcc-4.9-20130512/gcc/config/i386/i386.h	2013-04-29 13:00:10.000000000 +0200
--- gcc-work/gcc/config/i386/i386.h	2013-05-14 13:36:19.041020400 +0200
***************
*** 540,545 ****
--- 540,548 ----
  /* The default abi used by target.  */
  #define DEFAULT_ABI SYSV_ABI
  
+ /* The default TLS segment register used by target.  */
+ #define DEFAULT_TLS_SEG_REG TARGET_64BIT ? SEG_FS : SEG_GS 
+ 
  /* Subtargets may reset this to 1 in order to enable 96-bit long double
     with the rounding mode forced to 53 bits.  */
  #define TARGET_96_ROUND_53_LONG_DOUBLE 0
diff -crN gcc-4.9-20130512/gcc/config/i386/rdos.h gcc-work/gcc/config/i386/rdos.h
*** gcc-4.9-20130512/gcc/config/i386/rdos.h	2013-01-28 21:42:55.000000000 +0100
--- gcc-work/gcc/config/i386/rdos.h	2013-05-14 13:36:17.940020400 +0200
***************
*** 21,33 ****
  #undef TARGET_EXECUTABLE_SUFFIX
  #define TARGET_EXECUTABLE_SUFFIX ".exe"
  
  #undef TARGET_RDOS
  #define TARGET_RDOS 1
  
! #define TARGET_OS_CPP_BUILTINS()		\
!   do						\
!     {						\
!       builtin_define ("__RDOS__");		\
!       builtin_assert ("system=rdos");		\
!     }						\
    while (0)
--- 21,39 ----
  #undef TARGET_EXECUTABLE_SUFFIX
  #define TARGET_EXECUTABLE_SUFFIX ".exe"
  
+ #undef TARGET_TLS_DIRECT_SEG_REFS
+ #define TARGET_TLS_DIRECT_SEG_REFS 1
+ 
+ #undef DEFAULT_TLS_SEG_REG
+ #define DEFAULT_TLS_SEG_REG SEG_GS 
+ 
  #undef TARGET_RDOS
  #define TARGET_RDOS 1
  
! #define TARGET_OS_CPP_BUILTINS()                \
!   do                                            \
!     {                                           \
!       builtin_define ("__RDOS__");              \
!       builtin_assert ("system=rdos");           \
!     }                                           \
    while (0)
