[zorg] r176981 - The LTO phased clang builder was having issues finding the right libLTO. This patch should hopefully fix that.

Michael Gottesman mgottesman at apple.com
Wed Mar 13 14:51:17 PDT 2013


Author: mgottesman
Date: Wed Mar 13 16:51:16 2013
New Revision: 176981

URL: http://llvm.org/viewvc/llvm-project?rev=176981&view=rev
Log:
The LTO phased clang builder was having issues finding the right libLTO. This patch should hopefully fix that.

Modified:
    zorg/trunk/zorg/buildbot/PhasedBuilderUtils.py
    zorg/trunk/zorg/buildbot/builders/ClangBuilder.py

Modified: zorg/trunk/zorg/buildbot/PhasedBuilderUtils.py
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/zorg/buildbot/PhasedBuilderUtils.py?rev=176981&r1=176980&r2=176981&view=diff
==============================================================================
--- zorg/trunk/zorg/buildbot/PhasedBuilderUtils.py (original)
+++ zorg/trunk/zorg/buildbot/PhasedBuilderUtils.py Wed Mar 13 16:51:16 2013
@@ -149,6 +149,14 @@ def find_cxx(status, stdin, stdout):
             return { 'cxx_path' : cxx_path }
     return {}
 
+def find_liblto(status, stdin, stdout):
+    lines = filter(bool, stdin.split('\n'))
+    for line in lines:
+        if 'lib/libLTO.dylib' in line:
+            liblto_path = line
+            return { 'liblto_path' : liblto_path }
+    return {}
+
 def determine_phase_id(props):
     # phase_id should be generated by the first phase to run and copied as a
     # propery to downstream builds

Modified: zorg/trunk/zorg/buildbot/builders/ClangBuilder.py
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/zorg/buildbot/builders/ClangBuilder.py?rev=176981&r1=176980&r2=176981&view=diff
==============================================================================
--- zorg/trunk/zorg/buildbot/builders/ClangBuilder.py (original)
+++ zorg/trunk/zorg/buildbot/builders/ClangBuilder.py Wed Mar 13 16:51:16 2013
@@ -14,6 +14,7 @@ from zorg.buildbot.commands import Suppr
 from zorg.buildbot.commands.BatchFileDownload import BatchFileDownload
 from zorg.buildbot.commands.LitTestCommand import LitTestCommand
 from zorg.buildbot.PhasedBuilderUtils import GetLatestValidated, find_cc
+from zorg.buildbot.PhasedBuilderUtils import find_liblto
 
 def getClangBuildFactory(
             triple=None,
@@ -711,12 +712,7 @@ def phasedClang(config_options, is_boots
                            '--without-llvmgcc', '--without-llvmgxx',
                            '--enable-keep-symbols'])
     configure_args.append(
-        WithProperties('--prefix=%(builddir)s/clang-install'))
-    
-    # If we need to use lto, add in proper flags here.
-    if use_lto:
-      configure_args.append(
-        '--with-extra-options=-flto -gline-tables-only')
+        WithProperties('--prefix=%(builddir)s/clang-install'))    
     
     # If we are using a previously built compiler, download it and override CC
     # and CXX.
@@ -737,14 +733,30 @@ def phasedClang(config_options, is_boots
     configure_args.extend([
             WithProperties('CC=%(builddir)s/%(cc_path)s'),
             WithProperties('CXX=%(builddir)s/%(cc_path)s++')])
+    
+    # If we need to use lto, find liblto, add in proper flags here, etc.
+    if use_lto:
+        liblto_command = ['find', 'host-compiler', '-name', 'libLTO.dylib']
+        f.addStep(buildbot.steps.shell.ShellCommand(
+                name='find.liblto',
+                command=liblto_command,
+                extract_fn=find_liblto,
+                workdir=WithProperties('%(builddir)s')))
+        configure_args.append(
+          '--with-extra-options=-flto -gline-tables-only')
+    
     # Configure the LLVM build.
     f.addStep(buildbot.steps.shell.ShellCommand(
               name='configure.with.host', command=configure_args,
               haltOnFailure=True, description=['configure'],
               workdir=clang_build_dir))
     # Build the compiler.
+    make_command = ['make', '-j', WithProperties('%(jobs)s')]
+    if use_lto:
+        make_command.append(WithProperties('DYLD_LIBRARY_PATH=%(liblto_path)s'))
+    
     f.addStep(buildbot.steps.shell.ShellCommand(
-              name='make', command=['make', '-j', WithProperties('%(jobs)s')],
+              name='make', command=make_command,
               haltOnFailure=True, description=['make'], workdir=clang_build_dir))
     # Use make install-clang to produce minimal archive for use by downstream
     # builders.





More information about the llvm-commits mailing list