Message ID | CAFULd4ad2fAQ3YhLVEWmuA8kBnrh6StkHPKWZndv10h3Ecm4GQ@mail.gmail.com |
---|---|
State | New |
Headers | show |
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. >
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. >> >
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.
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.
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.
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.
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.
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.
----- 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
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 /* 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=