Skip to content

Commit cb5f636

Browse files
committed
rustc: Don't emit compact unwind info on mac
It's not compatible with the subtlety of __morestack
1 parent 68f4849 commit cb5f636

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

mk/platform.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ ifneq ($(findstring darwin,$(CFG_OSTYPE)),)
7676
CFG_LIB_GLOB=lib$(1)-*.dylib
7777
CFG_UNIXY := 1
7878
CFG_LDENV := DYLD_LIBRARY_PATH
79-
CFG_GCCISH_LINK_FLAGS += -dynamiclib -lpthread -framework CoreServices
79+
CFG_GCCISH_LINK_FLAGS += -dynamiclib -lpthread -framework CoreServices -Wl,-no_compact_unwind
8080
CFG_GCCISH_DEF_FLAG := -Wl,-exported_symbols_list,
8181
# Darwin has a very blurry notion of "64 bit", and claims it's running
8282
# "on an i386" when the whole userspace is 64-bit and the compiler

src/comp/back/link.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -657,6 +657,14 @@ fn link_binary(sess: session::session,
657657
gcc_args += ["-lrt", "-ldl"];
658658
}
659659

660+
// OS X 10.6 introduced 'compact unwind info', which is produced by the
661+
// linker from the dwarf unwind info. Unfortunately, it does not seem to
662+
// understand how to unwind our __morestack frame, so we have to turn it
663+
// off. This has impacted some other projects like GHC.
664+
if sess.get_targ_cfg().os == session::os_macos {
665+
gcc_args += ["-Wl,-no_compact_unwind"];
666+
}
667+
660668
// Stack growth requires statically linking a __morestack function
661669
gcc_args += ["-lmorestack"];
662670

0 commit comments

Comments
 (0)