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" To: "Uros Bizjak" ; Cc: "H.J. Lu" 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" > To: > Cc: "Leif Ekblad" ; "H.J. Lu" > 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. >> >