Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

gcc48: fix build on Tiger/PPC

  • Loading branch information...
mistydemeo committed Oct 14, 2013
1 parent eaa2936 commit e833b133fcc371361c4b5fe9c7e47a58b3588323
Showing with 135 additions and 0 deletions.
  1. +135 −0 gcc48.rb
135 gcc48.rb
@@ -43,12 +43,27 @@ def osmajor
depends_on 'isl011'
depends_on 'ecj' if build.include? 'enable-java' or build.include? 'enable-all-languages'

# The as that comes with Tiger isn't capable of dealing with the
# PPC asm that comes in libitm
depends_on 'cctools' => :build if MacOS.version < :leopard

fails_with :gcc_4_0

# GCC 4.8.1 incorrectly determines that _Unwind_GetIPInfo is available on
# Tiger, resulting in a failed build
# Reported upstream: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58710
def patches; DATA; end if MacOS.version < :leopard

def install
# GCC will suffer build errors if forced to use a particular linker.
ENV.delete 'LD'

if MacOS.version < :leopard
as = Formula.factory('cctools').bin/'as'
ENV['AS'] = as
ENV['AS_FOR_TARGET'] = as
end

if build.include? 'enable-all-languages'
# Everything but Ada, which requires a pre-existing GCC Ada compiler
# (gnat) to bootstrap. GCC 4.6.0 add go as a language option, but it is
@@ -101,6 +116,10 @@ def install
# -fPIC, -shared, -ldl and -rdynamic."
args << "--enable-plugin" if MacOS.version > :tiger

# Otherwise make fails during comparison at stage 3
# See: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45248
args << '--with-dwarf2' if MacOS.version < :leopard

args << '--disable-nls' unless build.include? 'enable-nls'

if build.include? 'enable-java' or build.include? 'enable-all-languages'
@@ -141,3 +160,119 @@ def install
end
end
end

__END__
diff --git a/libbacktrace/backtrace.c b/libbacktrace/backtrace.c
index 428f53a..a165197 100644
--- a/libbacktrace/backtrace.c
+++ b/libbacktrace/backtrace.c
@@ -35,6 +35,14 @@ POSSIBILITY OF SUCH DAMAGE. */
#include "unwind.h"
#include "backtrace.h"
+#ifdef __APPLE__
+/* On MacOS X, versions older than 10.5 don't export _Unwind_GetIPInfo. */
+#undef HAVE_GETIPINFO
+#if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 1050
+#define HAVE_GETIPINFO 1
+#endif
+#endif
+
/* The main backtrace_full routine. */
/* Data passed through _Unwind_Backtrace. */
diff --git a/libbacktrace/simple.c b/libbacktrace/simple.c
index b03f039..9f3a945 100644
--- a/libbacktrace/simple.c
+++ b/libbacktrace/simple.c
@@ -35,6 +35,14 @@ POSSIBILITY OF SUCH DAMAGE. */
#include "unwind.h"
#include "backtrace.h"
+#ifdef __APPLE__
+/* On MacOS X, versions older than 10.5 don't export _Unwind_GetIPInfo. */
+#undef HAVE_GETIPINFO
+#if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 1050
+#define HAVE_GETIPINFO 1
+#endif
+#endif
+
/* The simple_backtrace routine. */
/* Data passed through _Unwind_Backtrace. */
diff --git a/libgcc/unwind-c.c b/libgcc/unwind-c.c
index b937d9d..1121dce 100644
--- a/libgcc/unwind-c.c
+++ b/libgcc/unwind-c.c
@@ -30,6 +30,14 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#define NO_SIZE_OF_ENCODED_VALUE
#include "unwind-pe.h"

+#ifdef __APPLE__
+/* On MacOS X, versions older than 10.5 don't export _Unwind_GetIPInfo. */
+#undef HAVE_GETIPINFO
+#if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 1050
+#define HAVE_GETIPINFO 1
+#endif
+#endif
+
typedef struct
{
_Unwind_Ptr Start;
diff --git a/libgfortran/runtime/backtrace.c b/libgfortran/runtime/backtrace.c
index 3b58118..9a00066 100644
--- a/libgfortran/runtime/backtrace.c
+++ b/libgfortran/runtime/backtrace.c
@@ -40,6 +40,14 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#include "unwind.h"
+#ifdef __APPLE__
+/* On MacOS X, versions older than 10.5 don't export _Unwind_GetIPInfo. */
+#undef HAVE_GETIPINFO
+#if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 1050
+#define HAVE_GETIPINFO 1
+#endif
+#endif
+
/* Macros for common sets of capabilities: can we fork and exec, and
can we use pipes to communicate with the subprocess. */
#define CAN_FORK (defined(HAVE_FORK) && defined(HAVE_EXECVE) \
diff --git a/libgo/runtime/go-unwind.c b/libgo/runtime/go-unwind.c
index c669a3c..9e848db 100644
--- a/libgo/runtime/go-unwind.c
+++ b/libgo/runtime/go-unwind.c
@@ -18,6 +18,14 @@
#include "go-defer.h"
#include "go-panic.h"
+#ifdef __APPLE__
+/* On MacOS X, versions older than 10.5 don't export _Unwind_GetIPInfo. */
+#undef HAVE_GETIPINFO
+#if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 1050
+#define HAVE_GETIPINFO 1
+#endif
+#endif
+
/* The code for a Go exception. */
#ifdef __ARM_EABI_UNWINDER__
diff --git a/libobjc/exception.c b/libobjc/exception.c
index 4b05611..8ff70f9 100644
--- a/libobjc/exception.c
+++ b/libobjc/exception.c
@@ -31,6 +31,14 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#include "unwind-pe.h"
#include <string.h> /* For memcpy */
+#ifdef __APPLE__
+/* On MacOS X, versions older than 10.5 don't export _Unwind_GetIPInfo. */
+#undef HAVE_GETIPINFO
+#if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 1050
+#define HAVE_GETIPINFO 1
+#endif
+#endif
+
/* 'is_kind_of_exception_matcher' is our default exception matcher -
it determines if the object 'exception' is of class 'catch_class',
or of a subclass. */

0 comments on commit e833b13

Please sign in to comment.
You can’t perform that action at this time.