public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* Re: [PATCH] Adding target rdos to GCC
@ 2013-01-06 20:32 Uros Bizjak
  2013-01-07 22:13 ` Leif Ekblad
  0 siblings, 1 reply; 16+ messages in thread
From: Uros Bizjak @ 2013-01-06 20:32 UTC (permalink / raw)
  To: gcc-patches; +Cc: Leif Ekblad, H.J. Lu

[-- Attachment #1: Type: text/plain, Size: 1843 bytes --]

Hello!

> Updated patches with the suggestions below, except that the initial value is 0
> (which is not meaningful). I also added a setting in rdos target file to use r15
> for PIC instead of rbx.

*** gcc-4.8-20121230/gcc/config/i386/i386.c	Thu Dec 27 02:58:06 2012
--- gcc-work/gcc/config/i386/i386.c	Sun Jan  6 14:10:34 2013

+   if (ix86_section_threshold == 0)
+     ix86_section_threshold = DEFAULT_SECTION_THRESHOLD;

Please see attached patch on how to initialize an option.

*** gcc-4.8-20121230/gcc/config/i386/i386.h	Wed Dec 19 17:04:12 2012
--- gcc-work/gcc/config/i386/i386.h	Sun Jan  6 13:24:26 2013

+ #define TARGET_MEDIUM_PIC   0

You should just use TARGET_RDOS here (also, please see attached patch).

+ /* Default threshold for putting data in large sections with x86-64
+    medium memory model */
+ #define DEFAULT_SECTION_THRESHOLD 65536

Do not put this define in the middle of i386.h section that deals with
alignment...

*** gcc-4.8-20121230/gcc/config/i386/rdos.h	Thu Jan  1 01:00:00 1970
--- gcc-work/gcc/config/i386/rdos.h	Sun Jan  6 13:20:12 2013

+ #undef REAL_PIC_OFFSET_TABLE_REGNUM
+ #define REAL_PIC_OFFSET_TABLE_REGNUM  R15_REG

Is this header also used for 32bit target? You should not use REX
registers for 32bit targets.

+ #undef TARGET_MEDIUM_PIC
+ #define TARGET_MEDIUM_PIC           1

TARGET_RDOS

+ #define DEFAULT_SECTION_THRESHOLD    0x10

No hex numbers here. Also, you will need to #undef this first to
override the default in i386.h.

*** gcc-4.8-20121230/gcc/config.gcc	Thu Nov 22 00:33:40 2012
--- gcc-work/gcc/config.gcc	Fri Jan  4 21:08:46 2013

+ i[34567]86-*-rdos*)
+     tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h
newlib-stdint.h"
+     ;;

You forgot to include i386/rdos.h here (other headers too?). It is
needed at least for TARGET_EXECUTABLE_SUFFIX define.

Uros.

[-- Attachment #2: r.diff.txt --]
[-- Type: text/plain, Size: 1741 bytes --]

Index: i386.c
===================================================================
--- i386.c	(revision 194945)
+++ i386.c	(working copy)
@@ -3239,6 +3239,8 @@
 	 DLL, and is essentially just as efficient as direct addressing.  */
       if (TARGET_64BIT && DEFAULT_ABI == MS_ABI)
 	ix86_cmodel = CM_SMALL_PIC, flag_pic = 1;
+      else if (TARGET_64BIT && TARGET_RDOS)
+	ix86_cmodel = CM_MEDIUM_PIC, flag_pic = 1;
       else if (TARGET_64BIT)
 	ix86_cmodel = flag_pic ? CM_SMALL_PIC : CM_SMALL;
       else
Index: i386.h
===================================================================
--- i386.h	(revision 194945)
+++ i386.h	(working copy)
@@ -519,6 +519,9 @@
 #define MACHOPIC_INDIRECT 0
 #define MACHOPIC_PURE 0
 
+/* For the RDOS  */
+#define TARGET_RDOS 0
+
 /* For the Windows 64-bit ABI.  */
 #define TARGET_64BIT_MS_ABI (TARGET_64BIT && ix86_cfun_abi () == MS_ABI)
 
@@ -2081,6 +2084,10 @@
    asm (SECTION_OP "\n\t"					\
 	"call " CRT_MKSTR(__USER_LABEL_PREFIX__) #FUNC "\n"	\
 	TEXT_SECTION_ASM_OP);
+
+/* Default threshold for putting data in large sections
+   with x86-64 medium memory model */
+#define DEFAULT_LARGE_SECTION_THRESHOLD 65536
 \f
 /* Which processor to tune code generation for.  */
 
Index: i386.opt
===================================================================
--- i386.opt	(revision 194945)
+++ i386.opt	(working copy)
@@ -141,7 +141,7 @@
 Branches are this expensive (1-5, arbitrary units)
 
 mlarge-data-threshold=
-Target RejectNegative Joined UInteger Var(ix86_section_threshold) Init(65536)
+Target RejectNegative Joined UInteger Var(ix86_section_threshold) Init(DEFAULT_LARGE_SECTION_THRESHOLD)
 Data greater than given threshold will go into .ldata section in x86-64 medium model
 
 mcmodel=

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] Adding target rdos to GCC
  2013-01-06 20:32 [PATCH] Adding target rdos to GCC Uros Bizjak
@ 2013-01-07 22:13 ` Leif Ekblad
  2013-01-08 20:32   ` Leif Ekblad
  0 siblings, 1 reply; 16+ messages in thread
From: Leif Ekblad @ 2013-01-07 22:13 UTC (permalink / raw)
  To: Uros Bizjak, gcc-patches; +Cc: H.J. Lu

[-- Attachment #1: Type: text/plain, Size: 3630 bytes --]

Hello Uros,

I tried to use your suggestion and use DEFAULT_SECTION_THRESHOLD
in i386.opt, however this doesn't work for me. It seems the default is 
always
65536 regardless of what I define in rdos.h. Therefore, I kept the design
as it was before.

Changing name to TARGET_RDOS seems reasonable, and this has been changed.
The location of the defines are also changed to the positions you proposed.

I added another include-file (rdos32.h) for the 32-bit target. Currently, 
the
32-bit target is supported with OpenWatcom. While I want to make sure
the header-files compile for both 32- and 64-bits, 32-bit support is not
my primary target right now. I just need a GCC that can build the 32-bit
version.

New change log:
* config/gthr.m4: Added rdos thread header.
* gcc/config/i386/i386.c: Provided a way to define a default setting for 
medium memory model and PIC using TARGET_RDOS define. Provided a way to 
define a default value for large-data-threshold.
* gcc/config/i386/i386.h: Defined TARGET_RDOS macro. Defined default value 
for large-data-threshold.
* gcc/config/i386/i386.md: Added r14 and r15 register names.
* gcc/config/i386/i386.opt: Changed initial value for large-data-threshold 
to 0 to allow detection of modification.
* gcc/config/i386/rdos.h: Added new file for 64-bit rdos target.
* gcc/config/i386/rdos32.h: Added new file for 32-bit rdos target.
* gcc/config.gcc: Added rdos targets

Leif Ekblad


----- Original Message ----- 
From: "Uros Bizjak" <ubizjak@gmail.com>
To: <gcc-patches@gcc.gnu.org>
Cc: "Leif Ekblad" <leif@rdos.net>; "H.J. Lu" <hjl.tools@gmail.com>
Sent: Sunday, January 06, 2013 9:32 PM
Subject: Re: [PATCH] Adding target rdos to GCC


> Hello!
>
>> Updated patches with the suggestions below, except that the initial value 
>> is 0
>> (which is not meaningful). I also added a setting in rdos target file to 
>> use r15
>> for PIC instead of rbx.
>
> *** gcc-4.8-20121230/gcc/config/i386/i386.c Thu Dec 27 02:58:06 2012
> --- gcc-work/gcc/config/i386/i386.c Sun Jan  6 14:10:34 2013
>
> +   if (ix86_section_threshold == 0)
> +     ix86_section_threshold = DEFAULT_SECTION_THRESHOLD;
>
> Please see attached patch on how to initialize an option.
>
> *** gcc-4.8-20121230/gcc/config/i386/i386.h Wed Dec 19 17:04:12 2012
> --- gcc-work/gcc/config/i386/i386.h Sun Jan  6 13:24:26 2013
>
> + #define TARGET_MEDIUM_PIC   0
>
> You should just use TARGET_RDOS here (also, please see attached patch).
>
> + /* Default threshold for putting data in large sections with x86-64
> +    medium memory model */
> + #define DEFAULT_SECTION_THRESHOLD 65536
>
> Do not put this define in the middle of i386.h section that deals with
> alignment...
>
> *** gcc-4.8-20121230/gcc/config/i386/rdos.h Thu Jan  1 01:00:00 1970
> --- gcc-work/gcc/config/i386/rdos.h Sun Jan  6 13:20:12 2013
>
> + #undef REAL_PIC_OFFSET_TABLE_REGNUM
> + #define REAL_PIC_OFFSET_TABLE_REGNUM  R15_REG
>
> Is this header also used for 32bit target? You should not use REX
> registers for 32bit targets.
>
> + #undef TARGET_MEDIUM_PIC
> + #define TARGET_MEDIUM_PIC           1
>
> TARGET_RDOS
>
> + #define DEFAULT_SECTION_THRESHOLD    0x10
>
> No hex numbers here. Also, you will need to #undef this first to
> override the default in i386.h.
>
> *** gcc-4.8-20121230/gcc/config.gcc Thu Nov 22 00:33:40 2012
> --- gcc-work/gcc/config.gcc Fri Jan  4 21:08:46 2013
>
> + i[34567]86-*-rdos*)
> +     tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h
> newlib-stdint.h"
> +     ;;
>
> You forgot to include i386/rdos.h here (other headers too?). It is
> needed at least for TARGET_EXECUTABLE_SUFFIX define.
>
> Uros.
> 

[-- Attachment #2: gcc-base.diff --]
[-- Type: application/octet-stream, Size: 6927 bytes --]

diff -crN gcc-4.8-20121230/config/gthr.m4 gcc-work/config/gthr.m4
*** gcc-4.8-20121230/config/gthr.m4	2012-10-15 15:10:30.000000000 +0200
--- gcc-work/config/gthr.m4	2013-01-07 10:14:04.620667900 +0100
***************
*** 21,26 ****
--- 21,27 ----
      tpf)	thread_header=config/s390/gthr-tpf.h ;;
      vxworks)	thread_header=config/gthr-vxworks.h ;;
      win32)	thread_header=config/i386/gthr-win32.h ;;
+     rdos)	thread_header=config/i386/gthr-rdos.h ;;
  esac
  AC_SUBST(thread_header)
  ])
diff -crN gcc-4.8-20121230/gcc/config/i386/i386.c gcc-work/gcc/config/i386/i386.c
*** gcc-4.8-20121230/gcc/config/i386/i386.c	2012-12-27 02:58:06.000000000 +0100
--- gcc-work/gcc/config/i386/i386.c	2013-01-07 10:14:04.636667900 +0100
***************
*** 3239,3244 ****
--- 3239,3246 ----
  	 DLL, and is essentially just as efficient as direct addressing.  */
        if (TARGET_64BIT && DEFAULT_ABI == MS_ABI)
  	ix86_cmodel = CM_SMALL_PIC, flag_pic = 1;
+       else if (TARGET_64BIT && TARGET_RDOS)
+     ix86_cmodel = CM_MEDIUM_PIC, flag_pic = 1;
        else if (TARGET_64BIT)
  	ix86_cmodel = flag_pic ? CM_SMALL_PIC : CM_SMALL;
        else
***************
*** 3919,3924 ****
--- 3921,3929 ----
        && !(target_flags_explicit & MASK_LONG_DOUBLE_64))
      target_flags |= MASK_LONG_DOUBLE_64;
  
+   if (ix86_section_threshold == 0)
+     ix86_section_threshold = DEFAULT_SECTION_THRESHOLD;
+ 
    /* Save the initial options in case the user does function specific
       options.  */
    if (main_args_p)
diff -crN gcc-4.8-20121230/gcc/config/i386/i386.h gcc-work/gcc/config/i386/i386.h
*** gcc-4.8-20121230/gcc/config/i386/i386.h	2012-12-19 17:04:11.000000000 +0100
--- gcc-work/gcc/config/i386/i386.h	2013-01-07 10:43:07.612247200 +0100
***************
*** 519,524 ****
--- 519,527 ----
  #define MACHOPIC_INDIRECT 0
  #define MACHOPIC_PURE 0
  
+ /* For the RDOS  */
+ #define TARGET_RDOS 0
+ 
  /* For the Windows 64-bit ABI.  */
  #define TARGET_64BIT_MS_ABI (TARGET_64BIT && ix86_cfun_abi () == MS_ABI)
  
***************
*** 2081,2086 ****
--- 2084,2093 ----
     asm (SECTION_OP "\n\t"					\
  	"call " CRT_MKSTR(__USER_LABEL_PREFIX__) #FUNC "\n"	\
  	TEXT_SECTION_ASM_OP);
+ 
+ /* Default threshold for putting data in large sections
+    with x86-64 medium memory model */
+ #define DEFAULT_LARGE_SECTION_THRESHOLD 65536
  \f
  /* Which processor to tune code generation for.  */
  
diff -crN gcc-4.8-20121230/gcc/config/i386/i386.md gcc-work/gcc/config/i386/i386.md
*** gcc-4.8-20121230/gcc/config/i386/i386.md	2012-12-19 17:04:11.000000000 +0100
--- gcc-work/gcc/config/i386/i386.md	2013-01-07 10:14:04.644667900 +0100
***************
*** 301,306 ****
--- 301,308 ----
     (R11_REG			40)
     (R12_REG			41)
     (R13_REG			42)
+    (R14_REG			43)
+    (R15_REG			44)
     (XMM8_REG			45)
     (XMM9_REG			46)
     (XMM10_REG			47)
diff -crN gcc-4.8-20121230/gcc/config/i386/i386.opt gcc-work/gcc/config/i386/i386.opt
*** gcc-4.8-20121230/gcc/config/i386/i386.opt	2012-11-16 08:17:30.000000000 +0100
--- gcc-work/gcc/config/i386/i386.opt	2013-01-07 10:14:04.646667900 +0100
***************
*** 141,147 ****
  Branches are this expensive (1-5, arbitrary units)
  
  mlarge-data-threshold=
! Target RejectNegative Joined UInteger Var(ix86_section_threshold) Init(65536)
  Data greater than given threshold will go into .ldata section in x86-64 medium model
  
  mcmodel=
--- 141,147 ----
  Branches are this expensive (1-5, arbitrary units)
  
  mlarge-data-threshold=
! Target RejectNegative Joined UInteger Var(ix86_section_threshold) Init(0)
  Data greater than given threshold will go into .ldata section in x86-64 medium model
  
  mcmodel=
diff -crN gcc-4.8-20121230/gcc/config/i386/rdos.h gcc-work/gcc/config/i386/rdos.h
*** gcc-4.8-20121230/gcc/config/i386/rdos.h	1970-01-01 01:00:00.000000000 +0100
--- gcc-work/gcc/config/i386/rdos.h	2013-01-07 10:38:29.596748600 +0100
***************
*** 0 ****
--- 1,24 ----
+ 
+ /* RDOS uses .exe suffix */
+ #undef TARGET_EXECUTABLE_SUFFIX
+ #define TARGET_EXECUTABLE_SUFFIX ".exe"
+ 
+ #undef REAL_PIC_OFFSET_TABLE_REGNUM
+ #define REAL_PIC_OFFSET_TABLE_REGNUM  R15_REG
+ 
+ #undef TARGET_RDOS
+ #define TARGET_RDOS 1
+ 
+ #undef DEFAULT_SECTION_THRESHOLD
+ #define DEFAULT_SECTION_THRESHOLD 16
+ 
+ #define TARGET_OS_CPP_BUILTINS()                \
+   do                                            \
+     {                                           \
+         builtin_define ("__RDOS__");            \
+         builtin_assert ("system=rdos");         \
+     }                                           \
+   while (0)
+ 
+ /* RDOS headers are C++-aware (and often use C++).  */
+ #define NO_IMPLICIT_EXTERN_C
diff -crN gcc-4.8-20121230/gcc/config/i386/rdos32.h gcc-work/gcc/config/i386/rdos32.h
*** gcc-4.8-20121230/gcc/config/i386/rdos32.h	1970-01-01 01:00:00.000000000 +0100
--- gcc-work/gcc/config/i386/rdos32.h	2013-01-07 10:37:24.281217700 +0100
***************
*** 0 ****
--- 1,15 ----
+ 
+ /* RDOS uses .exe suffix */
+ #undef TARGET_EXECUTABLE_SUFFIX
+ #define TARGET_EXECUTABLE_SUFFIX ".exe"
+ 
+ #define TARGET_OS_CPP_BUILTINS()                \
+   do                                            \
+     {                                           \
+         builtin_define ("__RDOS__");            \
+         builtin_assert ("system=rdos");         \
+     }                                           \
+   while (0)
+ 
+ /* RDOS headers are C++-aware (and often use C++).  */
+ #define NO_IMPLICIT_EXTERN_C
diff -crN gcc-4.8-20121230/gcc/config.gcc gcc-work/gcc/config.gcc
*** gcc-4.8-20121230/gcc/config.gcc	2012-11-22 00:33:40.000000000 +0100
--- gcc-work/gcc/config.gcc	2013-01-07 10:36:47.446534600 +0100
***************
*** 739,744 ****
--- 739,750 ----
    use_gcc_stdint=wrap
    tm_defines="$tm_defines DEFAULT_LIBC=LIBC_UCLIBC SINGLE_LIBC"
    ;;
+ *-*-rdos*)
+   case ${enable_threads} in
+     "" | yes | rdos) thread_file='rdos' ;;
+   esac
+   use_gcc_stdint=wrap
+   ;;
  *-*-solaris2*)
    # i?86-*-solaris2* needs to insert headers between cpu default and
    # Solaris 2 specific ones.
***************
*** 1205,1210 ****
--- 1211,1223 ----
  x86_64-*-elf*)
  	tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h newlib-stdint.h i386/i386elf.h i386/x86-64.h"
  	;;
+ i[34567]86-*-rdos*)
+     tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h newlib-stdint.h i386/i386elf.h i386/rdos32.h"
+     ;;
+ x86_64-*-rdos*)
+     tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h newlib-stdint.h i386/i386elf.h i386/x86-64.h i386/rdos.h"
+     tmake_file="i386/t-i386elf t-svr4"
+     ;;
  i[34567]86-*-freebsd*)
  	tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h ${fbsd_tm_file} i386/freebsd.h"
  	;;

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] Adding target rdos to GCC
  2013-01-07 22:13 ` Leif Ekblad
