fourthTier: WebKit's build system should relink JavaScriptCore if LLVM's libraries...
authoroliver@apple.com <oliver@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 25 Jul 2013 03:58:53 +0000 (03:58 +0000)
committeroliver@apple.com <oliver@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 25 Jul 2013 03:58:53 +0000 (03:58 +0000)
https://bugs.webkit.org/show_bug.cgi?id=114926

Source/JavaScriptCore:

Reviewed by Geoffrey Garen.

Use a phony file that includes a phony header to force JavaScriptCore to be relinked
if necessary. The external LLVM-importing scripts will touch the header if the libraries
are known to have changed.

* JavaScriptCore.xcodeproj/project.pbxproj:
* ftl/WebKitLLVMLibraryAnchor.cpp: Added.

Tools:

Reviewed by Geoffrey Garen.

If the LLVM libraries change, then touch a phony header, which will force relink
of JavaScriptCore.

* Scripts/copy-webkitlibraries-to-product-directory:
(unpackIfNecessary):

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

Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
Source/JavaScriptCore/ftl/WebKitLLVMLibraryAnchor.cpp [new file with mode: 0644]
Tools/ChangeLog
Tools/Scripts/copy-webkitlibraries-to-product-directory

index 4f87ce7..54b5735 100644 (file)
@@ -1,5 +1,23 @@
 2013-07-16  Oliver Hunt <oliver@apple.com>
 
+        Merge dfgFourthTier r148850
+
+    2013-04-21  Filip Pizlo  <fpizlo@apple.com>
+
+        fourthTier: WebKit's build system should relink JavaScriptCore if LLVM's libraries changed but its headers didn't
+        https://bugs.webkit.org/show_bug.cgi?id=114926
+
+        Reviewed by Geoffrey Garen.
+        
+        Use a phony file that includes a phony header to force JavaScriptCore to be relinked
+        if necessary. The external LLVM-importing scripts will touch the header if the libraries
+        are known to have changed.
+
+        * JavaScriptCore.xcodeproj/project.pbxproj:
+        * ftl/WebKitLLVMLibraryAnchor.cpp: Added.
+
+2013-07-16  Oliver Hunt <oliver@apple.com>
+
         Merge dfgFourthTier r148836
 
     2013-04-21  Filip Pizlo  <fpizlo@apple.com>
