3
0
Fork 0
forked from mirrors/nixpkgs

gccApple: Patches for building on Mavericks

This commit is contained in:
John Wiegley 2014-06-21 11:31:50 -07:00
parent ba048baaff
commit b24da6b15d
3 changed files with 120 additions and 2 deletions

View file

@ -12,7 +12,7 @@ let
revision = "5666.3"; # Apple's fork revision number.
in
stdenv.mkDerivation {
stdenv.mkDerivation rec {
name = "gcc-apple-${version}.${revision}";
builder = ./builder.sh;
@ -33,8 +33,10 @@ stdenv.mkDerivation {
sourceRoot = "gcc-${revision}/";
# The floor_log2_patch is from a Gentoo fix for the same issue:
# https://bugs.gentoo.org/attachment.cgi?id=363174&action=diff
patches =
[ ./pass-cxxcpp.patch ]
[ ./pass-cxxcpp.patch ./floor_log2_patch.diff ]
++ stdenv.lib.optional noSysDirs ./no-sys-dirs.patch
++ stdenv.lib.optional langCC ./fix-libstdc++-link.patch;

View file

@ -3,6 +3,9 @@ Prevent our libstdc++.dylib from having a runtime dependency on
passed by g++ when it links libstdc++.dylib. Adding "-nostdlib" to
the g++ invocation prevents this.
jww (2014-06-21): I've added several more patches to this, for building on
Mavericks.
diff -ru -x '*~' libstdcxx-39-orig/libstdcxx/libstdc++-v3/src/Makefile.in libstdcxx-39/libstdcxx/libstdc++-v3/src/Makefile.in
--- x/libstdcxx/libstdc++-v3/src/Makefile.in 2006-10-16 21:08:22.000000000 +0200
+++ y/libstdcxx/libstdc++-v3/src/Makefile.in 2012-02-17 18:44:05.210570590 +0100
@ -15,3 +18,54 @@ diff -ru -x '*~' libstdcxx-39-orig/libstdcxx/libstdc++-v3/src/Makefile.in libstd
# Use special rules for the deprecated source files so that they find
--- x/libstdcxx/libstdc++-v3/libsupc++/unwind-cxx.h
+++ y/libstdcxx/libstdc++-v3/libsupc++/unwind-cxx.h
@@ -38,7 +38,7 @@
#include <typeinfo>
#include <exception>
#include <cstddef>
-#include "unwind.h"
+#include "unwind-generic.h"
#pragma GCC visibility push(default)
@@ -133,7 +133,7 @@ extern "C" void __cxa_bad_typeid ();
// throws, and if bad_exception needs to be thrown. Called from the
// compiler.
extern "C" void __cxa_call_unexpected (void *) __attribute__((noreturn));
-extern "C" void __cxa_call_terminate (void*) __attribute__((noreturn));
+extern "C" void __cxa_call_terminate(_Unwind_Exception* ue_header);
#ifdef __ARM_EABI_UNWINDER__
// Arm EABI specified routines.
--- x/libstdcxx/libstdc++-v3/include/ext/bitmap_allocator.h
+++ y/libstdcxx/libstdc++-v3/include/ext/bitmap_allocator.h
@@ -549,6 +549,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
*/
class free_list
{
+ public:
typedef size_t* value_type;
typedef __detail::__mini_vector<value_type> vector_type;
typedef vector_type::iterator iterator;
--- x/libstdcxx/libstdc++-v3/include/ext/ropeimpl.h
+++ y/libstdcxx/libstdc++-v3/include/ext/ropeimpl.h
@@ -433,7 +433,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
{
size_t __old_len = __r->_M_size;
_CharT* __new_data = (_CharT*)
- _Data_allocate(_S_rounded_up_size(__old_len + __len));
+ _Base::_Data_allocate(_S_rounded_up_size(__old_len + __len));
_RopeLeaf* __result;
uninitialized_copy_n(__r->_M_data, __old_len, __new_data);
@@ -817,7 +817,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
if (__result_len > __lazy_threshold)
goto lazy;
__section = (_CharT*)
- _Data_allocate(_S_rounded_up_size(__result_len));
+ _Base::_Data_allocate(_S_rounded_up_size(__result_len));
try
{ (*(__f->_M_fn))(__start, __result_len, __section); }
catch(...)

View file

@ -0,0 +1,62 @@
--- gcc-5666.3/gcc/toplev.h
+++ gcc-5666.3/gcc/toplev.h
@@ -151,6 +151,8 @@
/* Return true iff flags are set as if -ffast-math. */
extern bool fast_math_flags_set_p (void);
+#if GCC_VERSION < 3004
+
/* Return log2, or -1 if not exact. */
extern int exact_log2 (unsigned HOST_WIDE_INT);
@@ -158,7 +160,7 @@
extern int floor_log2 (unsigned HOST_WIDE_INT);
/* Inline versions of the above for speed. */
-#if GCC_VERSION >= 3004
+#else /* GCC_VERSION < 3004 */
# if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_LONG
# define CLZ_HWI __builtin_clzl
# define CTZ_HWI __builtin_ctzl
@@ -172,18 +172,18 @@
# define CTZ_HWI __builtin_ctz
# endif
-extern inline int
+static inline int
floor_log2 (unsigned HOST_WIDE_INT x)
{
return x ? HOST_BITS_PER_WIDE_INT - 1 - (int) CLZ_HWI (x) : -1;
}
-extern inline int
+static inline int
exact_log2 (unsigned HOST_WIDE_INT x)
{
return x == (x & -x) && x ? (int) CTZ_HWI (x) : -1;
}
-#endif /* GCC_VERSION >= 3004 */
+#endif /* GCC_VERSION < 3004 */
/* Functions used to get and set GCC's notion of in what directory
compilation was started. */
--- gcc-5666.3/gcc/toplev.c
+++ gcc-5666.3/gcc/toplev.c
@@ -555,7 +555,7 @@
for floor_log2 and exact_log2; see toplev.h. That construct, however,
conflicts with the ISO C++ One Definition Rule. */
-#if GCC_VERSION < 3004 || !defined (__cplusplus)
+#if GCC_VERSION < 3004
/* Given X, an unsigned number, return the largest int Y such that 2**Y <= X.
If X is 0, return -1. */
@@ -607,7 +607,7 @@
#endif
}
-#endif /* GCC_VERSION < 3004 || !defined (__cplusplus) */
+#endif /* GCC_VERSION < 3004 */
/* Handler for fatal signals, such as SIGSEGV. These are transformed
into ICE messages, which is much more user friendly. In case the