@ 2013-01-08 20:32   ` Leif Ekblad
  2013-01-09  6:58     ` Uros Bizjak
  0 siblings, 1 reply; 16+ messages in thread
From: Leif Ekblad @ 2013-01-08 20:32 UTC (permalink / raw)
  To: Leif Ekblad, Uros Bizjak, gcc-patches; +Cc: H.J. Lu

[-- Attachment #1: Type: text/plain, Size: 4767 bytes --]

After some new suggestions from Uros, I've made a new diff.

Change log:
* config/gthr.m4: Added rdos thread header.
* gcc/config/i386/i386.c: Provided a way to define a default setting for 
medium memory model and PIC using TARGET_RDOS define.
* gcc/config/i386/i386.h: Defined TARGET_RDOS macro. Defined default value 
for large-data-threshold.
* gcc/config/i386/i386.md: Added r14 and r15 register names.
* gcc/config/i386/i386.opt: Changed initial value for large-data-threshold 
to DEFAULT_LARGE_SECTION_THRESHOLD.
* gcc/config/i386/rdos.h: Common definitions for target rdos
* gcc/config/i386/rdos64.h: Specific definitions for 64-bit rdos target.
* gcc/config.gcc: Added rdos targets

Tested on target rdos and rdos32.

Leif Ekblad

----- Original Message ----- 
From: "Leif Ekblad" <leif@rdos.net>
To: "Uros Bizjak" <ubizjak@gmail.com>; <gcc-patches@gcc.gnu.org>
Cc: "H.J. Lu" <hjl.tools@gmail.com>
Sent: Monday, January 07, 2013 11:13 PM
Subject: Re: [PATCH] Adding target rdos to GCC


> Hello Uros,
>
> I tried to use your suggestion and use DEFAULT_SECTION_THRESHOLD
> in i386.opt, however this doesn't work for me. It seems the default is
> always
> 65536 regardless of what I define in rdos.h. Therefore, I kept the design
> as it was before.
>
> Changing name to TARGET_RDOS seems reasonable, and this has been changed.
> The location of the defines are also changed to the positions you 
> proposed.
>
> I added another include-file (rdos32.h) for the 32-bit target. Currently,
> the
> 32-bit target is supported with OpenWatcom. While I want to make sure
> the header-files compile for both 32- and 64-bits, 32-bit support is not
> my primary target right now. I just need a GCC that can build the 32-bit
> version.
>
> New change log:
> * config/gthr.m4: Added rdos thread header.
> * gcc/config/i386/i386.c: Provided a way to define a default setting for
> medium memory model and PIC using TARGET_RDOS define. Provided a way to
> define a default value for large-data-threshold.
> * gcc/config/i386/i386.h: Defined TARGET_RDOS macro. Defined default value
> for large-data-threshold.
> * gcc/config/i386/i386.md: Added r14 and r15 register names.
> * gcc/config/i386/i386.opt: Changed initial value for large-data-threshold
> to 0 to allow detection of modification.
> * gcc/config/i386/rdos.h: Added new file for 64-bit rdos target.
> * gcc/config/i386/rdos32.h: Added new file for 32-bit rdos target.
> * gcc/config.gcc: Added rdos targets
>
> Leif Ekblad
>
>
> ----- Original Message ----- 
> From: "Uros Bizjak" <ubizjak@gmail.com>
> To: <gcc-patches@gcc.gnu.org>
> Cc: "Leif Ekblad" <leif@rdos.net>; "H.J. Lu" <hjl.tools@gmail.com>
> Sent: Sunday, January 06, 2013 9:32 PM
> Subject: Re: [PATCH] Adding target rdos to GCC
>
>
>> Hello!
>>
>>> Updated patches with the suggestions below, except that the initial 
>>> value
>>> is 0
>>> (which is not meaningful). I also added a setting in rdos target file to
>>> use r15
>>> for PIC instead of rbx.
>>
>> *** gcc-4.8-20121230/gcc/config/i386/i386.c Thu Dec 27 02:58:06 2012
>> --- gcc-work/gcc/config/i386/i386.c Sun Jan  6 14:10:34 2013
>>
>> +   if (ix86_section_threshold == 0)
>> +     ix86_section_threshold = DEFAULT_SECTION_THRESHOLD;
>>
>> Please see attached patch on how to initialize an option.
>>
>> *** gcc-4.8-20121230/gcc/config/i386/i386.h Wed Dec 19 17:04:12 2012
>> --- gcc-work/gcc/config/i386/i386.h Sun Jan  6 13:24:26 2013
>>
>> + #define TARGET_MEDIUM_PIC   0
>>
>> You should just use TARGET_RDOS here (also, please see attached patch).
>>
>> + /* Default threshold for putting data in large sections with x86-64
>> +    medium memory model */
>> + #define DEFAULT_SECTION_THRESHOLD 65536
>>
>> Do not put this define in the middle of i386.h section that deals with
>> alignment...
>>
>> *** gcc-4.8-20121230/gcc/config/i386/rdos.h Thu Jan  1 01:00:00 1970
>> --- gcc-work/gcc/config/i386/rdos.h Sun Jan  6 13:20:12 2013
>>
>> + #undef REAL_PIC_OFFSET_TABLE_REGNUM
>> + #define REAL_PIC_OFFSET_TABLE_REGNUM  R15_REG
>>
>> Is this header also used for 32bit target? You should not use REX
>> registers for 32bit targets.
>>
>> + #undef TARGET_MEDIUM_PIC
>> + #define TARGET_MEDIUM_PIC           1
>>
>> TARGET_RDOS
>>
>> + #define DEFAULT_SECTION_THRESHOLD    0x10
>>
>> No hex numbers here. Also, you will need to #undef this first to
>> override the default in i386.h.
>>
>> *** gcc-4.8-20121230/gcc/config.gcc Thu Nov 22 00:33:40 2012
>> --- gcc-work/gcc/config.gcc Fri Jan  4 21:08:46 2013
>>
>> + i[34567]86-*-rdos*)
>> +     tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h
>> newlib-stdint.h"
>> +     ;;
>>
>> You forgot to include i386/rdos.h here (other headers too?). It is
>> needed at least for TARGET_EXECUTABLE_SUFFIX define.
>>
>> Uros.
>>
> 

