On Mon, Jan 28, 2013 at 9:14 PM, Leif Ekblad <l...@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 <l...@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.
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 /* 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" ;;