Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(444)

Unified Diff: toolchain_build/toolchain_build_pnacl.py

Issue 867403003: Adding le32-nacl build of pnacl tools. (Closed) Base URL: https://chromium.googlesource.com/native_client/src/native_client.git@master
Patch Set: fix Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: toolchain_build/toolchain_build_pnacl.py
diff --git a/toolchain_build/toolchain_build_pnacl.py b/toolchain_build/toolchain_build_pnacl.py
index 277574c87b051b200e665c493870c237de1e9ed5..894c20697521b74f8b4b38084645fefb0c1da2f4 100755
--- a/toolchain_build/toolchain_build_pnacl.py
+++ b/toolchain_build/toolchain_build_pnacl.py
@@ -142,14 +142,26 @@ def CompilersForHost(host):
compiler = {
# For now we only do native builds for linux and mac
# treat 32-bit linux like a native build
- 'i686-linux': (CHROME_CLANG, CHROME_CLANGXX),
- 'x86_64-linux': (CHROME_CLANG, CHROME_CLANGXX),
- 'x86_64-apple-darwin': (CHROME_CLANG, CHROME_CLANGXX),
+ 'i686-linux': (CHROME_CLANG, CHROME_CLANGXX, 'ar', 'ranlib'),
+ 'x86_64-linux': (CHROME_CLANG, CHROME_CLANGXX, 'ar', 'ranlib'),
+ 'x86_64-apple-darwin': (CHROME_CLANG, CHROME_CLANGXX, 'ar', 'ranlib'),
# Windows build should work for native and cross
- 'i686-w64-mingw32': ('i686-w64-mingw32-gcc', 'i686-w64-mingw32-g++'),
+ 'i686-w64-mingw32': (
+ 'i686-w64-mingw32-gcc', 'i686-w64-mingw32-g++', 'ar', 'ranlib'),
# TODO: add arm-hosted support
- 'i686-pc-cygwin': ('gcc', 'g++'),
+ 'i686-pc-cygwin': ('gcc', 'g++', 'ar', 'ranlib'),
}
+ if host == 'le32-nacl':
+ nacl_sdk = os.environ.get('NACL_SDK_ROOT')
+ assert nacl_sdk, 'NACL_SDK_ROOT not set'
+ pnacl_bin_dir = os.path.join(nacl_sdk, 'toolchain/linux_pnacl/bin')
+ glibc_bin_dir = os.path.join(nacl_sdk, 'toolchain/linux_x86_glibc/bin')
+ compiler.update({
+ 'le32-nacl': (os.path.join(pnacl_bin_dir, 'pnacl-clang'),
+ os.path.join(pnacl_bin_dir, 'pnacl-clang++'),
+ os.path.join(pnacl_bin_dir, 'pnacl-ar'),
+ os.path.join(pnacl_bin_dir, 'pnacl-ranlib')),
+ })
return compiler[host]
@@ -178,13 +190,43 @@ def ConfigureHostArchFlags(host, extra_cflags, options):
# Chrome clang defaults to 64-bit builds, even when run on 32-bit Linux.
extra_cc_args = ['-m32']
+ if host == 'le32-nacl':
+ # Some code in llvm uses intrisics not supported in the pnacl stable
+ # abi.
+ extra_cc_args += ['--pnacl-disable-abi-check']
+
+ nacl_sdk = os.environ.get('NACL_SDK_ROOT')
+ assert nacl_sdk, 'NACL_SDK_ROOT not set'
+ linux_pnacl = os.path.join(nacl_sdk, 'toolchain/linux_pnacl')
+ usr_local = os.path.join(linux_pnacl, 'le32-nacl/usr')
+ extra_cc_args += ['-Dmain=nacl_main']
+ extra_cc_args += ['-include', 'nacl_main.h']
+ extra_cc_args += ['-include', 'spawn.h']
+ extra_cc_args += ['-I', os.path.join(usr_local, 'include', 'glibc-compat')]
+ extra_cc_args += ['-I', os.path.join(nacl_sdk, 'include')]
+ extra_cc_args += ['-I', os.path.join(usr_local, 'include')]
+ extra_cc_args += ['-L' + os.path.join(nacl_sdk, 'lib', 'pnacl', 'Release')]
+ extra_cc_args += ['-L' + os.path.join(linux_pnacl, 'sdk/lib')]
+ extra_cc_args += [
+ '-Wl,--undefined=PSUserCreateInstance',
+ '-Wl,--undefined=nacl_main',
+ '-Wl,--undefined=waitpid',
+ '-Wl,--undefined=spawnve',
+ '-Wl,--undefined=LLVMgold_onload',
+ '-lcli_main', '-pthread']
+ extra_cc_args += [
+ '-lppapi_simple', '-lnacl_spawn',
+ '-lnacl_io', '-lppapi_cpp', '-lppapi', '-lc++', '-lm', '-lglibc-compat']
+
extra_cxx_args = list(extra_cc_args)
Derek Schuff 2015/01/24 00:15:37 is there some particular reason why all the linker
bradn 2015/01/25 07:42:35 After a good bit of experimentation, it seems the
if not options.gcc:
- cc, cxx = CompilersForHost(host)
+ cc, cxx, ar, ranlib = CompilersForHost(host)
configure_args.append('CC=' + ' '.join([cc] + extra_cc_args))
configure_args.append('CXX=' + ' '.join([cxx] + extra_cxx_args))
+ configure_args.append('AR=' + ar)
+ configure_args.append('RANLIB=' + ranlib)
if TripleIsWindows(host):
# The i18n support brings in runtime dependencies on MinGW DLLs
@@ -197,6 +239,10 @@ def ConfigureHostArchFlags(host, extra_cflags, options):
if is_cross:
# LLVM's linux->mingw cross build needs this
configure_args.append('CC_FOR_BUILD=gcc')
+ elif host == 'le32-nacl':
+ configure_args.append('--disable-compiler-version-checks')
+ configure_args.append('ac_cv_func_vfork_works=no')
+ configure_args.append('--with-gold-ldadd=' + ' '.join(extra_cflags))
else:
if TripleIsMac(host):
# This is required for building with recent libc++ against OSX 10.6
@@ -215,7 +261,7 @@ def ConfigureHostArchFlags(host, extra_cflags, options):
def LibCxxHostArchFlags(host):
- cc, cxx = CompilersForHost(host)
+ cc, cxx, _, _ = CompilersForHost(host)
cmake_flags = []
cmake_flags.extend(['-DCMAKE_C_COMPILER='+cc, '-DCMAKE_CXX_COMPILER='+cxx])
if TripleIsLinux(host) and not TripleIsX8664(host):
@@ -227,7 +273,7 @@ def LibCxxHostArchFlags(host):
def CmakeHostArchFlags(host, options):
""" Set flags passed to LLVM cmake for compilers and compile flags. """
cmake_flags = []
- cc, cxx = CompilersForHost(host)
+ cc, cxx, _, _ = CompilersForHost(host)
cmake_flags.extend(['-DCMAKE_C_COMPILER='+cc, '-DCMAKE_CXX_COMPILER='+cxx])
@@ -391,7 +437,9 @@ def CopyHostLibcxxForLLVMBuild(host, dest, options):
command.Copy('%(' + GSDJoin('abs_libcxx', host) +')s/lib/' + libname,
os.path.join(dest, libname))]
-def CreateSymLinksToDirectToNaClTools():
+def CreateSymLinksToDirectToNaClTools(host):
+ if host == 'le32-nacl':
+ return []
return (
[command.Command(['ln', '-f',
command.path.join('%(output)s', 'bin','clang'),
@@ -470,19 +518,50 @@ def HostTools(host, options):
return file + '.exe'
else:
return file
+
+ werror = []
+ static_llvm_plugin = []
+ static_llvm_deps = []
+ if host == 'le32-nacl':
+ werror = ['--enable-werror=no']
+ static_llvm_deps = ['llvm_le32_nacl']
Derek Schuff 2015/01/24 00:15:37 this can be H('llvm')
bradn 2015/01/25 07:42:35 Done.
+ static_llvm_plugin = [
+ '-L%(abs_top_srcdir)s/toolchain_build/'
+ 'out/llvm_le32_nacl_work/Release+Asserts/lib',
+ '-Wl,--start-group',
+ '-lLLVMgold', '-lLLVMCodeGen', '-lLTO', '-lLLVMX86Disassembler',
Derek Schuff 2015/01/24 00:15:37 It occurs to be that we could make our le32 clang
bradn 2015/01/25 07:42:36 Agreed, though I'm torn as I have longer term ambi
+ '-lLLVMX86AsmParser', '-lLLVMX86CodeGen', '-lLLVMX86Desc',
+ '-lLLVMX86Info', '-lLLVMX86AsmPrinter', '-lLLVMX86Utils',
+ '-lLLVMARMDisassembler', '-lLLVMARMCodeGen', '-lLLVMNaClTransforms',
+ '-lLLVMARMAsmParser', '-lLLVMARMDesc', '-lLLVMARMInfo',
+ '-lLLVMARMAsmPrinter', '-lLLVMMipsDisassembler', '-lLLVMMipsCodeGen',
+ '-lLLVMSelectionDAG', '-lLLVMAsmPrinter', '-lLLVMCodeGen',
+ '-lLLVMMipsAsmParser', '-lLLVMMipsDesc', '-lLLVMMipsInfo',
+ '-lLLVMMipsAsmPrinter', '-lLLVMMCDisassembler', '-lLLVMLTO',
+ '-lLLVMMCParser', '-lLLVMLinker', '-lLLVMipo', '-lLLVMObjCARCOpts',
+ '-lLLVMVectorize', '-lLLVMScalarOpts', '-lLLVMInstCombine',
+ '-lLLVMTransformUtils', '-lLLVMipa', '-lLLVMBitWriter',
+ '-lLLVMBitReader', '-lLLVMAnalysis', '-lLLVMTarget', '-lLLVMMC',
+ '-lLLVMObject', '-lLLVMCore', '-lLLVMSupport',
+ '-Wl,--end-group',
+ ]
+
# Binutils still has some warnings when building with clang
if not options.gcc:
warning_flags = ['-Wno-extended-offsetof', '-Wno-absolute-value',
'-Wno-unused-function', '-Wno-unused-const-variable',
'-Wno-unneeded-internal-declaration',
'-Wno-unused-private-field', '-Wno-format-security']
+ if host == 'le32-nacl':
+ warning_flags += ['-Wno-invalid-noreturn']
else:
warning_flags = ['-Wno-unused-function', '-Wno-unused-value']
+
tools = {
# The binutils_pnacl package is used both for bitcode linking (gold) and
# for its conventional use with arm-nacl-clang.
H('binutils_pnacl'): {
- 'dependencies': ['binutils_pnacl_src'],
+ 'dependencies': ['binutils_pnacl_src'] + static_llvm_deps,
'type': 'build',
'inputs' : { 'macros': os.path.join(NACL_DIR,
'pnacl', 'support', 'clang_direct', 'nacl-arm-macros.s')},
@@ -491,7 +570,8 @@ def HostTools(host, options):
'sh',
'%(binutils_pnacl_src)s/configure'] +
ConfigureBinutilsCommon() +
- ConfigureHostArchFlags(host, warning_flags, options) +
+ ConfigureHostArchFlags( host, warning_flags +
+ static_llvm_plugin, options) +
['--target=arm-nacl',
'--program-prefix=le32-nacl-',
'--enable-targets=arm-nacl,i686-nacl,x86_64-nacl,' +
@@ -500,7 +580,7 @@ def HostTools(host, options):
'--enable-gold=default',
'--enable-plugins',
'--without-gas',
- '--with-sysroot=/le32-nacl']),
+ '--with-sysroot=/le32-nacl'] + werror),
command.Command(MakeCommand(host)),
command.Command(MAKE_DESTDIR_CMD + ['install-strip'])] +
[command.RemoveDirectory(os.path.join('%(output)s', dir))
@@ -565,9 +645,13 @@ def HostTools(host, options):
command.Command(['ninja', '-v']),
command.Command(['ninja', 'install']),
] +
- CreateSymLinksToDirectToNaClTools()
+ CreateSymLinksToDirectToNaClTools(host)
},
}
+ if host == 'le32-nacl':
+ shared = []
+ else:
+ shared = ['--enable-shared']
llvm_autoconf = {
H('llvm'): {
'dependencies': ['clang_src', 'llvm_src', 'binutils_pnacl_src',
@@ -580,7 +664,6 @@ def HostTools(host, options):
ConfigureHostArchFlags(host, [], options) +
LLVMConfigureAssertionsFlags(options) +
['--prefix=/',
- '--enable-shared',
'--disable-zlib',
'--disable-terminfo',
'--disable-jit',
@@ -589,7 +672,7 @@ def HostTools(host, options):
'--enable-targets=x86,arm,mips',
'--program-prefix=',
'--enable-optimized',
- '--with-clang-srcdir=%(abs_clang_src)s'])] +
+ '--with-clang-srcdir=%(abs_clang_src)s'] + shared)] +
CopyHostLibcxxForLLVMBuild(
host,
os.path.join('Release+Asserts', 'lib'),
@@ -597,6 +680,7 @@ def HostTools(host, options):
[command.Command(MakeCommand(host) + [
'VERBOSE=1',
'NACL_SANDBOX=0',
+ 'PNACL_BROWSER_TRANSLATOR=0',
'SUBZERO_SRC_ROOT=%(abs_subzero_src)s',
'all']),
command.Command(MAKE_DESTDIR_CMD + ['install']),
@@ -606,7 +690,7 @@ def HostTools(host, options):
Exe('clang-format'), Exe('clang-check'),
Exe('c-index-test'), Exe('clang-tblgen'),
Exe('llvm-tblgen')])] +
- CreateSymLinksToDirectToNaClTools() +
+ CreateSymLinksToDirectToNaClTools(host) +
CopyWindowsHostLibs(host),
},
}
@@ -617,6 +701,9 @@ def HostTools(host, options):
if TripleIsWindows(host):
tools[H('binutils_pnacl')]['dependencies'].append('libdl')
tools[H('llvm')]['dependencies'].append('libdl')
+ elif host == 'le32-nacl':
+ # PNaCl's libcxx is new enough.
+ pass
elif not options.gcc:
Derek Schuff 2015/01/24 00:15:37 how about elif not options.gcc and host != 'le32-n
bradn 2015/01/25 07:42:36 Done.
tools[H('binutils_pnacl')]['dependencies'].append(H('libcxx'))
tools[H('llvm')]['dependencies'].append(H('libcxx'))
@@ -678,7 +765,7 @@ def Metadata(revisions, is_canonical):
return data
-def HostToolsDirectToNacl(host):
+def HostToolsDirectToNacl(host, options):
Derek Schuff 2015/01/24 00:15:37 is this necessary?
bradn 2015/01/25 07:42:36 Nope. dropped
def H(component_name):
return GSDJoin(component_name, host)
@@ -992,12 +1079,14 @@ if __name__ == '__main__':
packages.update(TestsuiteSources(GetGitSyncCmdsCallback(rev)))
hosts = [pynacl.platform.PlatformTriple()]
+ if pynacl.platform.IsLinux64():
+ hosts.append('le32-nacl')
Derek Schuff 2015/01/24 00:15:37 won't this cause it to be built on the toolchain b
bradn 2015/01/25 07:42:36 Changed to a separate command line option as we di
if pynacl.platform.IsLinux() and BUILD_CROSS_MINGW:
hosts.append(pynacl.platform.PlatformTriple('win', 'x86-32'))
for host in hosts:
packages.update(HostLibs(host, args))
packages.update(HostTools(host, args))
- packages.update(HostToolsDirectToNacl(host))
+ packages.update(HostToolsDirectToNacl(host, args))
Derek Schuff 2015/01/24 00:15:37 is the extra flag necessary? And, are you actually
bradn 2015/01/25 07:42:36 Nope, dropped.
packages.update(TargetLibCompiler(pynacl.platform.PlatformTriple(), args))
# Don't build the target libs on Windows because of pathname issues.
# Only the linux64 bot is canonical (i.e. it will upload its packages).
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698