[-- Attachment #2: gcc-base.diff --]
[-- Type: application/octet-stream, Size: 6056 bytes --]

diff -crN gcc-4.8-20121230/config/gthr.m4 gcc-work/config/gthr.m4
*** gcc-4.8-20121230/config/gthr.m4	2012-10-15 15:10:30.000000000 +0200
--- gcc-work/config/gthr.m4	2013-01-07 10:14:04.620667900 +0100
***************
*** 21,26 ****
--- 21,27 ----
      tpf)	thread_header=config/s390/gthr-tpf.h ;;
      vxworks)	thread_header=config/gthr-vxworks.h ;;
      win32)	thread_header=config/i386/gthr-win32.h ;;
+     rdos)	thread_header=config/i386/gthr-rdos.h ;;
  esac
  AC_SUBST(thread_header)
  ])
diff -crN gcc-4.8-20121230/gcc/config/i386/i386.c gcc-work/gcc/config/i386/i386.c
*** gcc-4.8-20121230/gcc/config/i386/i386.c	2012-12-27 02:58:06.000000000 +0100
--- gcc-work/gcc/config/i386/i386.c	2013-01-07 10:14:04.636667900 +0100
***************
*** 3239,3244 ****
--- 3239,3246 ----
  	 DLL, and is essentially just as efficient as direct addressing.  */
        if (TARGET_64BIT && DEFAULT_ABI == MS_ABI)
  	ix86_cmodel = CM_SMALL_PIC, flag_pic = 1;
+       else if (TARGET_64BIT && TARGET_RDOS)
+     ix86_cmodel = CM_MEDIUM_PIC, flag_pic = 1;
        else if (TARGET_64BIT)
  	ix86_cmodel = flag_pic ? CM_SMALL_PIC : CM_SMALL;
        else
diff -crN gcc-4.8-20121230/gcc/config/i386/i386.h gcc-work/gcc/config/i386/i386.h
*** gcc-4.8-20121230/gcc/config/i386/i386.h	2012-12-19 17:04:11.000000000 +0100
--- gcc-work/gcc/config/i386/i386.h	2013-01-07 10:43:07.612247200 +0100
***************
*** 519,524 ****
--- 519,527 ----
  #define MACHOPIC_INDIRECT 0
  #define MACHOPIC_PURE 0
  
+ /* For the RDOS  */
+ #define TARGET_RDOS 0
+ 
  /* For the Windows 64-bit ABI.  */
  #define TARGET_64BIT_MS_ABI (TARGET_64BIT && ix86_cfun_abi () == MS_ABI)
  
***************
*** 2081,2086 ****
--- 2084,2093 ----
     asm (SECTION_OP "\n\t"					\
  	"call " CRT_MKSTR(__USER_LABEL_PREFIX__) #FUNC "\n"	\
  	TEXT_SECTION_ASM_OP);
+ 
+ /* Default threshold for putting data in large sections
+    with x86-64 medium memory model */
+ #define DEFAULT_LARGE_SECTION_THRESHOLD 65536
  \f
  /* Which processor to tune code generation for.  */
  
diff -crN gcc-4.8-20121230/gcc/config/i386/i386.md gcc-work/gcc/config/i386/i386.md
*** gcc-4.8-20121230/gcc/config/i386/i386.md	2012-12-19 17:04:11.000000000 +0100
--- gcc-work/gcc/config/i386/i386.md	2013-01-07 10:14:04.644667900 +0100
***************
*** 301,306 ****
--- 301,308 ----
     (R11_REG			40)
     (R12_REG			41)
     (R13_REG			42)
+    (R14_REG			43)
+    (R15_REG			44)
     (XMM8_REG			45)
     (XMM9_REG			46)
     (XMM10_REG			47)
diff -crN gcc-4.8-20121230/gcc/config/i386/i386.opt gcc-work/gcc/config/i386/i386.opt
*** gcc-4.8-20121230/gcc/config/i386/i386.opt	2012-11-16 08:17:30.000000000 +0100
--- gcc-work/gcc/config/i386/i386.opt	2013-01-07 10:14:04.646667900 +0100
***************
*** 141,147 ****
  Branches are this expensive (1-5, arbitrary units)
  
  mlarge-data-threshold=
! Target RejectNegative Joined UInteger Var(ix86_section_threshold) Init(65536)
  Data greater than given threshold will go into .ldata section in x86-64 medium model
  
  mcmodel=
--- 141,147 ----
  Branches are this expensive (1-5, arbitrary units)
  
  mlarge-data-threshold=
