Hi, here are some patches to create an AROS cross-compiler on i386 linux. I was able to compile and run some simple test programs on AROS hosted. gcc-core-4.2.2-adtools-aros.diff is a patch against the latest SVN revision of adtools/trunk. gcc-core-4.2.2-aros.diff was made against the gcc-core-4.2.2 release. It would be nice if somebody could help me to complete it. Right now, I cannot create a working native compiler. The compilation stops at: make[4]: *** No rule to make target `auto-build.h', needed by `build/genmodes.o'. Stop. make[3]: *** [all-gcc] Error 2 make[2]: *** [all] Error 2 Best regards, -Josef
Index: gcc/include/filenames.h =================================================================== --- gcc/include/filenames.h (Revision 148) +++ gcc/include/filenames.h (Arbeitskopie) @@ -44,7 +44,7 @@ #define FILENAME_CMP(s1, s2) strcasecmp(s1, s2) #else /* not DOSish */ -#if defined(__amigaos__) +#if defined(__amigaos__) || defined(__AROS__) #ifndef DIR_SEPARATOR_2 #define DIR_SEPARATOR_2 ':' Index: gcc/libiberty/configure.ac =================================================================== --- gcc/libiberty/configure.ac (Revision 148) +++ gcc/libiberty/configure.ac (Arbeitskopie) @@ -664,6 +664,7 @@ *-*-msdosdjgpp*) pexecute=./pex-djgpp.o ;; *-*-msdos*) pexecute=./pex-msdos.o ;; *-*-amigaos*) pexecute=./pex-amigaos.o;; + *-*-aros*) pexecute=./pex-aros.o ;; *) pexecute=./pex-unix.o ;; esac AC_SUBST(pexecute) Index: gcc/libiberty/pex-aros.c =================================================================== --- gcc/libiberty/pex-aros.c (Revision 0) +++ gcc/libiberty/pex-aros.c (Revision 0) @@ -0,0 +1,70 @@ +/* Utilities to execute a program in a subprocess (possibly linked by pipes + with other subprocesses), and wait for it. OS/2 specialization. + Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003 + Free Software Foundation, Inc. + +This file is part of the libiberty library. +Libiberty is free software; you can redistribute it and/or +modify it under the terms of the GNU Library General Public +License as published by the Free Software Foundation; either +version 2 of the License, or (at your option) any later version. + +Libiberty 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 +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with libiberty; see the file COPYING.LIB. If not, +write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +Boston, MA 02111-1307, USA. */ + +#include "pex-common.h" + +#include <process.h> +#include <errno.h> + +static int __pid, __rc; + +int +pexecute (program, argv, this_pname, temp_base, errmsg_fmt, errmsg_arg, flags) + const char *program; + char * const *argv; + const char *this_pname; + const char *temp_base; + char **errmsg_fmt, **errmsg_arg; + int flags; +{ + if ((flags & PEXECUTE_ONE) != PEXECUTE_ONE) + { + *errmsg_fmt = "-pipe not supported yet."; + *errmsg_arg = NULL; + return -1; + } + + __rc = ((flags & PEXECUTE_SEARCH) ? spawnvp : spawnv) (P_WAIT, program, argv); + if (__rc == -1) + { + *errmsg_fmt = install_error_msg; + *errmsg_arg = program; + return -1; + } + + return (__pid <= 0) ? __pid = 100 : ++__pid; +} + +int +pwait (pid, status, flags) + int pid; + int *status; + int flags; +{ + if (pid != __pid) + { + errno = EINVAL; + return -1; + } + + *status = (__rc & 0xFF) << 8; + return __pid; +} Index: gcc/libiberty/Makefile.in =================================================================== --- gcc/libiberty/Makefile.in (Revision 148) +++ gcc/libiberty/Makefile.in (Arbeitskopie) @@ -146,7 +146,7 @@ partition.c pexecute.c \ pex-common.c pex-djgpp.c pex-msdos.c pex-one.c \ pex-unix.c pex-win32.c \ - pex-amigaos.c \ + pex-amigaos.c pex-aros.c \ physmem.c putenv.c \ random.c regex.c rename.c rindex.c \ safe-ctype.c setenv.c sigsetmask.c snprintf.c sort.c spaces.c \ @@ -194,7 +194,7 @@ ./index.o ./insque.o \ ./memchr.o ./memcmp.o ./memcpy.o ./memmove.o ./mempcpy.o \ ./memset.o ./mkstemps.o \ - ./pex-amigaos.o \ + ./pex-amigaos.o ./pex-aros.o \ ./pex-djgpp.o ./pex-msdos.o \ ./pex-unix.o ./pex-win32.o \ ./putenv.o \ @@ -873,7 +873,7 @@ $(COMPILE.c) $(PICFLAG) $(srcdir)/pex-win32.c -o pic/$@; \ else true; fi $(COMPILE.c) $(srcdir)/pex-win32.c $(OUTPUT_OPTION) - + ./pex-amigaos.o: $(srcdir)/pex-amigaos.c config.h $(INCDIR)/ansidecl.h \ $(INCDIR)/libiberty.h $(srcdir)/pex-common.h if [ x"$(PICFLAG)" != x ]; then \ @@ -881,6 +881,13 @@ else true; fi $(COMPILE.c) $(srcdir)/pex-amigaos.c $(OUTPUT_OPTION) +./pex-aros.o: $(srcdir)/pex-aros.c config.h $(INCDIR)/ansidecl.h \ + $(INCDIR)/libiberty.h $(srcdir)/pex-common.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/pex-aros.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/pex-aros.c $(OUTPUT_OPTION) + ./pexecute.o: $(srcdir)/pexecute.c config.h $(INCDIR)/ansidecl.h \ $(INCDIR)/libiberty.h if [ x"$(PICFLAG)" != x ]; then \ Index: gcc/configure.in =================================================================== --- gcc/configure.in (Revision 148) +++ gcc/configure.in (Arbeitskopie) @@ -296,6 +296,9 @@ powerpc-*-beos*) noconfigdirs="$noconfigdirs tk itcl libgui gdb dejagnu readline" ;; + *-*-aros*) + noconfigdirs="$noconfigdirs patch diff make tk tcl expect dejagnu autoconf automake texinfo bison send-pr gprof rcs guile perl itcl tix gnuserv gdb" + ;; esac @@ -977,6 +980,8 @@ # Build the stage2 and stage3 compilers with -fomit-frame-pointer. host_makefile_frag="config/mh-x86omitfp" ;; + *-*-aros*) + ;; esac fi Index: gcc/gcc/config.gcc =================================================================== --- gcc/gcc/config.gcc (Revision 148) +++ gcc/gcc/config.gcc (Arbeitskopie) @@ -362,6 +362,13 @@ # Common parts for widely ported systems. case ${target} in +*-*-aros*) + # AROS will always use ELF and the GNU tools. + elf=yes + gas=yes + gnu_ld=yes + thread_file=single + ;; *-*-darwin*) tm_file="${tm_file} darwin.h" case ${target} in @@ -1106,6 +1113,9 @@ esac tmake_file="${tmake_file} i386/t-linux64 i386/t-crtfm t-dfprules" ;; +i[34567]86-*-aros*) + tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h svr4.h aros.h i386/aros.h" + ;; i[34567]86-*-gnu*) ;; i[34567]86-pc-msdosdjgpp*) Index: gcc/gcc/config.host =================================================================== --- gcc/gcc/config.host (Revision 148) +++ gcc/gcc/config.host (Arbeitskopie) @@ -214,4 +214,7 @@ out_host_hook_obj=host-hpux.o host_xmake_file="${host_xmake_file} x-hpux" ;; + *-*-aros*) + host_can_use_collect2=no + ;; esac Index: gcc/gcc/c-incpath.c =================================================================== --- gcc/gcc/c-incpath.c (Revision 148) +++ gcc/gcc/c-incpath.c (Arbeitskopie) @@ -38,7 +38,7 @@ # define INO_T_EQ(A, B) (!memcmp (&(A), &(B), sizeof (A))) # define INO_T_COPY(DEST, SRC) memcpy(&(DEST), &(SRC), sizeof (SRC)) #else -# if (defined _WIN32 && !defined (_UWIN)) || defined __MSDOS__ || defined __amigaos__ +# if (defined _WIN32 && !defined (_UWIN)) || defined __MSDOS__ || defined __AROS__ || defined __amigaos__ # define INO_T_EQ(A, B) 0 # else # define INO_T_EQ(A, B) ((A) == (B)) Index: gcc/gcc/config/aros.h =================================================================== --- gcc/gcc/config/aros.h (Revision 0) +++ gcc/gcc/config/aros.h (Revision 0) @@ -0,0 +1,96 @@ +/* Definitions for AROS + Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc. + Contributed by Fabio Alemagna + Based upon linux.h, contributed by Eric Youngdale. + +This file is part of GNU CC. + +GNU CC 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 2, or (at your option) +any later version. + +GNU CC 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 GNU CC; see the file COPYING. If not, write to +the Free Software Foundation, 59 Temple Place - Suite 330, +Boston, MA 02111-1307, USA. */ + +/* Don't assume anything about the header files. */ +#define NO_IMPLICIT_EXTERN_C + +/* AROS uses ctype from libc.a. I am not sure how complete it is. + For now, we play safe. It may change later. */ + +#if 0 +#undef MULTIBYTE_CHARS +#define MULTIBYTE_CHARS 1 +#endif + +#define TARGET_OS_CPP_BUILTINS() \ + do \ + { \ + builtin_define_std ("unix"); \ + builtin_define_std ("AROS"); \ + builtin_define ("__ELF__"); \ + builtin_assert ("system=posix"); \ + if (flag_pic) \ + { \ + builtin_define ("__PIC__"); \ + builtin_define ("__pic__"); \ + } \ + } \ + while (0) + +#undef ASM_APP_ON +#define ASM_APP_ON "#APP\n" + +#undef ASM_APP_OFF +#define ASM_APP_OFF "#NO_APP\n" + +#undef MD_EXEC_PREFIX +#undef MD_STARTFILE_PREFIX + +/* Provide a STARTFILE_SPEC appropriate for AROS. AROS has its own + set of startup files which also take care of handling C++ + constructors/destructors. */ + +#undef STARTFILE_SPEC +#define STARTFILE_SPEC \ + "%{detach:detach.o%s} startup.o%s %{nix:nixmain.o%s}" + +/* Provide a ENDFILE_SPEC appropriate for AROS. */ + +#undef ENDFILE_SPEC +#define ENDFILE_SPEC \ + "-lautoinit" + +/* This is for -profile to use -lc_p instead of -lc. */ +#ifndef CC1_SPEC +#define CC1_SPEC "%{profile:-p}" +#endif + +/* The GNU C++ standard library requires that these macros be defined. */ +#undef CPLUSPLUS_CPP_SPEC +#define CPLUSPLUS_CPP_SPEC "-D_GNU_SOURCE %(cpp)" + +#undef LIB_SPEC +#define LIB_SPEC \ + "-lamiga -larossupport -larosc -lm" + +#if !defined(USE_GNULIBC_1) && defined(HAVE_LD_EH_FRAME_HDR) +#define LINK_EH_SPEC "%{!static:--eh-frame-hdr} " +#endif + +/* AROS uses its own collect-like program for the moment. */ +#undef LINKER_NAME +#define LINKER_NAME "collect-aros" + +/* Define this so we can compile MS code for use with WINE. */ +#define HANDLE_PRAGMA_PACK_PUSH_POP + +#define TARGET_HAS_F_SETLKW Index: gcc/gcc/config/i386/aros.h =================================================================== --- gcc/gcc/config/i386/aros.h (Revision 0) +++ gcc/gcc/config/i386/aros.h (Revision 0) @@ -0,0 +1,120 @@ +/* Definitions for Intel 386 running AROS systems with ELF format. + Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2001, 2002 + Free Software Foundation, Inc. + Contributed by Fabio Alemagna. + Based upon i386/linux.h by Eric Youngdale. + +This file is part of GNU CC. + +GNU CC 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 2, or (at your option) +any later version. + +GNU CC 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 GNU CC; see the file COPYING. If not, write to +the Free Software Foundation, 59 Temple Place - Suite 330, +Boston, MA 02111-1307, USA. */ + +/* Output at beginning of assembler file. */ +/* The .file command should always begin the output. */ +#undef TARGET_ASM_FILE_START_FILE_DIRECTIVE +#define TARGET_ASM_FILE_START_FILE_DIRECTIVE true + +#define TARGET_VERSION fprintf (stderr, " (i386 AROS/ELF)"); + +/* The svr4 ABI for the i386 says that records and unions are returned + in memory. */ +#undef DEFAULT_PCC_STRUCT_RETURN +#define DEFAULT_PCC_STRUCT_RETURN 1 + +#undef ASM_COMMENT_START +#define ASM_COMMENT_START "#" + +#undef DBX_REGISTER_NUMBER +#define DBX_REGISTER_NUMBER(n) \ + (TARGET_64BIT ? dbx64_register_map[n] : svr4_dbx_register_map[n]) + +/* Output assembler code to FILE to call the profiler. + To the best of my knowledge, no Linux libc has required the label + argument to mcount. */ + +#define NO_PROFILE_COUNTERS 1 + +#undef MCOUNT_NAME +#define MCOUNT_NAME "mcount" + +/* The GLIBC version of mcount for the x86 assumes that there is a + frame, so we cannot allow profiling without a frame pointer. */ + +#undef SUBTARGET_FRAME_POINTER_REQUIRED +#define SUBTARGET_FRAME_POINTER_REQUIRED current_function_profile + +#undef SIZE_TYPE +#define SIZE_TYPE "unsigned int" + +#undef PTRDIFF_TYPE +#define PTRDIFF_TYPE "int" + +#undef WCHAR_TYPE +#define WCHAR_TYPE "long int" + +#undef WCHAR_TYPE_SIZE +#define WCHAR_TYPE_SIZE BITS_PER_WORD + +#undef CPP_SPEC +#define CPP_SPEC "%{posix:-D_POSIX_SOURCE} %{pthread:-D_REENTRANT}" + +#undef CC1_SPEC +#define CC1_SPEC "%(cc1_cpu) %{profile:-p}" + +/* Provide a LINK_SPEC appropriate for AROS. */ + +#undef LINK_SPEC +#define LINK_SPEC "-m elf_i386" + +/* A C statement (sans semicolon) to output to the stdio stream + FILE the assembler definition of uninitialized global DECL named + NAME whose size is SIZE bytes and alignment is ALIGN bytes. + Try to use asm_output_aligned_bss to implement this macro. */ + +#define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \ + asm_output_aligned_bss (FILE, DECL, NAME, SIZE, ALIGN) + +/* A C statement to output to the stdio stream FILE an assembler + command to advance the location counter to a multiple of 1<<LOG + bytes if it is within MAX_SKIP bytes. + + This is used to align code labels according to Intel recommendations. */ + +#ifdef HAVE_GAS_MAX_SKIP_P2ALIGN +#define ASM_OUTPUT_MAX_SKIP_ALIGN(FILE,LOG,MAX_SKIP) \ + do { \ + if ((LOG) != 0) { \ + if ((MAX_SKIP) == 0) fprintf ((FILE), "\t.p2align %d\n", (LOG)); \ + else fprintf ((FILE), "\t.p2align %d,,%d\n", (LOG), (MAX_SKIP)); \ + } \ + } while (0) +#endif + +/* Handle special EH pointer encodings. Absolute, pc-relative, and + indirect are handled automatically. */ +#define ASM_MAYBE_OUTPUT_ENCODED_ADDR_RTX(FILE, ENCODING, SIZE, ADDR, DONE) \ + do { \ + if ((SIZE) == 4 && ((ENCODING) & 0x70) == DW_EH_PE_datarel) \ + { \ + fputs (ASM_LONG, FILE); \ + assemble_name (FILE, XSTR (ADDR, 0)); \ + fputs (((ENCODING) & DW_EH_PE_indirect ? "@GOT" : "@GOTOFF"), FILE); \ + goto DONE; \ + } \ + } while (0) + + +/* FIXME: AROS doesn't support dw2 unwinding yet. */ +#undef MD_FALLBACK_FRAME_STATE_FOR Index: gcc/fixincludes/configure =================================================================== --- gcc/fixincludes/configure (Revision 148) +++ gcc/fixincludes/configure (Arbeitskopie) @@ -2564,6 +2564,7 @@ i?86-*-msdosdjgpp* | \ i?86-*-mingw32* | \ *-*-amigaos* | \ + *-*-aros* | \ *-*-beos* ) TARGET=twoprocess ;; Index: gcc/fixincludes/configure.ac =================================================================== --- gcc/fixincludes/configure.ac (Revision 148) +++ gcc/fixincludes/configure.ac (Arbeitskopie) @@ -50,6 +50,7 @@ i?86-*-msdosdjgpp* | \ i?86-*-mingw32* | \ *-*-amigaos* | \ + *-*-aros* | \ *-*-beos* ) TARGET=twoprocess ;;
Index: gcc-4.2.2/gcc/config.gcc =================================================================== --- gcc-4.2.2/gcc/config.gcc (Revision 129381) +++ gcc-4.2.2/gcc/config.gcc (Arbeitskopie) @@ -362,6 +362,13 @@ # Common parts for widely ported systems. case ${target} in +*-*-aros*) + # AROS will always use ELF and the GNU tools. + elf=yes + gas=yes + gnu_ld=yes + thread_file=single + ;; *-*-darwin*) tm_file="${tm_file} darwin.h" case ${target} in @@ -1106,6 +1113,9 @@ esac tmake_file="${tmake_file} i386/t-linux64 i386/t-crtfm t-dfprules" ;; +i[34567]86-*-aros*) + tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h svr4.h aros.h i386/aros.h" + ;; i[34567]86-*-gnu*) ;; i[34567]86-pc-msdosdjgpp*) Index: gcc-4.2.2/gcc/config.host =================================================================== --- gcc-4.2.2/gcc/config.host (Revision 129381) +++ gcc-4.2.2/gcc/config.host (Arbeitskopie) @@ -209,4 +209,7 @@ out_host_hook_obj=host-hpux.o host_xmake_file="${host_xmake_file} x-hpux" ;; + *-*-aros*) + host_can_use_collect2=no + ;; esac Index: gcc-4.2.2/gcc/c-incpath.c =================================================================== --- gcc-4.2.2/gcc/c-incpath.c (Revision 129381) +++ gcc-4.2.2/gcc/c-incpath.c (Arbeitskopie) @@ -38,7 +38,7 @@ # define INO_T_EQ(A, B) (!memcmp (&(A), &(B), sizeof (A))) # define INO_T_COPY(DEST, SRC) memcpy(&(DEST), &(SRC), sizeof (SRC)) #else -# if (defined _WIN32 && !defined (_UWIN)) || defined __MSDOS__ +# if (defined _WIN32 && !defined (_UWIN)) || defined __MSDOS__ || defined __AROS__ # define INO_T_EQ(A, B) 0 # else # define INO_T_EQ(A, B) ((A) == (B)) Index: gcc-4.2.2/gcc/config/aros.h =================================================================== --- gcc-4.2.2/gcc/config/aros.h (Revision 0) +++ gcc-4.2.2/gcc/config/aros.h (Revision 0) @@ -0,0 +1,96 @@ +/* Definitions for AROS + Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc. + Contributed by Fabio Alemagna + Based upon linux.h, contributed by Eric Youngdale. + +This file is part of GNU CC. + +GNU CC 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 2, or (at your option) +any later version. + +GNU CC 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 GNU CC; see the file COPYING. If not, write to +the Free Software Foundation, 59 Temple Place - Suite 330, +Boston, MA 02111-1307, USA. */ + +/* Don't assume anything about the header files. */ +#define NO_IMPLICIT_EXTERN_C + +/* AROS uses ctype from libc.a. I am not sure how complete it is. + For now, we play safe. It may change later. */ + +#if 0 +#undef MULTIBYTE_CHARS +#define MULTIBYTE_CHARS 1 +#endif + +#define TARGET_OS_CPP_BUILTINS() \ + do \ + { \ + builtin_define_std ("unix"); \ + builtin_define_std ("AROS"); \ + builtin_define ("__ELF__"); \ + builtin_assert ("system=posix"); \ + if (flag_pic) \ + { \ + builtin_define ("__PIC__"); \ + builtin_define ("__pic__"); \ + } \ + } \ + while (0) + +#undef ASM_APP_ON +#define ASM_APP_ON "#APP\n" + +#undef ASM_APP_OFF +#define ASM_APP_OFF "#NO_APP\n" + +#undef MD_EXEC_PREFIX +#undef MD_STARTFILE_PREFIX + +/* Provide a STARTFILE_SPEC appropriate for AROS. AROS has its own + set of startup files which also take care of handling C++ + constructors/destructors. */ + +#undef STARTFILE_SPEC +#define STARTFILE_SPEC \ + "%{detach:detach.o%s} startup.o%s %{nix:nixmain.o%s}" + +/* Provide a ENDFILE_SPEC appropriate for AROS. */ + +#undef ENDFILE_SPEC +#define ENDFILE_SPEC \ + "-lautoinit" + +/* This is for -profile to use -lc_p instead of -lc. */ +#ifndef CC1_SPEC +#define CC1_SPEC "%{profile:-p}" +#endif + +/* The GNU C++ standard library requires that these macros be defined. */ +#undef CPLUSPLUS_CPP_SPEC +#define CPLUSPLUS_CPP_SPEC "-D_GNU_SOURCE %(cpp)" + +#undef LIB_SPEC +#define LIB_SPEC \ + "-lamiga -larossupport -larosc -lm" + +#if !defined(USE_GNULIBC_1) && defined(HAVE_LD_EH_FRAME_HDR) +#define LINK_EH_SPEC "%{!static:--eh-frame-hdr} " +#endif + +/* AROS uses its own collect-like program for the moment. */ +#undef LINKER_NAME +#define LINKER_NAME "collect-aros" + +/* Define this so we can compile MS code for use with WINE. */ +#define HANDLE_PRAGMA_PACK_PUSH_POP + +#define TARGET_HAS_F_SETLKW Index: gcc-4.2.2/gcc/config/i386/aros.h =================================================================== --- gcc-4.2.2/gcc/config/i386/aros.h (Revision 0) +++ gcc-4.2.2/gcc/config/i386/aros.h (Revision 0) @@ -0,0 +1,120 @@ +/* Definitions for Intel 386 running AROS systems with ELF format. + Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2001, 2002 + Free Software Foundation, Inc. + Contributed by Fabio Alemagna. + Based upon i386/linux.h by Eric Youngdale. + +This file is part of GNU CC. + +GNU CC 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 2, or (at your option) +any later version. + +GNU CC 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 GNU CC; see the file COPYING. If not, write to +the Free Software Foundation, 59 Temple Place - Suite 330, +Boston, MA 02111-1307, USA. */ + +/* Output at beginning of assembler file. */ +/* The .file command should always begin the output. */ +#undef TARGET_ASM_FILE_START_FILE_DIRECTIVE +#define TARGET_ASM_FILE_START_FILE_DIRECTIVE true + +#define TARGET_VERSION fprintf (stderr, " (i386 AROS/ELF)"); + +/* The svr4 ABI for the i386 says that records and unions are returned + in memory. */ +#undef DEFAULT_PCC_STRUCT_RETURN +#define DEFAULT_PCC_STRUCT_RETURN 1 + +#undef ASM_COMMENT_START +#define ASM_COMMENT_START "#" + +#undef DBX_REGISTER_NUMBER +#define DBX_REGISTER_NUMBER(n) \ + (TARGET_64BIT ? dbx64_register_map[n] : svr4_dbx_register_map[n]) + +/* Output assembler code to FILE to call the profiler. + To the best of my knowledge, no Linux libc has required the label + argument to mcount. */ + +#define NO_PROFILE_COUNTERS 1 + +#undef MCOUNT_NAME +#define MCOUNT_NAME "mcount" + +/* The GLIBC version of mcount for the x86 assumes that there is a + frame, so we cannot allow profiling without a frame pointer. */ + +#undef SUBTARGET_FRAME_POINTER_REQUIRED +#define SUBTARGET_FRAME_POINTER_REQUIRED current_function_profile + +#undef SIZE_TYPE +#define SIZE_TYPE "unsigned int" + +#undef PTRDIFF_TYPE +#define PTRDIFF_TYPE "int" + +#undef WCHAR_TYPE +#define WCHAR_TYPE "long int" + +#undef WCHAR_TYPE_SIZE +#define WCHAR_TYPE_SIZE BITS_PER_WORD + +#undef CPP_SPEC +#define CPP_SPEC "%{posix:-D_POSIX_SOURCE} %{pthread:-D_REENTRANT}" + +#undef CC1_SPEC +#define CC1_SPEC "%(cc1_cpu) %{profile:-p}" + +/* Provide a LINK_SPEC appropriate for AROS. */ + +#undef LINK_SPEC +#define LINK_SPEC "-m elf_i386" + +/* A C statement (sans semicolon) to output to the stdio stream + FILE the assembler definition of uninitialized global DECL named + NAME whose size is SIZE bytes and alignment is ALIGN bytes. + Try to use asm_output_aligned_bss to implement this macro. */ + +#define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \ + asm_output_aligned_bss (FILE, DECL, NAME, SIZE, ALIGN) + +/* A C statement to output to the stdio stream FILE an assembler + command to advance the location counter to a multiple of 1<<LOG + bytes if it is within MAX_SKIP bytes. + + This is used to align code labels according to Intel recommendations. */ + +#ifdef HAVE_GAS_MAX_SKIP_P2ALIGN +#define ASM_OUTPUT_MAX_SKIP_ALIGN(FILE,LOG,MAX_SKIP) \ + do { \ + if ((LOG) != 0) { \ + if ((MAX_SKIP) == 0) fprintf ((FILE), "\t.p2align %d\n", (LOG)); \ + else fprintf ((FILE), "\t.p2align %d,,%d\n", (LOG), (MAX_SKIP)); \ + } \ + } while (0) +#endif + +/* Handle special EH pointer encodings. Absolute, pc-relative, and + indirect are handled automatically. */ +#define ASM_MAYBE_OUTPUT_ENCODED_ADDR_RTX(FILE, ENCODING, SIZE, ADDR, DONE) \ + do { \ + if ((SIZE) == 4 && ((ENCODING) & 0x70) == DW_EH_PE_datarel) \ + { \ + fputs (ASM_LONG, FILE); \ + assemble_name (FILE, XSTR (ADDR, 0)); \ + fputs (((ENCODING) & DW_EH_PE_indirect ? "@GOT" : "@GOTOFF"), FILE); \ + goto DONE; \ + } \ + } while (0) + + +/* FIXME: AROS doesn't support dw2 unwinding yet. */ +#undef MD_FALLBACK_FRAME_STATE_FOR Index: gcc-4.2.2/include/filenames.h =================================================================== --- gcc-4.2.2/include/filenames.h (Revision 129381) +++ gcc-4.2.2/include/filenames.h (Arbeitskopie) @@ -40,6 +40,12 @@ #define IS_ABSOLUTE_PATH(f) (IS_DIR_SEPARATOR((f)[0]) || (((f)[0]) && ((f)[1] == ':'))) #define FILENAME_CMP(s1, s2) strcasecmp(s1, s2) +#elif defined(__AROS__) + +#define IS_DIR_SEPARATOR(c) ((c) == '/' || (c) == ':') +#define IS_ABSOLUTE_PATH(f) (IS_DIR_SEPARATOR((f)[0]) || (strchr((f), ':') != NULL)) +#define FILENAME_CMP(s1, s2) strcasecmp(s1, s2) + #else /* not DOSish */ #define IS_DIR_SEPARATOR(c) ((c) == '/') Index: gcc-4.2.2/libiberty/configure.ac =================================================================== --- gcc-4.2.2/libiberty/configure.ac (Revision 129381) +++ gcc-4.2.2/libiberty/configure.ac (Arbeitskopie) @@ -663,6 +663,7 @@ *-*-mingw* | *-*-winnt*) pexecute=./pex-win32.o ;; *-*-msdosdjgpp*) pexecute=./pex-djgpp.o ;; *-*-msdos*) pexecute=./pex-msdos.o ;; + *-*-aros*) pexecute=./pex-aros.o ;; *) pexecute=./pex-unix.o ;; esac AC_SUBST(pexecute) Index: gcc-4.2.2/libiberty/pex-aros.c =================================================================== --- gcc-4.2.2/libiberty/pex-aros.c (Revision 0) +++ gcc-4.2.2/libiberty/pex-aros.c (Revision 0) @@ -0,0 +1,70 @@ +/* Utilities to execute a program in a subprocess (possibly linked by pipes + with other subprocesses), and wait for it. OS/2 specialization. + Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003 + Free Software Foundation, Inc. + +This file is part of the libiberty library. +Libiberty is free 1software; you can redistribute it and/or +modify it under the terms of the GNU Library General Public +License as published by the Free Software Foundation; either +version 2 of the License, or (at your option) any later version. + +Libiberty 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 +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with libiberty; see the file COPYING.LIB. If not, +write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +Boston, MA 02111-1307, USA. */ + +#include "pex-common.h" + +#include <process.h> +#include <errno.h> + +static int __pid, __rc; + +int +pexecute (program, argv, this_pname, temp_base, errmsg_fmt, errmsg_arg, flags) + const char *program; + char * const *argv; + const char *this_pname; + const char *temp_base; + char **errmsg_fmt, **errmsg_arg; + int flags; +{ + if ((flags & PEXECUTE_ONE) != PEXECUTE_ONE) + { + *errmsg_fmt = "-pipe not supported yet."; + *errmsg_arg = NULL; + return -1; + } + + __rc = ((flags & PEXECUTE_SEARCH) ? spawnvp : spawnv) (P_WAIT, program, argv); + if (__rc == -1) + { + *errmsg_fmt = install_error_msg; + *errmsg_arg = program; + return -1; + } + + return (__pid <= 0) ? __pid = 100 : ++__pid; +} + +int +pwait (pid, status, flags) + int pid; + int *status; + int flags; +{ + if (pid != __pid) + { + errno = EINVAL; + return -1; + } + + *status = (__rc & 0xFF) << 8; + return __pid; +} Index: gcc-4.2.2/libiberty/Makefile.in =================================================================== --- gcc-4.2.2/libiberty/Makefile.in (Revision 129381) +++ gcc-4.2.2/libiberty/Makefile.in (Arbeitskopie) @@ -146,6 +146,7 @@ partition.c pexecute.c \ pex-common.c pex-djgpp.c pex-msdos.c pex-one.c \ pex-unix.c pex-win32.c \ + pex-aros.c \ physmem.c putenv.c \ random.c regex.c rename.c rindex.c \ safe-ctype.c setenv.c sigsetmask.c snprintf.c sort.c spaces.c \ @@ -195,6 +196,7 @@ ./memset.o ./mkstemps.o \ ./pex-djgpp.o ./pex-msdos.o \ ./pex-unix.o ./pex-win32.o \ + ./pex-aros.o \ ./putenv.o \ ./random.o ./rename.o ./rindex.o \ ./setenv.o ./sigsetmask.o ./snprintf.o ./stpcpy.o ./stpncpy.o \ @@ -872,6 +874,13 @@ else true; fi $(COMPILE.c) $(srcdir)/pex-win32.c $(OUTPUT_OPTION) +./pex-aros.o: $(srcdir)/pex-aros.c config.h $(INCDIR)/ansidecl.h \ + $(INCDIR)/libiberty.h $(srcdir)/pex-common.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/pex-aros.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/pex-aros.c $(OUTPUT_OPTION) + ./pexecute.o: $(srcdir)/pexecute.c config.h $(INCDIR)/ansidecl.h \ $(INCDIR)/libiberty.h if [ x"$(PICFLAG)" != x ]; then \ Index: gcc-4.2.2/configure.in =================================================================== --- gcc-4.2.2/configure.in (Revision 129381) +++ gcc-4.2.2/configure.in (Arbeitskopie) @@ -296,6 +296,9 @@ powerpc-*-beos*) noconfigdirs="$noconfigdirs tk itcl libgui gdb dejagnu readline" ;; + *-*-aros*) + noconfigdirs="$noconfigdirs patch diff make tk tcl expect dejagnu autoconf automake texinfo bison send-pr gprof rcs guile perl itcl tix gnuserv gdb" + ;; esac @@ -977,6 +980,8 @@ # Build the stage2 and stage3 compilers with -fomit-frame-pointer. host_makefile_frag="config/mh-x86omitfp" ;; + *-*-aros*) + ;; esac fi Index: gcc-4.2.2/fixincludes/configure =================================================================== --- gcc-4.2.2/fixincludes/configure (Revision 129381) +++ gcc-4.2.2/fixincludes/configure (Arbeitskopie) @@ -2563,6 +2563,7 @@ case $host in i?86-*-msdosdjgpp* | \ i?86-*-mingw32* | \ + *-*-aros* | \ *-*-beos* ) TARGET=twoprocess ;; Index: gcc-4.2.2/fixincludes/configure.ac =================================================================== --- gcc-4.2.2/fixincludes/configure.ac (Revision 129381) +++ gcc-4.2.2/fixincludes/configure.ac (Arbeitskopie) @@ -49,6 +49,7 @@ [case $host in i?86-*-msdosdjgpp* | \ i?86-*-mingw32* | \ + *-*-aros* | \ *-*-beos* ) TARGET=twoprocess ;;