Skip to content

Instantly share code, notes, and snippets.

@zbeekman
Last active November 15, 2016 13:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zbeekman/50bdbdd8f609008fdfa1c0f3e7da2e7d to your computer and use it in GitHub Desktop.
Save zbeekman/50bdbdd8f609008fdfa1c0f3e7da2e7d to your computer and use it in GitHub Desktop.
Patch gcc trunk to bootstrap on OS X. See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78267 for more info. This is "untested patch 2"
diff --git a/libsanitizer/sanitizer_common/sanitizer_mac.cc b/libsanitizer/sanitizer_common/sanitizer_mac.cc
index 4408d1d..e495a10 100644
--- a/libsanitizer/sanitizer_common/sanitizer_mac.cc
+++ b/libsanitizer/sanitizer_common/sanitizer_mac.cc
@@ -34,7 +34,7 @@
extern char **environ;
#endif
-#if defined(__has_include) && __has_include(<os/trace.h>)
+#if defined(__has_include) && __has_include(<os/trace.h>) && defined(__clang__)
#define SANITIZER_OS_TRACE 1
#include <os/trace.h>
#else
@@ -49,7 +49,9 @@ extern "C" {
}
#endif
+#if defined(__clang__)
#include <asl.h>
+#endif
#include <dlfcn.h> // for dladdr()
#include <errno.h>
#include <fcntl.h>
@@ -474,7 +476,7 @@ static BlockingMutex syslog_lock(LINKER_INITIALIZED);
#endif
void WriteOneLineToSyslog(const char *s) {
-#if !SANITIZER_GO
+#if !SANITIZER_GO && defined(__clang__)
syslog_lock.CheckLocked();
asl_log(nullptr, nullptr, ASL_LEVEL_ERR, "%s", s);
#endif
diff --git a/Formula/gcc.rb b/Formula/gcc.rb
index 608fd55..08580a2 100644
--- a/Formula/gcc.rb
+++ b/Formula/gcc.rb
@@ -89,6 +90,13 @@ class Gcc < Formula
sha256 "863957f90a934ee8f89707980473769cff47ca0663c3906992da6afb242fb220"
end
+ if build.head?
+ patch do
+ url "https://gist.githubusercontent.com/zbeekman/50bdbdd8f609008fdfa1c0f3e7da2e7d/raw/5081f20b2fe1047f35bc275b33e033eb36c2984d/gcc-trunk-mac-bootstrap.patch"
+ sha256 "f0e18030c2b6d8516a258aa6b65fb260f26fd9e0bef2c34a5cd203e5da7ede23"
+ end
+ end
+
def install
# GCC will suffer build errors if forced to use a particular linker.
ENV.delete "LD"
@zbeekman
Copy link
Author

This fixes OS X sierra GCC trunk (GCC 7, in development) bootstrapping problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment