Index: gcc/gcc/config.gcc =================================================================== --- gcc/gcc/config.gcc (revision 37497) +++ gcc/gcc/config.gcc (working copy) @@ -1063,8 +1063,9 @@ extra_parts='crtbegin.o crtend.o' ;; x86_64-*-haiku*) - tmake_file='t-haiku i386/t-crtpic' - tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h svr4.h haiku.h i386/x86-64.h i386/haiku64.h" + tmake_file='t-haiku i386/t-haiku64 i386/t-crtpic' + tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h svr4.h haiku.h i386/haiku64.h" + extra_parts='crtbegin.o crtend.o' ;; i[34567]86-*-netbsdelf*) tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h netbsd.h netbsd-elf.h i386/netbsd-elf.h" Index: gcc/gcc/config/i386/haiku64.h =================================================================== --- gcc/gcc/config/i386/haiku64.h (revision 37497) +++ gcc/gcc/config/i386/haiku64.h (working copy) @@ -20,7 +20,7 @@ Boston, MA 02111-1307, USA. */ -#if TARGET_64BIT_DEFAULT +#if TARGET_64BIT #define TARGET_VERSION fprintf (stderr, " (x86-64 Haiku/ELF)"); #else #define TARGET_VERSION fprintf (stderr, " (i386 Haiku/ELF)"); @@ -35,21 +35,46 @@ #undef DEFAULT_PCC_STRUCT_RETURN #define DEFAULT_PCC_STRUCT_RETURN 1 +#undef DBX_REGISTER_NUMBER +#define DBX_REGISTER_NUMBER(n) \ + (TARGET_64BIT ? dbx64_register_map[n] : svr4_dbx_register_map[n]) + +#if TARGET_64BIT #define TARGET_OS_CPP_BUILTINS() \ do \ { \ builtin_define ("__HAIKU__"); \ + builtin_define ("__x86_64__"); \ builtin_define ("__stdcall=__attribute__((__stdcall__))"); \ builtin_define ("__cdecl=__attribute__((__cdecl__))"); \ - builtin_assert ("system=haiku"); \ + builtin_assert ("system=haiku"); \ /* Haiku apparently doesn't support merging of symbols across shared \ object boundaries. Hence we need to explicitly specify that \ type_infos are not merged, so that they get compared by name \ instead of by pointer. */ \ - builtin_define ("__GXX_MERGED_TYPEINFO_NAMES=0"); \ - builtin_define ("__GXX_TYPEINFO_EQUALITY_INLINE=0"); \ + builtin_define ("__GXX_MERGED_TYPEINFO_NAMES=0"); \ + builtin_define ("__GXX_TYPEINFO_EQUALITY_INLINE=0"); \ } \ while (0) +#else +#define TARGET_OS_CPP_BUILTINS() \ + do \ + { \ + builtin_define ("__HAIKU__"); \ + builtin_define ("__INTEL__"); \ + builtin_define ("__X86__"); \ + builtin_define ("__stdcall=__attribute__((__stdcall__))"); \ + builtin_define ("__cdecl=__attribute__((__cdecl__))"); \ + builtin_assert ("system=haiku"); \ + /* Haiku apparently doesn't support merging of symbols across shared \ + object boundaries. Hence we need to explicitly specify that \ + type_infos are not merged, so that they get compared by name \ + instead of by pointer. */ \ + builtin_define ("__GXX_MERGED_TYPEINFO_NAMES=0"); \ + builtin_define ("__GXX_TYPEINFO_EQUALITY_INLINE=0"); \ + } \ + while (0) +#endif /* Provide a LINK_SPEC appropriate for Haiku. Here we provide support for the special GCC options -static and -shared, which allow us to @@ -57,5 +82,59 @@ combinations of options at link-time. */ #undef LINK_SPEC -#define LINK_SPEC "-m elf_x86_64_haiku -shared -Bsymbolic %{nostart:-e 0} %{shared:-e 0} %{!shared: %{!nostart: -no-undefined}}" +#if TARGET_64BIT +#define LINK_SPEC "-m elf_x86_64 -z max-page-size=0x1000 -shared -Bsymbolic %{nostart:-e 0} %{shared:-e 0} %{!shared: %{!nostart: -no-undefined}}" +#else +#define LINK_SPEC "-m elf_i386_haiku -shared -Bsymbolic %{nostart:-e 0} %{shared:-e 0} %{!shared: %{!nostart: -no-undefined}}" +#endif + +/* 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<