index e29d0dd..472caef 100644 (file)
                0F63948515E4811B006A597C /* DFGArrayMode.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F63948215E48114006A597C /* DFGArrayMode.h */; settings = {ATTRIBUTES = (Private, ); }; };
                0F66E16B14DF3F1600B7B2E4 /* DFGAdjacencyList.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F66E16814DF3F1300B7B2E4 /* DFGAdjacencyList.h */; settings = {ATTRIBUTES = (Private, ); }; };
                0F66E16C14DF3F1600B7B2E4 /* DFGEdge.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F66E16914DF3F1300B7B2E4 /* DFGEdge.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               0F6E5C191724AF3D005C574F /* WebKitLLVMLibraryAnchor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F6E5C181724AF3D005C574F /* WebKitLLVMLibraryAnchor.cpp */; };
                0F7025A91714B0FA00382C0E /* DFGOSRExitCompilerCommon.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F7025A71714B0F800382C0E /* DFGOSRExitCompilerCommon.cpp */; };
                0F7025AA1714B0FC00382C0E /* DFGOSRExitCompilerCommon.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F7025A81714B0F800382C0E /* DFGOSRExitCompilerCommon.h */; settings = {ATTRIBUTES = (Private, ); }; };
                0F714CA416EA92F000F3EBEB /* DFGBackwardsPropagationPhase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F714CA116EA92ED00F3EBEB /* DFGBackwardsPropagationPhase.cpp */; };
                0F63948215E48114006A597C /* DFGArrayMode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DFGArrayMode.h; path = dfg/DFGArrayMode.h; sourceTree = "<group>"; };
                0F66E16814DF3F1300B7B2E4 /* DFGAdjacencyList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DFGAdjacencyList.h; path = dfg/DFGAdjacencyList.h; sourceTree = "<group>"; };
                0F66E16914DF3F1300B7B2E4 /* DFGEdge.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DFGEdge.h; path = dfg/DFGEdge.h; sourceTree = "<group>"; };
+               0F6E5C181724AF3D005C574F /* WebKitLLVMLibraryAnchor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = WebKitLLVMLibraryAnchor.cpp; path = ftl/WebKitLLVMLibraryAnchor.cpp; sourceTree = "<group>"; };
                0F7025A71714B0F800382C0E /* DFGOSRExitCompilerCommon.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DFGOSRExitCompilerCommon.cpp; path = dfg/DFGOSRExitCompilerCommon.cpp; sourceTree = "<group>"; };
                0F7025A81714B0F800382C0E /* DFGOSRExitCompilerCommon.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DFGOSRExitCompilerCommon.h; path = dfg/DFGOSRExitCompilerCommon.h; sourceTree = "<group>"; };
                0F714CA116EA92ED00F3EBEB /* DFGBackwardsPropagationPhase.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DFGBackwardsPropagationPhase.cpp; path = dfg/DFGBackwardsPropagationPhase.cpp; sourceTree = "<group>"; };
                                0F235BCE17178E1C00690C7F /* FTLValueFormat.h */,
                                0F235BCF17178E1C00690C7F /* FTLValueSource.cpp */,
                                0F235BD017178E1C00690C7F /* FTLValueSource.h */,
+                               0F6E5C181724AF3D005C574F /* WebKitLLVMLibraryAnchor.cpp */,
                        );
                        name = ftl;
                        sourceTree = "<group>";
                                147F39BD107EC37600427A48 /* ArgList.cpp in Sources */,
                                147F39BE107EC37600427A48 /* Arguments.cpp in Sources */,
                                86D3B2C310156BDE002865E7 /* ARMAssembler.cpp in Sources */,
+                               0F6E5C191724AF3D005C574F /* WebKitLLVMLibraryAnchor.cpp in Sources */,
                                A74DE1D0120B875600D40D5B /* ARMv7Assembler.cpp in Sources */,
                                65C02850171795E200351E35 /* ARMv7Disassembler.cpp in Sources */,
                                65C0285C1717966800351E35 /* ARMv7DOpcode.cpp in Sources */,
diff --git a/Source/JavaScriptCore/ftl/WebKitLLVMLibraryAnchor.cpp b/Source/JavaScriptCore/ftl/WebKitLLVMLibraryAnchor.cpp
new file mode 100644 (file)
index 0000000..b8a62c7
--- /dev/null
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2013 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#include "config.h"
+
+#if ENABLE(FTL_JIT)
+// This is a hack for ensuring that the build system relinks JavaScriptCore if any
+// of the LLVM libraries are known to have changed.
+#include "WebKitLLVMLibraryToken.h"
+
+#endif
+
index 2c729fd..fa6b7fb 100644 (file)
@@ -1,5 +1,22 @@
 2013-07-16  Oliver Hunt <oliver@apple.com>
 
+        Merge dfgFourthTier r148850
+
+    2013-04-21  Filip Pizlo  <fpizlo@apple.com>
+
+        fourthTier: WebKit's build system should relink JavaScriptCore if LLVM's libraries changed but its headers didn't
+        https://bugs.webkit.org/show_bug.cgi?id=114926
+
+        Reviewed by Geoffrey Garen.
+        
+        If the LLVM libraries change, then touch a phony header, which will force relink
+        of JavaScriptCore.
+
+        * Scripts/copy-webkitlibraries-to-product-directory:
+        (unpackIfNecessary):
+
+2013-07-16  Oliver Hunt <oliver@apple.com>
+
         Merge dfgFourthTier r148848
 
     2013-04-21  Filip Pizlo  <fpizlo@apple.com>
