Skip to content
This repository has been archived by the owner on Jul 4, 2023. It is now read-only.

Commit

Permalink
mono: Fix compile/runtime error on El Cap Beta 3
Browse files Browse the repository at this point in the history
This fixes the error "could not discover the mach TLS offset" which
prohibits both running and compiling mono on OS X 10.11 (15A216g).

The patch was backported from current mono/mono master. Because the
problem also affects binaries compiled before upgrading to El Capitan
the patch is *not* scoped to `MacOS.version >= :el_capitan`.
  • Loading branch information
felixbuenemann committed Jul 9, 2015
1 parent 434c3fc commit 4bc469f
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions Library/Formula/mono.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ class Mono < Formula
homepage "http://www.mono-project.com/"
url "http://download.mono-project.com/sources/mono/mono-4.0.2.5.tar.bz2"
sha256 "b074584eea5bbaaf29362486a69d70abe53d0d2feb334f231fa9c841cf6fd651"
revision 1

# xbuild requires the .exe files inside the runtime directories to
# be executable
Expand All @@ -14,6 +15,10 @@ class Mono < Formula
sha256 "80bddaefcd9c136bc763797cff98f3aa07ec758e348037fd24f07d2b1b795fbb" => :mountain_lion
end

# Fix compile and runtime error on OS X 10.11 Beta 3
# See: https://github.com/mono/mono/pull/1919
patch :DATA

resource "monolite" do
url "http://storage.bos.xamarin.com/mono-dist-4.0.0-release/c1/c1b37f29b1a439acf7ef42a384550ab1dca5295a/monolite-117-latest.tar.gz"
sha256 "a3bd1c826186e4896193ad1f909bf8756f66f62d1e249fe301b10bc80ebe0795"
Expand Down Expand Up @@ -80,3 +85,37 @@ def caveats; <<-EOS.undent
EOS
end
end

__END__
From c8a3c4fd36a69d039d0adb7da02de61e5e8df5f7 Mon Sep 17 00:00:00 2001
From: "Craig S. Bosma" <craig.bosma@gmail.com>
Date: Wed, 8 Jul 2015 19:01:55 -0500
Subject: [PATCH] Add TLS offset for pre-release OS X 10.11 on amd64

---
mono/utils/mach-support-amd64.c | 5 +++++
1 file changed, 5 insertions(+)

diff --git a/mono/utils/mach-support-amd64.c b/mono/utils/mach-support-amd64.c
index 1904088..825f2a2 100644
--- a/mono/utils/mach-support-amd64.c
+++ b/mono/utils/mach-support-amd64.c
@@ -23,6 +23,7 @@
/* All OSX versions up to 10.8 */
#define TLS_VECTOR_OFFSET_CATS 0x60
#define TLS_VECTOR_OFFSET_10_9 0xe0
+#define TLS_VECTOR_OFFSET_10_11 0x100

static int tls_vector_offset;

@@ -130,6 +131,10 @@ mono_mach_init (pthread_key_t key)
if (mono_mach_arch_get_tls_value_from_thread (pthread_self (), key) == canary)
goto ok;

+ tls_vector_offset = TLS_VECTOR_OFFSET_10_11;
+ if (mono_mach_arch_get_tls_value_from_thread (pthread_self (), key) == canary)
+ goto ok;
+
g_error ("could not discover the mach TLS offset");
ok:
pthread_setspecific (key, old_value);

0 comments on commit 4bc469f

Please sign in to comment.