! Target RejectNegative Joined UInteger Var(ix86_section_threshold) Init(DEFAULT_LARGE_SECTION_THRESHOLD)
  Data greater than given threshold will go into .ldata section in x86-64 medium model
  
  mcmodel=
diff -crN gcc-4.8-20121230/gcc/config/i386/rdos.h gcc-work/gcc/config/i386/rdos.h
*** gcc-4.8-20121230/gcc/config/i386/rdos.h	1970-01-01 01:00:00.000000000 +0100
--- gcc-work/gcc/config/i386/rdos.h	2013-01-07 10:37:24.281217700 +0100
***************
*** 0 ****
--- 1,15 ----
+ 
+ /* RDOS uses .exe suffix */
+ #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)
+ 
+ /* RDOS headers are C++-aware (and often use C++).  */
+ #define NO_IMPLICIT_EXTERN_C
diff -crN gcc-4.8-20121230/gcc/config/i386/rdos64.h gcc-work/gcc/config/i386/rdos64.h
*** gcc-4.8-20121230/gcc/config/i386/rdos64.h	1970-01-01 01:00:00.000000000 +0100
--- gcc-work/gcc/config/i386/rdos64.h	2013-01-07 10:38:29.596748600 +0100
***************
*** 0 ****
--- 1,6 ----
+ 
+ #undef REAL_PIC_OFFSET_TABLE_REGNUM
+ #define REAL_PIC_OFFSET_TABLE_REGNUM  R15_REG
+ 
+ #undef DEFAULT_LARGE_SECTION_THRESHOLD
+ #define DEFAULT_LARGE_SECTION_THRESHOLD 16
diff -crN gcc-4.8-20121230/gcc/config.gcc gcc-work/gcc/config.gcc
*** gcc-4.8-20121230/gcc/config.gcc	2012-11-22 00:33:40.000000000 +0100
--- gcc-work/gcc/config.gcc	2013-01-07 10:36:47.446534600 +0100
***************
*** 739,744 ****
--- 739,750 ----
    use_gcc_stdint=wrap
    tm_defines="$tm_defines DEFAULT_LIBC=LIBC_UCLIBC SINGLE_LIBC"
    ;;
+ *-*-rdos*)
+   case ${enable_threads} in
+     "" | yes | rdos) thread_file='rdos' ;;
+   esac
+   use_gcc_stdint=wrap
+   ;;
  *-*-solaris2*)
    # i?86-*-solaris2* needs to insert headers between cpu default and
    # Solaris 2 specific ones.
***************
*** 1205,1210 ****
--- 1211,1223 ----
  x86_64-*-elf*)
  	tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h newlib-stdint.h i386/i386elf.h i386/x86-64.h"
  	;;
+ i[34567]86-*-rdos*)
+     tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h newlib-stdint.h i386/i386elf.h i386/rdos.h"
+     ;;
+ x86_64-*-rdos*)
+     tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h newlib-stdint.h i386/i386elf.h i386/x86-64.h i386/rdos.h i386/rdos64.h"
+     tmake_file="i386/t-i386elf t-svr4"
+     ;;
  i[34567]86-*-freebsd*)
  	tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h ${fbsd_tm_file} i386/freebsd.h"
  	;;


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] Adding target rdos to GCC
  2013-01-08 20:32   ` Leif Ekblad
@ 2013-01-09  6:58     ` Uros Bizjak
  2013-01-09  8:38       ` Richard Biener
  0 siblings, 1 reply; 16+ messages in thread
From: Uros Bizjak @ 2013-01-09  6:58 UTC (permalink / raw)
  To: Leif Ekblad; +Cc: gcc-patches, H.J. Lu, Jakub Jelinek, rguenther

On Tue, Jan 8, 2013 at 9:32 PM, Leif Ekblad <leif@rdos.net> wrote:
> After some new suggestions from Uros, I've made a new diff.
>
>
> Change log:
> * config/gthr.m4: Added rdos thread header.
> * gcc/config/i386/i386.c: Provided a way to define a default setting for
> medium memory model and PIC using TARGET_RDOS define.
> * gcc/config/i386/i386.h: Defined TARGET_RDOS macro. Defined default value
> for large-data-threshold.
> * gcc/config/i386/i386.md: Added r14 and r15 register names.
> * gcc/config/i386/i386.opt: Changed initial value for large-data-threshold
> to DEFAULT_LARGE_SECTION_THRESHOLD.
> * gcc/config/i386/rdos.h: Common definitions for target rdos
> * gcc/config/i386/rdos64.h: Specific definitions for 64-bit rdos target.
> * gcc/config.gcc: Added rdos targets

Please use present tense in ChangeLog (see many other entries).

> Tested on target rdos and rdos32.

This is OK for mainline, but the patch needs explicit approval from
Release Managers at this stage.

Thanks,
Uros.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] Adding target rdos to GCC
  2013-01-09  6:58     ` Uros Bizjak
@ 2013-01-09  8:38       ` Richard Biener
  2013-01-28  6:51         ` Leif Ekblad
  0 siblings, 1 reply; 16+ messages in thread
From: Richard Biener @ 2013-01-09  8:38 UTC (permalink / raw)
  To: Uros Bizjak; +Cc: Leif Ekblad, gcc-patches, H.J. Lu, Jakub Jelinek

On Wed, 9 Jan 2013, Uros Bizjak wrote:

> On Tue, Jan 8, 2013 at 9:32 PM, Leif Ekblad <leif@rdos.net> wrote:
> > After some new suggestions from Uros, I've made a new diff.
> >
> >
> > Change log:
> > * config/gthr.m4: Added rdos thread header.
> > * gcc/config/i386/i386.c: Provided a way to define a default setting for
> > medium memory model and PIC using TARGET_RDOS define.
> > * gcc/config/i386/i386.h: Defined TARGET_RDOS macro. Defined default value
> > for large-data-threshold.
> > * gcc/config/i386/i386.md: Added r14 and r15 register names.
> > * gcc/config/i386/i386.opt: Changed initial value for large-data-threshold
> > to DEFAULT_LARGE_SECTION_THRESHOLD.
> > * gcc/config/i386/rdos.h: Common definitions for target rdos
> > * gcc/config/i386/rdos64.h: Specific definitions for 64-bit rdos target.
> > * gcc/config.gcc: Added rdos targets
> 
> Please use present tense in ChangeLog (see many other entries).
> 
> > Tested on target rdos and rdos32.
> 
> This is OK for mainline, but the patch needs explicit approval from
> Release Managers at this stage.

Ok with me.

Richard.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] Adding target rdos to GCC
  2013-01-09  8:38       ` Richard Biener
@ 2013-01-28  6:51         ` Leif Ekblad
  2013-01-28  7:23           ` Uros Bizjak
  0 siblings, 1 reply; 16+ messages in thread
From: Leif Ekblad @ 2013-01-28  6:51 UTC (permalink / raw)
  To: Richard Biener, Uros Bizjak; +Cc: gcc-patches, H.J. Lu, Jakub Jelinek

If the patch is ok, could some maintainer add it to trunk?

Regards,
Leif Ekblad


----- Original Message ----- 
From: "Richard Biener" <rguenther@suse.de>
To: "Uros Bizjak" <ubizjak@gmail.com>
Cc: "Leif Ekblad" <leif@rdos.net>; <gcc-patches@gcc.gnu.org>; "H.J. Lu" 
<hjl.tools@gmail.com>; "Jakub Jelinek" <jakub@redhat.com>
Sent: Wednesday, January 09, 2013 9:37 AM
Subject: Re: [PATCH] Adding target rdos to GCC


> On Wed, 9 Jan 2013, Uros Bizjak wrote:
>
>> On Tue, Jan 8, 2013 at 9:32 PM, Leif Ekblad <leif@rdos.net> wrote:
>> > After some new suggestions from Uros, I've made a new diff.
>> >
>> >
>> > Change log:
>> > * config/gthr.m4: Added rdos thread header.
>> > * gcc/config/i386/i386.c: Provided a way to define a default setting 
>> > for
>> > medium memory model and PIC using TARGET_RDOS define.
>> > * gcc/config/i386/i386.h: Defined TARGET_RDOS macro. Defined default 
>> > value
>> > for large-data-threshold.
>> > * gcc/config/i386/i386.md: Added r14 and r15 register names.
>> > * gcc/config/i386/i386.opt: Changed initial value for 
>> > large-data-threshold
>> > to DEFAULT_LARGE_SECTION_THRESHOLD.
>> > * gcc/config/i386/rdos.h: Common definitions for target rdos
>> > * gcc/config/i386/rdos64.h: Specific definitions for 64-bit rdos 
>> > target.
>> > * gcc/config.gcc: Added rdos targets
>>
>> Please use present tense in ChangeLog (see many other entries).
>>
>> > Tested on target rdos and rdos32.
>>
>> This is OK for mainline, but the patch needs explicit approval from
>> Release Managers at this stage.
>
> Ok with me.
>
> Richard. 

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] Adding target rdos to GCC
  2013-01-28  6:51         ` Leif Ekblad
@ 2013-01-28  7:23           ` Uros Bizjak
  2013-01-28 19:58             ` Leif Ekblad
  0 siblings, 1 reply; 16+ messages in thread
From: Uros Bizjak @ 2013-01-28  7:23 UTC (permalink / raw)
  To: Leif Ekblad; +Cc: Richard Biener, gcc-patches, H.J. Lu, Jakub Jelinek

On Mon, Jan 28, 2013 at 7:50 AM, Leif Ekblad <leif@rdos.net> wrote:

> If the patch is ok, could some maintainer add it to trunk?

There is no gthr-rdos.h file in your patch:

*** gcc-4.8-20121230/config/gthr.m4	2012-10-15 15:10:30.000000000 +0200
--- gcc-work/config/gthr.m4	2013-01-07 10:14:04.620667900 +0100
***************
*** 21,26 ****
--- 21,27 ----
      tpf)	thread_header=config/s390/gthr-tpf.h ;;
      vxworks)	thread_header=config/gthr-vxworks.h ;;
      win32)	thread_header=config/i386/gthr-win32.h ;;
