Index: toolchain_build/toolchain_build_pnacl.py |
diff --git a/toolchain_build/toolchain_build_pnacl.py b/toolchain_build/toolchain_build_pnacl.py |
index 985a520e4df8305c1792ee696d1c182a95a89ed9..218ddd9cddcb30dadfc2c3d33ea395aac5d65d17 100755 |
--- a/toolchain_build/toolchain_build_pnacl.py |
+++ b/toolchain_build/toolchain_build_pnacl.py |
@@ -272,18 +272,23 @@ def HostArchToolFlags(host, extra_cflags, opts): |
if TripleIsLinux(host) and not TripleIsX8664(host): |
# Chrome clang defaults to 64-bit builds, even when run on 32-bit Linux. |
extra_cc_flags += ['-m32'] |
- if opts.gcc or host == 'le32-nacl': |
- result['CFLAGS'] += extra_cc_flags |
- result['CXXFLAGS'] += extra_cc_flags |
- else: |
- result['CFLAGS'] += extra_cc_flags |
- result['LDFLAGS'] += ['-L%(' + FlavoredName('abs_libcxx', |
+ if not opts.gcc and host != 'le32-nacl': |
+ # On mac and linux, use libc++ instead of libstdc++ (which is too old on |
+ # Ubuntu Precise and any OSX to build LLVM) |
+ result['CXXFLAGS'] += ['-stdlib=libc++'] |
+ if TripleIsLinux(host): |
+ # Use our own libc++ on Linux. |
+ # TODO(dschuff): Get the Chrome clang maintainers to build libc++ for |
+ # Linux too and use that. |
+ result['CXXFLAGS'] += ['-I%(' + FlavoredName('abs_libcxx', host, opts) + |
+ ')s/include/c++/v1'] |
+ result['LDFLAGS'] += ['-L%(' + FlavoredName('abs_libcxx', |
host, opts) + ')s/lib'] |
- result['CXXFLAGS'] += ([ |
- '-stdlib=libc++', |
- '-I%(' + FlavoredName('abs_libcxx', host, opts) + ')s/include/c++/v1'] + |
- extra_cc_flags) |
- deps.append(FlavoredName('libcxx', host, opts)) |
+ deps.append(FlavoredName('libcxx', host, opts)) |
+ |
+ result['CFLAGS'] += extra_cc_flags |
+ result['CXXFLAGS'] += extra_cc_flags |
+ |
return result, deps |
@@ -572,14 +577,9 @@ def TestsuiteSources(GetGitSyncCmds): |
def CopyHostLibcxxForLLVMBuild(host, dest, options): |
"""Copy libc++ to the working directory for build tools.""" |
- if options.gcc: |
- return [] |
- if TripleIsLinux(host): |
- libname = 'libc++.so.1' |
- elif TripleIsMac(host): |
- libname = 'libc++.1.dylib' |
- else: |
+ if options.gcc or not TripleIsLinux(host): |
return [] |
+ libname = 'libc++.so.1' |
return [command.Mkdir(dest, parents=True), |
command.Copy('%(' + |
FlavoredName('abs_libcxx', host, options) +')s/lib/' + |
@@ -631,8 +631,8 @@ def HostLibs(host, options): |
], |
}, |
}) |
- elif not options.gcc: |
- # Libc++ is only tested with the clang build |
+ elif TripleIsLinux(host) and not options.gcc: |
+ # Our Libc++ is only needed for Precise and only tested with clang. |
libcxx_host_arch_flags, libcxx_inputs = LibCxxHostArchFlags(host) |
libs.update({ |
H('libcxx'): { |
@@ -950,7 +950,7 @@ def TargetLibCompiler(host, options): |
}, |
} |
- if TripleIsWindows(host) or not options.gcc: |
+ if TripleIsWindows(host) or TripleIsLinux(host) and not options.gcc: |
host_lib = 'libdl' if TripleIsWindows(host) else H('libcxx') |
compiler['target_lib_compiler']['dependencies'].append(host_lib) |
compiler['target_lib_compiler']['commands'].append( |
@@ -1198,7 +1198,7 @@ def GetUploadPackageTargets(): |
'binutils_x86_%s' % legal_triple, |
'llvm_%s' % legal_triple, |
'driver_%s' % legal_triple]) |
- if os_name != 'win': |
+ if os_name == 'linux': |
host_packages[os_name].append('libcxx_%s' % legal_triple) |
# Unsandboxed target IRT libraries |