From c57c54c34af0144fd63f0947baaee835d55df2ec Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Duval?= <jerome.duval@gmail.com>
Date: Mon, 27 Jul 2015 16:32:32 +0200
Subject: Haiku: disable -fno-PIE as this fails on x86_64.


diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index 87e7a16..6d469b8 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -264,7 +264,7 @@ NO_PIE_CFLAGS = @NO_PIE_CFLAGS@
 NO_PIE_FLAG = @NO_PIE_FLAG@
 
 # We don't want to compile the compilers with -fPIE, it make PCH fail.
-COMPILER += $(NO_PIE_CFLAGS)
+#COMPILER += $(NO_PIE_CFLAGS)
 
 # Link with -no-pie since we compile the compiler with -fno-PIE.
 LINKER += $(NO_PIE_FLAG)
@@ -764,9 +764,9 @@ NO_PIE_CFLAGS_FOR_BUILD = @NO_PIE_CFLAGS_FOR_BUILD@
 NO_PIE_FLAG_FOR_BUILD = @NO_PIE_FLAG_FOR_BUILD@
 BUILD_CFLAGS= @BUILD_CFLAGS@ -DGENERATOR_FILE
 BUILD_CXXFLAGS = @BUILD_CXXFLAGS@ -DGENERATOR_FILE
-BUILD_NO_PIE_CFLAGS = @BUILD_NO_PIE_CFLAGS@
-BUILD_CFLAGS += $(BUILD_NO_PIE_CFLAGS)
-BUILD_CXXFLAGS += $(BUILD_NO_PIE_CFLAGS)
+#BUILD_NO_PIE_CFLAGS = @BUILD_NO_PIE_CFLAGS@
+#BUILD_CFLAGS += $(BUILD_NO_PIE_CFLAGS)
+#BUILD_CXXFLAGS += $(BUILD_NO_PIE_CFLAGS)
 
 # Native compiler that we use.  This may be C++ some day.
 COMPILER_FOR_BUILD = $(CXX_FOR_BUILD)
-- 
2.2.2


From 7c3527abcfe31de1c85ad133a4df3f79d94076f2 Mon Sep 17 00:00:00 2001
From: Jerome Duval <jerome.duval@gmail.com>
Date: Thu, 5 May 2016 09:03:06 +0000
Subject: fix for libstdc++/69506


diff --git a/libstdc++-v3/config/os/haiku/os_defines.h b/libstdc++-v3/config/os/haiku/os_defines.h
index 4674f7b..02c8693 100644
--- a/libstdc++-v3/config/os/haiku/os_defines.h
+++ b/libstdc++-v3/config/os/haiku/os_defines.h
@@ -42,4 +42,7 @@
 	#define _GLIBCXX_USE_CLOCK_REALTIME 1
 #endif
 
+// See libstdc++/69506
+#define _GLIBCXX_USE_WEAK_REF 0
+
 #endif
-- 
2.2.2


From b6a24621d51c5d01cd1c91596d74d47678756bf7 Mon Sep 17 00:00:00 2001
From: Jerome Duval <jerome.duval@gmail.com>
Date: Thu, 5 May 2016 15:52:08 +0000
Subject: rename x86_elf_aligned_common.


diff --git a/gcc/config/i386/haiku64.h b/gcc/config/i386/haiku64.h
index 76ba48e..4fb337d 100644
--- a/gcc/config/i386/haiku64.h
+++ b/gcc/config/i386/haiku64.h
@@ -112,9 +112,9 @@ Boston, MA 02111-1307, USA.  */
 #define ASM_SPEC "%{v:-V} %{Qy:} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Yd,*} \
  %{Wa,*:%*} %{" SPEC_32 ":--32} %{" SPEC_64 ":--64}"
 
-#undef  ASM_OUTPUT_ALIGNED_COMMON
-#define ASM_OUTPUT_ALIGNED_COMMON(FILE, NAME, SIZE, ALIGN)		\
-  x86_elf_aligned_common (FILE, NAME, SIZE, ALIGN);
+#undef  ASM_OUTPUT_ALIGNED_DECL_COMMON
+#define ASM_OUTPUT_ALIGNED_DECL_COMMON(FILE, DECL, NAME, SIZE, ALIGN)	\
+  x86_elf_aligned_decl_common (FILE, DECL, NAME, SIZE, ALIGN);
 
 
 /* i386 System V Release 4 uses DWARF debugging info.
-- 
2.2.2