+     rdos)	thread_header=config/i386/gthr-rdos.h ;;

This file should be part of libgcc, so it needs its own ChangeLog.

Uros.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] Adding target rdos to GCC
  2013-01-28  7:23           ` Uros Bizjak
@ 2013-01-28 19:58             ` Leif Ekblad
  2013-01-28 20:03               ` Uros Bizjak
  0 siblings, 1 reply; 16+ messages in thread
From: Leif Ekblad @ 2013-01-28 19:58 UTC (permalink / raw)
  To: Uros Bizjak; +Cc: Richard Biener, gcc-patches, H.J. Lu, Jakub Jelinek

Uros,

That is intentional. The gthr-rdos.h file is part of libgcc. My intention 
was to first patch gcc, then update the patches for newlib, and finally 
libgcc. The gthr-rdos.h file would reference include-files part of newlib, 
so this is kind of circular. I also cannot define the thread model for RDOS 
unless I define this file.

I see a couple of possible solutions:
1. Keep as is. You cannot build libgcc at the current stage anyway, and the 
bootstrap must be built without threading
2. Add an empty gthr-rdos.h file until libgcc is done
3. Remove the threading-model for now, and add it with libgcc instead.

Regards,
Leif Ekblad



----- Original Message ----- 
From: "Uros Bizjak" <ubizjak@gmail.com>
To: "Leif Ekblad" <leif@rdos.net>
Cc: "Richard Biener" <rguenther@suse.de>; <gcc-patches@gcc.gnu.org>; "H.J. 
Lu" <hjl.tools@gmail.com>; "Jakub Jelinek" <jakub@redhat.com>
Sent: Monday, January 28, 2013 8:23 AM
Subject: Re: [PATCH] Adding target rdos to GCC


> On Mon, Jan 28, 2013 at 7:50 AM, Leif Ekblad <leif@rdos.net> wrote:
>
>> If the patch is ok, could some maintainer add it to trunk?
>
> There is no gthr-rdos.h file in your patch:
>
> *** gcc-4.8-20121230/config/gthr.m4 2012-10-15 15:10:30.000000000 +0200
> --- gcc-work/config/gthr.m4 2013-01-07 10:14:04.620667900 +0100
> ***************
> *** 21,26 ****
> --- 21,27 ----
>      tpf) thread_header=config/s390/gthr-tpf.h ;;
>      vxworks) thread_header=config/gthr-vxworks.h ;;
>      win32) thread_header=config/i386/gthr-win32.h ;;
> +     rdos) thread_header=config/i386/gthr-rdos.h ;;
>
> This file should be part of libgcc, so it needs its own ChangeLog.
>
> Uros. 

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] Adding target rdos to GCC
  2013-01-28 19:58             ` Leif Ekblad
@ 2013-01-28 20:03               ` Uros Bizjak
  2013-01-28 20:14                 ` Leif Ekblad
  0 siblings, 1 reply; 16+ messages in thread
From: Uros Bizjak @ 2013-01-28 20:03 UTC (permalink / raw)
  To: Leif Ekblad; +Cc: Richard Biener, gcc-patches, H.J. Lu, Jakub Jelinek

On Mon, Jan 28, 2013 at 8:57 PM, Leif Ekblad <leif@rdos.net> wrote:

> That is intentional. The gthr-rdos.h file is part of libgcc. My intention
> was to first patch gcc, then update the patches for newlib, and finally
> libgcc. The gthr-rdos.h file would reference include-files part of newlib,
> so this is kind of circular. I also cannot define the thread model for RDOS
> unless I define this file.
>
> I see a couple of possible solutions:
> 1. Keep as is. You cannot build libgcc at the current stage anyway, and the
> bootstrap must be built without threading
> 2. Add an empty gthr-rdos.h file until libgcc is done
> 3. Remove the threading-model for now, and add it with libgcc instead.

I propose option 3.

Is it enough to remove gthr.m4 change from the patch in this case?

Uros.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] Adding target rdos to GCC
  2013-01-28 20:03               ` Uros Bizjak
@ 2013-01-28 20:14                 ` Leif Ekblad
  2013-01-28 20:45                   ` Uros Bizjak
  0 siblings, 1 reply; 16+ messages in thread
From: Leif Ekblad @ 2013-01-28 20:14 UTC (permalink / raw)
  To: Uros Bizjak; +Cc: Richard Biener, gcc-patches, H.J. Lu, Jakub Jelinek


----- Original Message ----- 
From: "Uros Bizjak" <ubizjak@gmail.com>
To: "Leif Ekblad" <leif@rdos.net>
Cc: "Richard Biener" <rguenther@suse.de>; <gcc-patches@gcc.gnu.org>; "H.J. 
Lu" <hjl.tools@gmail.com>; "Jakub Jelinek" <jakub@redhat.com>
Sent: Monday, January 28, 2013 9:03 PM
Subject: Re: [PATCH] Adding target rdos to GCC


> On Mon, Jan 28, 2013 at 8:57 PM, Leif Ekblad <leif@rdos.net> wrote:
>
>> That is intentional. The gthr-rdos.h file is part of libgcc. My intention
>> was to first patch gcc, then update the patches for newlib, and finally
>> libgcc. The gthr-rdos.h file would reference include-files part of 
>> newlib,
>> so this is kind of circular. I also cannot define the thread model for 
>> RDOS
>> unless I define this file.
>>
>> I see a couple of possible solutions:
>> 1. Keep as is. You cannot build libgcc at the current stage anyway, and 
>> the
>> bootstrap must be built without threading
>> 2. Add an empty gthr-rdos.h file until libgcc is done
>> 3. Remove the threading-model for now, and add it with libgcc instead.
>
> I propose option 3.
>
> Is it enough to remove gthr.m4 change from the patch in this case?
>
> Uros.

Yes, for all practical purposes. There is a reference to thread-file in 
config.gcc, when threading is enabled, which doesn't work for bootstrapping 
the compiler anyway.

Regards,
Leif Ekblad

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] Adding target rdos to GCC
  2013-01-28 20:14                 ` Leif Ekblad