index dd543aa..a7f1d1f 100755 (executable)
@@ -66,7 +66,9 @@ sub unpackIfNecessary
                 (system($ranlib, $targetDir . "/" . $library) == 0) or die;
             }
         }
+        return 1;
     }
+    return 0;
 }
 
 sub dittoHeaders
@@ -129,6 +131,8 @@ if ($ENV{ENABLE_FTL_JIT}) {
         return $contents eq $string;
     }
 
+    my $shouldUpdateLLVMLibraryToken = 0;
+
     if ($useOwnLLVM) {
         print("Building LLVM.\n");
         chdir $ownLLVMDirectory;
@@ -137,19 +141,20 @@ if ($ENV{ENABLE_FTL_JIT}) {
         my $numCPUs = $';
         (system("make -j $numCPUs") == 0) or die;
         chdirWebKit();
-    
+        
         my $ownLLVMBuildMode = "";
         if (fileContains($ownLLVMDirectory . "/Makefile.config", "ENABLE_OPTIMIZED=1")) {
             $ownLLVMBuildMode .= "Release";
         } else {
             $ownLLVMBuildMode .= "Debug";
         }
-    
+        
         # FIXME: Add support for builds that disable assertions.
         $ownLLVMBuildMode .= "+Asserts";
-    
+        
         my $librarySourceDirectory = "$ownLLVMDirectory/$ownLLVMBuildMode/lib";
         my $libraryTargetDirectory = $productDir;
+        $shouldUpdateLLVMLibraryToken = 0;
         print("Symlinking libraries from $librarySourceDirectory to $libraryTargetDirectory\n");
         opendir (my $dirHandle, $librarySourceDirectory);
         while (my $filename = readdir($dirHandle)) {
@@ -166,18 +171,32 @@ if ($ENV{ENABLE_FTL_JIT}) {
                 print "   Ranlib $filename\n";
                 (system($ranlib, $targetLibrary) == 0) or die;
                 (open my $fileHandle, ">", $ranlibToken) or die;
-                    print {$fileHandle} "$sourceLibrary";
-                    close $fileHandle;
+                print {$fileHandle} "$sourceLibrary";
+                close $fileHandle;
+                $shouldUpdateLLVMLibraryToken = 1;
             }
         }
         closedir $dirHandle;
+    } else {
+        $shouldUpdateLLVMLibraryToken =
+            unpackIfNecessary($productDir, "$productDir/libLLVMCore.a", $llvmLibraryPackage, 1);
+    }
+
+    if ($useOwnLLVM) {
         (system("rm", "-rf", "$productDir/usr/local/include/llvm") == 0) or die;
         (system("rm", "-rf", "$productDir/usr/local/include/llvm-c") == 0) or die;
         symlink("$ownLLVMDirectory/include/llvm", "$productDir/usr/local/include/llvm") or die;
         symlink("$ownLLVMDirectory/include/llvm-c", "$productDir/usr/local/include/llvm-c") or die;
     } else {
         unpackIfNecessary("$productDir/usr/local/include", "$productDir/usr/local/include/llvm-c/Core.h", $llvmIncludePackage, 0);
-        unpackIfNecessary($productDir, "$productDir/libLLVMCore.a", $llvmLibraryPackage, 1);
+    }
+
+    my $llvmLibraryToken = "$productDir/usr/local/include/WebKitLLVMLibraryToken.h";
+    if ($shouldUpdateLLVMLibraryToken || !-e $llvmLibraryToken) {
+        (open my $fileHandle, ">", $llvmLibraryToken) or die;
+        print {$fileHandle} "/* This file fools WebKit's build system into relinking JavaScriptCore if the LLVM libraries changed. */\n";
+        close $fileHandle;
     }
 
 }
+