Ticket #6306: gcc_x86_64.multilib.buildtools.txt

File gcc_x86_64.multilib.buildtools.txt, 5.6 KB (added by nmentley, 10 years ago)

patch for /haiku/buildtools

Line 
1Index: gcc/gcc/config.gcc
2===================================================================
3--- gcc/gcc/config.gcc (revision 37497)
4+++ gcc/gcc/config.gcc (working copy)
5@@ -1063,8 +1063,9 @@
6 extra_parts='crtbegin.o crtend.o'
7 ;;
8 x86_64-*-haiku*)
9- tmake_file='t-haiku i386/t-crtpic'
10- 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"
11+ tmake_file='t-haiku i386/t-haiku64 i386/t-crtpic'
12+ tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h svr4.h haiku.h i386/haiku64.h"
13+ extra_parts='crtbegin.o crtend.o'
14 ;;
15 i[34567]86-*-netbsdelf*)
16 tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h netbsd.h netbsd-elf.h i386/netbsd-elf.h"
17Index: gcc/gcc/config/i386/haiku64.h
18===================================================================
19--- gcc/gcc/config/i386/haiku64.h (revision 37497)
20+++ gcc/gcc/config/i386/haiku64.h (working copy)
21@@ -20,7 +20,7 @@
22 Boston, MA 02111-1307, USA. */
23
24
25-#if TARGET_64BIT_DEFAULT
26+#if TARGET_64BIT
27 #define TARGET_VERSION fprintf (stderr, " (x86-64 Haiku/ELF)");
28 #else
29 #define TARGET_VERSION fprintf (stderr, " (i386 Haiku/ELF)");
30@@ -35,21 +35,46 @@
31 #undef DEFAULT_PCC_STRUCT_RETURN
32 #define DEFAULT_PCC_STRUCT_RETURN 1
33
34+#undef DBX_REGISTER_NUMBER
35+#define DBX_REGISTER_NUMBER(n) \
36+ (TARGET_64BIT ? dbx64_register_map[n] : svr4_dbx_register_map[n])
37+
38+#if TARGET_64BIT
39 #define TARGET_OS_CPP_BUILTINS() \
40 do \
41 { \
42 builtin_define ("__HAIKU__"); \
43+ builtin_define ("__x86_64__"); \
44 builtin_define ("__stdcall=__attribute__((__stdcall__))"); \
45 builtin_define ("__cdecl=__attribute__((__cdecl__))"); \
46- builtin_assert ("system=haiku"); \
47+ builtin_assert ("system=haiku"); \
48 /* Haiku apparently doesn't support merging of symbols across shared \
49 object boundaries. Hence we need to explicitly specify that \
50 type_infos are not merged, so that they get compared by name \
51 instead of by pointer. */ \
52- builtin_define ("__GXX_MERGED_TYPEINFO_NAMES=0"); \
53- builtin_define ("__GXX_TYPEINFO_EQUALITY_INLINE=0"); \
54+ builtin_define ("__GXX_MERGED_TYPEINFO_NAMES=0"); \
55+ builtin_define ("__GXX_TYPEINFO_EQUALITY_INLINE=0"); \
56 } \
57 while (0)
58+#else
59+#define TARGET_OS_CPP_BUILTINS() \
60+ do \
61+ { \
62+ builtin_define ("__HAIKU__"); \
63+ builtin_define ("__INTEL__"); \
64+ builtin_define ("__X86__"); \
65+ builtin_define ("__stdcall=__attribute__((__stdcall__))"); \
66+ builtin_define ("__cdecl=__attribute__((__cdecl__))"); \
67+ builtin_assert ("system=haiku"); \
68+ /* Haiku apparently doesn't support merging of symbols across shared \
69+ object boundaries. Hence we need to explicitly specify that \
70+ type_infos are not merged, so that they get compared by name \
71+ instead of by pointer. */ \
72+ builtin_define ("__GXX_MERGED_TYPEINFO_NAMES=0"); \
73+ builtin_define ("__GXX_TYPEINFO_EQUALITY_INLINE=0"); \
74+ } \
75+ while (0)
76+#endif
77
78 /* Provide a LINK_SPEC appropriate for Haiku. Here we provide support
79 for the special GCC options -static and -shared, which allow us to
80@@ -57,5 +82,59 @@
81 combinations of options at link-time. */
82
83 #undef LINK_SPEC
84-#define LINK_SPEC "-m elf_x86_64_haiku -shared -Bsymbolic %{nostart:-e 0} %{shared:-e 0} %{!shared: %{!nostart: -no-undefined}}"
85+#if TARGET_64BIT
86+#define LINK_SPEC "-m elf_x86_64 -z max-page-size=0x1000 -shared -Bsymbolic %{nostart:-e 0} %{shared:-e 0} %{!shared: %{!nostart: -no-undefined}}"
87+#else
88+#define LINK_SPEC "-m elf_i386_haiku -shared -Bsymbolic %{nostart:-e 0} %{shared:-e 0} %{!shared: %{!nostart: -no-undefined}}"
89+#endif
90
91+
92+/* A C statement (sans semicolon) to output to the stdio stream
93+ FILE the assembler definition of uninitialized global DECL named
94+ NAME whose size is SIZE bytes and alignment is ALIGN bytes.
95+ Try to use asm_output_aligned_bss to implement this macro. */
96+
97+#define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
98+ asm_output_aligned_bss (FILE, DECL, NAME, SIZE, ALIGN)
99+
100+/* A C statement to output to the stdio stream FILE an assembler
101+ command to advance the location counter to a multiple of 1<<LOG
102+ bytes if it is within MAX_SKIP bytes.
103+
104+ This is used to align code labels according to Intel recommendations. */
105+
106+#ifdef HAVE_GAS_MAX_SKIP_P2ALIGN
107+#define ASM_OUTPUT_MAX_SKIP_ALIGN(FILE,LOG,MAX_SKIP) \
108+ if ((LOG)!=0) \
109+ if ((MAX_SKIP)==0) fprintf ((FILE), "\t.p2align %d\n", (LOG)); \
110+ else fprintf ((FILE), "\t.p2align %d,,%d\n", (LOG), (MAX_SKIP))
111+#endif
112+
113+
114+/* Output assembler code to FILE to call the profiler. */
115+#define NO_PROFILE_COUNTERS 1
116+
117+#undef ASM_SPEC
118+#define ASM_SPEC "%{v:-V} %{Qy:} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Yd,*} \
119+ %{Wa,*:%*} %{m32:--32} %{m64:--64}"
120+
121+#undef ASM_OUTPUT_ALIGNED_COMMON
122+#define ASM_OUTPUT_ALIGNED_COMMON(FILE, NAME, SIZE, ALIGN) \
123+ x86_elf_aligned_common (FILE, NAME, SIZE, ALIGN);
124+
125+
126+/* i386 System V Release 4 uses DWARF debugging info.
127+ x86-64 ABI specifies DWARF2. */
128+#if TARGET_64BIT
129+ #define DWARF2_DEBUGGING_INFO 1
130+ #define DWARF2_UNWIND_INFO 1
131+
132+ #undef PREFERRED_DEBUGGING_TYPE
133+ #define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
134+
135+ #undef TARGET_ASM_SELECT_SECTION
136+ #define TARGET_ASM_SELECT_SECTION x86_64_elf_select_section
137+
138+ #undef TARGET_ASM_UNIQUE_SECTION
139+ #define TARGET_ASM_UNIQUE_SECTION x86_64_elf_unique_section
140+#endif
141Index: gcc/gcc/config/i386/t-haiku64
142===================================================================
143--- gcc/gcc/config/i386/t-haiku64 (revision 0)
144+++ gcc/gcc/config/i386/t-haiku64 (revision 0)
145@@ -0,0 +1,3 @@
146+MULTILIB_OPTIONS = m32
147+MULTILIB_DIRNAMES = legacy
148+MULTILIB_OSDIRNAMES = legacy