@ 2013-01-28 20:45                   ` Uros Bizjak
  2013-01-28 21:44                     ` Leif Ekblad
  2013-05-13 19:03                     ` Using GS for TLS on x86-64 for target RDOS Leif Ekblad
  0 siblings, 2 replies; 16+ messages in thread
From: Uros Bizjak @ 2013-01-28 20:45 UTC (permalink / raw)
  To: Leif Ekblad; +Cc: Richard Biener, gcc-patches, H.J. Lu, Jakub Jelinek

[-- Attachment #1: Type: text/plain, Size: 1775 bytes --]

On Mon, Jan 28, 2013 at 9:14 PM, Leif Ekblad <leif@rdos.net> wrote:

>>> That is intentional. The gthr-rdos.h file is part of libgcc. My intention
>>> was to first patch gcc, then update the patches for newlib, and finally
>>> libgcc. The gthr-rdos.h file would reference include-files part of
>>> newlib,
>>> so this is kind of circular. I also cannot define the thread model for
>>> RDOS
>>> unless I define this file.
>>>
>>> I see a couple of possible solutions:
>>> 1. Keep as is. You cannot build libgcc at the current stage anyway, and
>>> the
>>> bootstrap must be built without threading
>>> 2. Add an empty gthr-rdos.h file until libgcc is done
>>> 3. Remove the threading-model for now, and add it with libgcc instead.
>>
>>
>> I propose option 3.
>>
>> Is it enough to remove gthr.m4 change from the patch in this case?
>
> Yes, for all practical purposes. There is a reference to thread-file in
> config.gcc, when threading is enabled, which doesn't work for bootstrapping
> the compiler anyway.

Thanks for pointing it, I have also removed this reference.

Attached is the patch that has been committed to SVN. I have added
missing licence headers to new files and clean whitespace a bit.

2013-01-28  Leif Ekblad  <leif@rdos.net>

	* config.gcc (i[34567]86-*-rdos*, x86_64-*-rdos*): New targets.
	* config/i386/i386.h (TARGET_RDOS): New macro.
	(DEFAULT_LARGE_SECTION_THRESHOLD): New macro.
	* config/i386/i386.c (ix86_option_override_internal): For 64bit
	TARGET_RDOS, set ix86_cmodel to CM_MEDIUM_PIC and flag_pic to 1.
	* config/i386/i386.opt (mlarge-data-threshold): Initialize to
	DEFAULT_LARGE_SECTION_THRESHOLD.
	* config/i386/i386.md (R14_REG, R15_REG): New constants.
	* config/i386/rdos.h: New file.
	* config/i386/rdos64.h: New file.

Thanks,
Uros.

[-- Attachment #2: p.diff.txt --]
[-- Type: text/plain, Size: 5865 bytes --]

Index: config/i386/i386.c
===================================================================
--- config/i386/i386.c	(revision 195515)
+++ config/i386/i386.c	(working copy)
@@ -3235,10 +3235,12 @@ ix86_option_override_internal (bool main_args_p)
 	 DLL, and is essentially just as efficient as direct addressing.  */
       if (TARGET_64BIT && DEFAULT_ABI == MS_ABI)
 	ix86_cmodel = CM_SMALL_PIC, flag_pic = 1;
+      else if (TARGET_64BIT && TARGET_RDOS)
+	ix86_cmodel = CM_MEDIUM_PIC, flag_pic = 1;
       else if (TARGET_64BIT)
 	ix86_cmodel = flag_pic ? CM_SMALL_PIC : CM_SMALL;
       else
-        ix86_cmodel = CM_32;
+	ix86_cmodel = CM_32;
     }
   if (TARGET_MACHO && ix86_asm_dialect == ASM_INTEL)
     {
Index: config/i386/i386.h
===================================================================
--- config/i386/i386.h	(revision 195515)
+++ config/i386/i386.h	(working copy)
@@ -518,6 +518,9 @@ extern tree x86_mfence;
 #define MACHOPIC_INDIRECT 0
 #define MACHOPIC_PURE 0
 
+/* For the RDOS  */
+#define TARGET_RDOS 0
+
 /* For the Windows 64-bit ABI.  */
 #define TARGET_64BIT_MS_ABI (TARGET_64BIT && ix86_cfun_abi () == MS_ABI)
 
@@ -2081,6 +2084,10 @@ do {									\
    asm (SECTION_OP "\n\t"					\
 	"call " CRT_MKSTR(__USER_LABEL_PREFIX__) #FUNC "\n"	\
 	TEXT_SECTION_ASM_OP);
+
+/* Default threshold for putting data in large sections
+   with x86-64 medium memory model */
+#define DEFAULT_LARGE_SECTION_THRESHOLD 65536
 \f
 /* Which processor to tune code generation for.  */
 
Index: config/i386/i386.md
===================================================================
--- config/i386/i386.md	(revision 195515)
+++ config/i386/i386.md	(working copy)
@@ -300,6 +300,8 @@
    (R11_REG			40)
    (R12_REG			41)
    (R13_REG			42)
+   (R14_REG			43)
+   (R15_REG			44)
    (XMM8_REG			45)
    (XMM9_REG			46)
    (XMM10_REG			47)
Index: config/i386/i386.opt
===================================================================
--- config/i386/i386.opt	(revision 195515)
+++ config/i386/i386.opt	(working copy)
@@ -140,7 +140,7 @@ Target RejectNegative Joined UInteger Var(ix86_bra
 Branches are this expensive (1-5, arbitrary units)
 
 mlarge-data-threshold=
-Target RejectNegative Joined UInteger Var(ix86_section_threshold) Init(65536)
+Target RejectNegative Joined UInteger Var(ix86_section_threshold) Init(DEFAULT_LARGE_SECTION_THRESHOLD)
 Data greater than given threshold will go into .ldata section in x86-64 medium model
 
 mcmodel=
Index: config/i386/rdos.h
===================================================================
--- config/i386/rdos.h	(revision 0)
+++ config/i386/rdos.h	(working copy)
@@ -0,0 +1,33 @@
+/* Definitions for RDOS on i386.
+   Copyright (C) 2013 Free Software Foundation, Inc.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GCC; see the file COPYING3.  If not see
+<http://www.gnu.org/licenses/>.  */
+
+/* RDOS uses .exe suffix */
+#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)
Index: config/i386/rdos64.h
===================================================================
--- config/i386/rdos64.h	(revision 0)
+++ config/i386/rdos64.h	(working copy)
@@ -0,0 +1,24 @@
+/* Definitions for RDOS on x86_64.
+   Copyright (C) 2013 Free Software Foundation, Inc.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GCC; see the file COPYING3.  If not see
+<http://www.gnu.org/licenses/>.  */
+
+#undef REAL_PIC_OFFSET_TABLE_REGNUM
+#define REAL_PIC_OFFSET_TABLE_REGNUM  R15_REG
+
+#undef DEFAULT_LARGE_SECTION_THRESHOLD
+#define DEFAULT_LARGE_SECTION_THRESHOLD 16
Index: config.gcc
===================================================================
--- config.gcc	(revision 195515)
+++ config.gcc	(working copy)
@@ -738,6 +738,9 @@ case ${target} in
   use_gcc_stdint=wrap
   tm_defines="$tm_defines DEFAULT_LIBC=LIBC_UCLIBC SINGLE_LIBC"
   ;;
+*-*-rdos*)
+  use_gcc_stdint=wrap
+  ;;
 *-*-solaris2*)
   # i?86-*-solaris2* needs to insert headers between cpu default and
   # Solaris 2 specific ones.
@@ -1204,6 +1207,13 @@ i[34567]86-*-elf*)
 x86_64-*-elf*)
 	tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h newlib-stdint.h i386/i386elf.h i386/x86-64.h"
 	;;
+i[34567]86-*-rdos*)
+    tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h newlib-stdint.h i386/i386elf.h i386/rdos.h"
+    ;;
+x86_64-*-rdos*)
+    tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h newlib-stdint.h i386/i386elf.h i386/x86-64.h i386/rdos.h i386/rdos64.h"
+    tmake_file="i386/t-i386elf t-svr4"
+    ;;
 i[34567]86-*-freebsd*)
 	tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h ${fbsd_tm_file} i386/freebsd.h"
 	;;

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] Adding target rdos to GCC
  2013-01-28 20:45                   ` Uros Bizjak
@ 2013-01-28 21:44                     ` Leif Ekblad
  2013-05-13 19:03                     ` Using GS for TLS on x86-64 for target RDOS Leif Ekblad
  1 sibling, 0 replies; 16+ messages in thread
From: Leif Ekblad @ 2013-01-28 21:44 UTC (permalink / raw)
  To: Uros Bizjak; +Cc: Richard Biener, gcc-patches, H.J. Lu, Jakub Jelinek

That looks good. Thanks, Uros.

Leif


----- Original Message ----- 
From: "Uros Bizjak" <ubizjak@gmail.com>
To: "Leif Ekblad" <leif@rdos.net>
Cc: "Richard Biener" <rguenther@suse.de>; <gcc-patches@gcc.gnu.org>; "H.J. 
Lu" <hjl.tools@gmail.com>; "Jakub Jelinek" <jakub@redhat.com>
Sent: Monday, January 28, 2013 9:45 PM
Subject: Re: [PATCH] Adding target rdos to GCC


> On Mon, Jan 28, 2013 at 9:14 PM, Leif Ekblad <leif@rdos.net> wrote:
>
>>>> That is intentional. The gthr-rdos.h file is part of libgcc. My 
>>>> intention
>>>> was to first patch gcc, then update the patches for newlib, and finally
>>>> libgcc. The gthr-rdos.h file would reference include-files part of
>>>> newlib,
>>>> so this is kind of circular. I also cannot define the thread model for
>>>> RDOS
>>>> unless I define this file.
>>>>
>>>> I see a couple of possible solutions:
>>>> 1. Keep as is. You cannot build libgcc at the current stage anyway, and
>>>> the
>>>> bootstrap must be built without threading
>>>> 2. Add an empty gthr-rdos.h file until libgcc is done
>>>> 3. Remove the threading-model for now, and add it with libgcc instead.
>>>
>>>
>>> I propose option 3.
>>>
>>> Is it enough to remove gthr.m4 change from the patch in this case?
>>
>> Yes, for all practical purposes. There is a reference to thread-file in
>> config.gcc, when threading is enabled, which doesn't work for 
>> bootstrapping
>> the compiler anyway.
>
> Thanks for pointing it, I have also removed this reference.
>
> Attached is the patch that has been committed to SVN. I have added
> missing licence headers to new files and clean whitespace a bit.
>
> 2013-01-28  Leif Ekblad  <leif@rdos.net>
>
> * config.gcc (i[34567]86-*-rdos*, x86_64-*-rdos*): New targets.
> * config/i386/i386.h (TARGET_RDOS): New macro.
> (DEFAULT_LARGE_SECTION_THRESHOLD): New macro.
> * config/i386/i386.c (ix86_option_override_internal): For 64bit
> TARGET_RDOS, set ix86_cmodel to CM_MEDIUM_PIC and flag_pic to 1.
> * config/i386/i386.opt (mlarge-data-threshold): Initialize to
> DEFAULT_LARGE_SECTION_THRESHOLD.
> * config/i386/i386.md (R14_REG, R15_REG): New constants.
> * config/i386/rdos.h: New file.
> * config/i386/rdos64.h: New file.
>
> Thanks,
> Uros.
> 

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Using GS for TLS on x86-64 for target RDOS
  2013-01-28 20:45                   ` Uros Bizjak
  2013-01-28 21:44                     ` Leif Ekblad
@ 2013-05-13 19:03                     ` Leif Ekblad
  1 sibling, 0 replies; 16+ messages in thread
From: Leif Ekblad @ 2013-05-13 19:03 UTC (permalink / raw)
  To: gcc-patches

I would need a way to use GS segment register instead of FS for x86-64 for 
target RDOS since RDOS cannot use FS for TLS. It seems like the code related 
to this is concentrated to two different places:

The gcc/config/i386/i386.c:
11677:                seg = TARGET_64BIT ? SEG_FS : SEG_GS;
13526:  if (ix86_decompose_address (x, &addr) == 0
      || addr.seg != (TARGET_64BIT ? SEG_FS : SEG_GS)
      || addr.disp == NULL_RTX
      || GET_CODE (addr.disp) != CONST)

Especially the second reference would become hard-to-read if more 
conditionals are added to it.

Perhaps the code could be changed to something like this:

#ifdef TARGET_RDOS
#define GET_TLS_SEG_REG  SEG_GS
#else
#define GET_TLS_SEG_REG TARGET_64BIT ? SEG_FS : SEG_GS
#endif

Then the above could be patched to:
11677:                seg = GET_TLS_SEG_REG;
13526:  if (ix86_decompose_address (x, &addr) == 0
      || addr.seg != (GET_TLS_SEG_REG)
      || addr.disp == NULL_RTX
      || GET_CODE (addr.disp) != CONST)

Thoughts?

Regards,
Leif Ekblad

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] Adding target rdos to GCC
  2013-01-04 22:32 ` H.J. Lu
