libllvmForJSC shouldn't call exit(1) on report_fatal_error()
authorfpizlo@apple.com <fpizlo@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 17 Oct 2013 03:47:27 +0000 (03:47 +0000)
committerfpizlo@apple.com <fpizlo@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 17 Oct 2013 03:47:27 +0000 (03:47 +0000)
https://bugs.webkit.org/show_bug.cgi?id=122905
<rdar://problem/15237856>

Source/JavaScriptCore:

Reviewed by Michael Saboff.

Expose the new LLVMInstallFatalErrorHandler() API through the soft linking magic and
then always call it to install something that calls CRASH().

* llvm/InitializeLLVM.cpp:
(JSC::llvmCrash):
(JSC::initializeLLVMOnce):
(JSC::initializeLLVM):
* llvm/LLVMAPIFunctions.h:

WebKitLibraries:

Reviewed by Michael Saboff.

* LLVMIncludesMountainLion.tar.bz2:
* LLVMLibrariesMountainLion.tar.bz2:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@157558 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/llvm/InitializeLLVM.cpp
Source/JavaScriptCore/llvm/LLVMAPIFunctions.h
WebKitLibraries/ChangeLog
WebKitLibraries/LLVMIncludesMountainLion.tar.bz2
WebKitLibraries/LLVMLibrariesMountainLion.tar.bz2

index 40b5aaa..3698b61 100644 (file)
@@ -1,5 +1,22 @@
 2013-10-16  Filip Pizlo  <fpizlo@apple.com>
 
+        libllvmForJSC shouldn't call exit(1) on report_fatal_error()
+        https://bugs.webkit.org/show_bug.cgi?id=122905
+        <rdar://problem/15237856>
+
+        Reviewed by Michael Saboff.
+        
+        Expose the new LLVMInstallFatalErrorHandler() API through the soft linking magic and
+        then always call it to install something that calls CRASH().
+
+        * llvm/InitializeLLVM.cpp:
+        (JSC::llvmCrash):
+        (JSC::initializeLLVMOnce):
+        (JSC::initializeLLVM):
+        * llvm/LLVMAPIFunctions.h:
+
+2013-10-16  Filip Pizlo  <fpizlo@apple.com>
+
         Prototype chain repatching in the polymorphic case fails to check if the receiver is a dictionary
         https://bugs.webkit.org/show_bug.cgi?id=122938
 
index b0c515f..cbfadb8 100644 (file)
 
 #if HAVE(LLVM)
 
+#include "LLVMAPI.h"
 #include <pthread.h>
 
 namespace JSC {
 
 static pthread_once_t initializeLLVMOnceKey = PTHREAD_ONCE_INIT;
 
+static NO_RETURN_DUE_TO_CRASH void llvmCrash(const char* reason)
+{
+    WTFLogAlways("LLVM failure: %s", reason);
+    CRASH();
+}
+
+static void initializeLLVMOnce()
+{
+    initializeLLVMImpl();
+    
+    llvm->InstallFatalErrorHandler(llvmCrash);
+}
+
 void initializeLLVM()
 {
-    pthread_once(&initializeLLVMOnceKey, initializeLLVMImpl);
+    pthread_once(&initializeLLVMOnceKey, initializeLLVMOnce);
 }
 
 } // namespace JSC
index 448239b..bc44b7a 100644 (file)
@@ -33,6 +33,7 @@
     macro(void, Shutdown, ()) \
     macro(char *, CreateMessage, (const char *Message)) \
     macro(void, DisposeMessage, (char *Message)) \
+    macro(void, InstallFatalErrorHandler, (LLVMFatalErrorHandler Handler)) \
     macro(LLVMContextRef, ContextCreate, (void)) \
     macro(LLVMContextRef, GetGlobalContext, (void)) \
     macro(void, ContextDispose, (LLVMContextRef C)) \
index dabd27e..86d8d84 100644 (file)
@@ -1,3 +1,14 @@
+2013-10-16  Filip Pizlo  <fpizlo@apple.com>
+
+        libllvmForJSC shouldn't call exit(1) on report_fatal_error()
+        https://bugs.webkit.org/show_bug.cgi?id=122905
+        <rdar://problem/15237856>
+
+        Reviewed by Michael Saboff.
+
+        * LLVMIncludesMountainLion.tar.bz2:
+        * LLVMLibrariesMountainLion.tar.bz2:
+
 2013-10-10  Filip Pizlo  <fpizlo@apple.com>
 
         Update the binary drops to the latest version of LLVM, built without -fvisibility=hidden
index 4cbfb16..5d4f088 100644 (file)
Binary files a/WebKitLibraries/LLVMIncludesMountainLion.tar.bz2 and b/WebKitLibraries/LLVMIncludesMountainLion.tar.bz2 differ
index 3505fdc..e930ab6 100644 (file)
Binary files a/WebKitLibraries/LLVMLibrariesMountainLion.tar.bz2 and b/WebKitLibraries/LLVMLibrariesMountainLion.tar.bz2 differ