@ 2013-01-06 17:08   ` Leif Ekblad
  0 siblings, 0 replies; 16+ messages in thread
From: Leif Ekblad @ 2013-01-06 17:08 UTC (permalink / raw)
  To: H.J. Lu; +Cc: GCC Patches

[-- Attachment #1: Type: text/plain, Size: 2130 bytes --]

Updated patches with the suggestions below, except that the initial value is 
0
(which is not meaningful). I also added a setting in rdos target file to use 
r15
for PIC instead of rbx.

New change log:
* config/gthr.m4: Added rdos thread header.
* gcc/config/i386/i386.c: Provided a way to define a default setting for 
medium memory model and PIC. Provided a way to define a default value for 
large-data-threshold.
* gcc/config/i386/i386.h: Defined default value for medium memory model & 
PIC. Defined default value for large-data-threshold.
* gcc/config/i386/i386.md: Added r14 and r15 register names.
* gcc/config/i386/i386.opt: Changed initial value for large-data-threshold 
to 0 to allow detection of modification.
* gcc/config/i386/rdos.h: Added new file for rdos target definition.
* gcc/config.gcc: Added rdos target

Tested for target rdos and rdos32.

Regards,
Leif Ekblad


----- Original Message ----- 
From: "H.J. Lu" <hjl.tools@gmail.com>
To: "Leif Ekblad" <leif@rdos.net>
Cc: "GCC Patches" <gcc-patches@gcc.gnu.org>
Sent: Friday, January 04, 2013 11:32 PM
Subject: Re: [PATCH] Adding target rdos to GCC


> On Fri, Jan 4, 2013 at 2:22 PM, Leif Ekblad <leif@rdos.net> wrote:
>> Change log:
>> * config/gthr.m4: Added rdos thread header.
>> * gcc/config/i386/i386.c: Provided a way to define a default setting for
>> medium memory model and PIC. Provided a way to define a default value for
>> large-data-threshold.
>> * gcc/config/i386/i386.h: Defined default value for medium memory model &
>> PIC.
>> * gcc/config/i386/rdos.h: Added new file for rdos target definition.
>> * gcc/config.gcc: Added rdos target
>>
>> The change to gthr.m4 requires rebuilding the configure scripts.
>>
>> Tested with target rdos and rdos32. Is this ok for trunk?
>>
>> Regards,
>> Leif Ekblad
>
> + #ifdef TARGET_SECTION_THRESHOLD
> +   ix86_section_threshold = TARGET_SECTION_THRESHOLD;
> + #endif
>
> You should
>
> 1. Add DEFAULT_SECTION_THRESHOLD and set it to
> 65536.
> 2. Change the init value of  ix86_section_threshold to -1.
> 3. Set ix86_section_threshold to DEFAULT_SECTION_THRESHOLD
> if it is -1.
>
>
> -- 
> H.J. 

[-- Attachment #2: gcc.diff --]
[-- Type: application/octet-stream, Size: 6038 bytes --]

diff -crN gcc-4.8-20121230/config/gthr.m4 gcc-work/config/gthr.m4
*** gcc-4.8-20121230/config/gthr.m4	Mon Oct 15 15:10:30 2012
--- gcc-work/config/gthr.m4	Fri Jan  4 21:08:46 2013
***************
*** 21,26 ****
--- 21,27 ----
      tpf)	thread_header=config/s390/gthr-tpf.h ;;
      vxworks)	thread_header=config/gthr-vxworks.h ;;
      win32)	thread_header=config/i386/gthr-win32.h ;;
+     rdos)	thread_header=config/i386/gthr-rdos.h ;;
  esac
  AC_SUBST(thread_header)
  ])
diff -crN gcc-4.8-20121230/gcc/config/i386/i386.c gcc-work/gcc/config/i386/i386.c
*** gcc-4.8-20121230/gcc/config/i386/i386.c	Thu Dec 27 02:58:06 2012
--- gcc-work/gcc/config/i386/i386.c	Sun Jan  6 14:10:34 2013
***************
*** 3239,3244 ****
--- 3239,3246 ----
  	 DLL, and is essentially just as efficient as direct addressing.  */
        if (TARGET_64BIT && DEFAULT_ABI == MS_ABI)
  	ix86_cmodel = CM_SMALL_PIC, flag_pic = 1;
+       else if (TARGET_64BIT && TARGET_MEDIUM_PIC)
+     ix86_cmodel = CM_MEDIUM_PIC, flag_pic = 1;
        else if (TARGET_64BIT)
  	ix86_cmodel = flag_pic ? CM_SMALL_PIC : CM_SMALL;
        else
***************
*** 3919,3924 ****
--- 3921,3929 ----
        && !(target_flags_explicit & MASK_LONG_DOUBLE_64))
      target_flags |= MASK_LONG_DOUBLE_64;
  
+   if (ix86_section_threshold == 0)
+     ix86_section_threshold = DEFAULT_SECTION_THRESHOLD;
+ 
    /* Save the initial options in case the user does function specific
       options.  */
    if (main_args_p)
diff -crN gcc-4.8-20121230/gcc/config/i386/i386.h gcc-work/gcc/config/i386/i386.h
*** gcc-4.8-20121230/gcc/config/i386/i386.h	Wed Dec 19 17:04:12 2012
--- gcc-work/gcc/config/i386/i386.h	Sun Jan  6 13:24:26 2013
***************
*** 86,91 ****
--- 86,93 ----
  #define TARGET_LP64	TARGET_ABI_64
  #define TARGET_X32	TARGET_ABI_X32
  
+ #define TARGET_MEDIUM_PIC   0
+ 
  /* SSE4.1 defines round instructions */
  #define	OPTION_MASK_ISA_ROUND	OPTION_MASK_ISA_SSE4_1
  #define	TARGET_ISA_ROUND	((ix86_isa_flags & OPTION_MASK_ISA_ROUND) != 0)
***************
*** 790,795 ****
--- 792,801 ----
     it is the part of the ABI.  We shouldn't change it with -mavx.  */
  #define ATTRIBUTE_ALIGNED_VALUE 128
  
+ /* Default threshold for putting data in large sections with x86-64
+    medium memory model */
+ #define DEFAULT_SECTION_THRESHOLD 65536
+ 
  /* Decide whether a variable of mode MODE should be 128 bit aligned.  */
  #define ALIGN_MODE_128(MODE) \
   ((MODE) == XFmode || SSE_REG_MODE_P (MODE))
diff -crN gcc-4.8-20121230/gcc/config/i386/i386.md gcc-work/gcc/config/i386/i386.md
*** gcc-4.8-20121230/gcc/config/i386/i386.md	Wed Dec 19 17:04:12 2012
--- gcc-work/gcc/config/i386/i386.md	Sun Jan  6 13:17:36 2013
***************
*** 301,306 ****
--- 301,308 ----
     (R11_REG			40)
     (R12_REG			41)
     (R13_REG			42)
+    (R14_REG			43)
+    (R15_REG			44)
     (XMM8_REG			45)
     (XMM9_REG			46)
     (XMM10_REG			47)
diff -crN gcc-4.8-20121230/gcc/config/i386/i386.opt gcc-work/gcc/config/i386/i386.opt
*** gcc-4.8-20121230/gcc/config/i386/i386.opt	Fri Nov 16 08:17:30 2012
--- gcc-work/gcc/config/i386/i386.opt	Sun Jan  6 14:09:06 2013
***************
*** 141,147 ****
  Branches are this expensive (1-5, arbitrary units)
  
  mlarge-data-threshold=
! Target RejectNegative Joined UInteger Var(ix86_section_threshold) Init(65536)
  Data greater than given threshold will go into .ldata section in x86-64 medium model
  
  mcmodel=
--- 141,147 ----
  Branches are this expensive (1-5, arbitrary units)
  
  mlarge-data-threshold=
! Target RejectNegative Joined UInteger Var(ix86_section_threshold) Init(0)
  Data greater than given threshold will go into .ldata section in x86-64 medium model
  
  mcmodel=
diff -crN gcc-4.8-20121230/gcc/config/i386/rdos.h gcc-work/gcc/config/i386/rdos.h
*** gcc-4.8-20121230/gcc/config/i386/rdos.h	Thu Jan  1 01:00:00 1970
--- gcc-work/gcc/config/i386/rdos.h	Sun Jan  6 13:20:12 2013
***************
*** 0 ****
--- 1,22 ----
+ 
+ /* RDOS uses .exe suffix */
+ #undef TARGET_EXECUTABLE_SUFFIX
+ #define TARGET_EXECUTABLE_SUFFIX ".exe"
+ 
+ #undef REAL_PIC_OFFSET_TABLE_REGNUM
+ #define REAL_PIC_OFFSET_TABLE_REGNUM  R15_REG
+ 
+ #undef TARGET_MEDIUM_PIC
+ #define TARGET_MEDIUM_PIC           1
+ #define DEFAULT_SECTION_THRESHOLD    0x10
+ 
+ #define TARGET_OS_CPP_BUILTINS()                \
+   do                                            \
+     {                                           \
+         builtin_define ("__RDOS__");            \
+         builtin_assert ("system=rdos");         \
+     }                                           \
+   while (0)
+ 
+ /* RDOS headers are C++-aware (and often use C++).  */
+ #define NO_IMPLICIT_EXTERN_C
diff -crN gcc-4.8-20121230/gcc/config.gcc gcc-work/gcc/config.gcc
*** gcc-4.8-20121230/gcc/config.gcc	Thu Nov 22 00:33:40 2012
--- gcc-work/gcc/config.gcc	Fri Jan  4 21:08:46 2013
***************
*** 739,744 ****
--- 739,750 ----
    use_gcc_stdint=wrap
    tm_defines="$tm_defines DEFAULT_LIBC=LIBC_UCLIBC SINGLE_LIBC"
    ;;
+ *-*-rdos*)
+   case ${enable_threads} in
+     "" | yes | rdos) thread_file='rdos' ;;
+   esac
+   use_gcc_stdint=wrap
+   ;;
  *-*-solaris2*)
    # i?86-*-solaris2* needs to insert headers between cpu default and
    # Solaris 2 specific ones.
***************
*** 1205,1210 ****
--- 1211,1223 ----
  x86_64-*-elf*)
  	tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h newlib-stdint.h i386/i386elf.h i386/x86-64.h"
  	;;
+ i[34567]86-*-rdos*)
+     tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h newlib-stdint.h"
+     ;;
+ x86_64-*-rdos*)
+     tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h newlib-stdint.h i386/i386elf.h  i386/x86-64.h i386/rdos.h"
+     tmake_file="i386/t-i386elf t-svr4"
+     ;;
  i[34567]86-*-freebsd*)
  	tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h ${fbsd_tm_file} i386/freebsd.h"
  	;;

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] Adding target rdos to GCC
  2013-01-04 22:21 [PATCH] Adding target rdos to GCC Leif Ekblad
@ 2013-01-04 22:32 ` H.J. Lu
  2013-01-06 17:08   ` Leif Ekblad
  0 siblings, 1 reply; 16+ messages in thread
From: H.J. Lu @ 2013-01-04 22:32 UTC (permalink / raw)
  To: Leif Ekblad; +Cc: GCC Patches

On Fri, Jan 4, 2013 at 2:22 PM, Leif Ekblad <leif@rdos.net> wrote:
> Change log:
> * config/gthr.m4: Added rdos thread header.
> * gcc/config/i386/i386.c: Provided a way to define a default setting for
> medium memory model and PIC. Provided a way to define a default value for
> large-data-threshold.
> * gcc/config/i386/i386.h: Defined default value for medium memory model &
> PIC.
> * gcc/config/i386/rdos.h: Added new file for rdos target definition.
> * gcc/config.gcc: Added rdos target
>
> The change to gthr.m4 requires rebuilding the configure scripts.
>
> Tested with target rdos and rdos32. Is this ok for trunk?
>
> Regards,
> Leif Ekblad

+ #ifdef TARGET_SECTION_THRESHOLD
+   ix86_section_threshold = TARGET_SECTION_THRESHOLD;
+ #endif

You should

1. Add DEFAULT_SECTION_THRESHOLD and set it to
65536.
2. Change the init value of  ix86_section_threshold to -1.
3. Set ix86_section_threshold to DEFAULT_SECTION_THRESHOLD
if it is -1.


-- 
H.J.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH] Adding target rdos to GCC
@ 2013-01-04 22:21 Leif Ekblad
  2013-01-04 22:32 ` H.J. Lu
  0 siblings, 1 reply; 16+ messages in thread
From: Leif Ekblad @ 2013-01-04 22:21 UTC (permalink / raw)
  To: GCC Patches

[-- Attachment #1: Type: text/plain, Size: 559 bytes --]

Change log:
* config/gthr.m4: Added rdos thread header.
* gcc/config/i386/i386.c: Provided a way to define a default setting for 
medium memory model and PIC. Provided a way to define a default value for 
large-data-threshold.
* gcc/config/i386/i386.h: Defined default value for medium memory model & 
PIC.
* gcc/config/i386/rdos.h: Added new file for rdos target definition.
* gcc/config.gcc: Added rdos target

The change to gthr.m4 requires rebuilding the configure scripts.

Tested with target rdos and rdos32. Is this ok for trunk?

Regards,
Leif Ekblad

[-- Attachment #2: gcc.diff --]
[-- Type: application/octet-stream, Size: 4333 bytes --]

diff -crN gcc-4.8-20121230/config/gthr.m4 gcc-work/config/gthr.m4
*** gcc-4.8-20121230/config/gthr.m4	2012-10-15 15:10:30.000000000 +0200
--- gcc-work/config/gthr.m4	2013-01-03 08:30:36.152649600 +0100
***************
*** 21,26 ****
--- 21,27 ----
      tpf)	thread_header=config/s390/gthr-tpf.h ;;
      vxworks)	thread_header=config/gthr-vxworks.h ;;
      win32)	thread_header=config/i386/gthr-win32.h ;;
+     rdos)	thread_header=config/i386/gthr-rdos.h ;;
  esac
  AC_SUBST(thread_header)
  ])
diff -crN gcc-4.8-20121230/gcc/config/i386/i386.c gcc-work/gcc/config/i386/i386.c
*** gcc-4.8-20121230/gcc/config/i386/i386.c	2012-12-27 02:58:06.000000000 +0100
--- gcc-work/gcc/config/i386/i386.c	2013-01-04 13:39:39.746426400 +0100
***************
*** 3239,3244 ****
--- 3239,3246 ----
  	 DLL, and is essentially just as efficient as direct addressing.  */
        if (TARGET_64BIT && DEFAULT_ABI == MS_ABI)
  	ix86_cmodel = CM_SMALL_PIC, flag_pic = 1;
+       else if (TARGET_64BIT && TARGET_MEDIUM_PIC)
+     ix86_cmodel = CM_MEDIUM_PIC, flag_pic = 1;
        else if (TARGET_64BIT)
  	ix86_cmodel = flag_pic ? CM_SMALL_PIC : CM_SMALL;
        else
***************
*** 3919,3924 ****
--- 3921,3930 ----
        && !(target_flags_explicit & MASK_LONG_DOUBLE_64))
      target_flags |= MASK_LONG_DOUBLE_64;
  
+ #ifdef TARGET_SECTION_THRESHOLD
+   ix86_section_threshold = TARGET_SECTION_THRESHOLD;
+ #endif
+ 
    /* Save the initial options in case the user does function specific
       options.  */
    if (main_args_p)
diff -crN gcc-4.8-20121230/gcc/config/i386/i386.h gcc-work/gcc/config/i386/i386.h
*** gcc-4.8-20121230/gcc/config/i386/i386.h	2012-12-19 17:04:11.000000000 +0100
--- gcc-work/gcc/config/i386/i386.h	2013-01-03 08:30:36.175651900 +0100
***************
*** 86,91 ****
--- 86,93 ----
  #define TARGET_LP64	TARGET_ABI_64
  #define TARGET_X32	TARGET_ABI_X32
  
+ #define TARGET_MEDIUM_PIC   0
+ 
  /* SSE4.1 defines round instructions */
  #define	OPTION_MASK_ISA_ROUND	OPTION_MASK_ISA_SSE4_1
  #define	TARGET_ISA_ROUND	((ix86_isa_flags & OPTION_MASK_ISA_ROUND) != 0)
diff -crN gcc-4.8-20121230/gcc/config/i386/rdos.h gcc-work/gcc/config/i386/rdos.h
*** gcc-4.8-20121230/gcc/config/i386/rdos.h	1970-01-01 01:00:00.000000000 +0100
--- gcc-work/gcc/config/i386/rdos.h	2013-01-04 13:41:21.409591700 +0100
***************
*** 0 ****
--- 1,19 ----
+ 
+ /* RDOS uses .exe suffix */
+ #undef TARGET_EXECUTABLE_SUFFIX
+ #define TARGET_EXECUTABLE_SUFFIX ".exe"
+ 
+ #undef TARGET_MEDIUM_PIC
+ #define TARGET_MEDIUM_PIC           1
+ #define TARGET_SECTION_THRESHOLD    0x10
+ 
+ #define TARGET_OS_CPP_BUILTINS()                \
+   do                                            \
+     {                                           \
+         builtin_define ("__RDOS__");            \
+         builtin_assert ("system=rdos");         \
+     }                                           \
+   while (0)
+ 
+ /* RDOS headers are C++-aware (and often use C++).  */
+ #define NO_IMPLICIT_EXTERN_C
diff -crN gcc-4.8-20121230/gcc/config.gcc gcc-work/gcc/config.gcc
*** gcc-4.8-20121230/gcc/config.gcc	2012-11-22 00:33:40.000000000 +0100
--- gcc-work/gcc/config.gcc	2013-01-04 14:43:38.598930800 +0100
***************
*** 739,744 ****
--- 739,750 ----
    use_gcc_stdint=wrap
    tm_defines="$tm_defines DEFAULT_LIBC=LIBC_UCLIBC SINGLE_LIBC"
    ;;
+ *-*-rdos*)
+   case ${enable_threads} in
+     "" | yes | rdos) thread_file='rdos' ;;
+   esac
+   use_gcc_stdint=wrap
+   ;;
  *-*-solaris2*)
    # i?86-*-solaris2* needs to insert headers between cpu default and
    # Solaris 2 specific ones.
***************
*** 1205,1210 ****
--- 1211,1223 ----
  x86_64-*-elf*)
  	tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h newlib-stdint.h i386/i386elf.h i386/x86-64.h"
  	;;
+ i[34567]86-*-rdos*)
+     tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h newlib-stdint.h"
+     ;;
+ x86_64-*-rdos*)
+     tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h newlib-stdint.h i386/i386elf.h  i386/x86-64.h i386/rdos.h"
+     tmake_file="i386/t-i386elf t-svr4"
+     ;;
  i[34567]86-*-freebsd*)
  	tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h ${fbsd_tm_file} i386/freebsd.h"
  	;;

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2013-05-13 19:03 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-06 20:32 [PATCH] Adding target rdos to GCC Uros Bizjak
2013-01-07 22:13 ` Leif Ekblad
2013-01-08 20:32   ` Leif Ekblad
2013-01-09  6:58     ` Uros Bizjak
2013-01-09  8:38       ` Richard Biener
2013-01-28  6:51         ` Leif Ekblad
2013-01-28  7:23           ` Uros Bizjak
2013-01-28 19:58             ` Leif Ekblad
2013-01-28 20:03               ` Uros Bizjak
2013-01-28 20:14                 ` Leif Ekblad
2013-01-28 20:45                   ` Uros Bizjak
2013-01-28 21:44                     ` Leif Ekblad
2013-05-13 19:03                     ` Using GS for TLS on x86-64 for target RDOS Leif Ekblad
  -- strict thread matches above, loose matches on Subject: below --
2013-01-04 22:21 [PATCH] Adding target rdos to GCC Leif Ekblad
2013-01-04 22:32 ` H.J. Lu
2013-01-06 17:08   ` Leif Ekblad

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).