Chromium Code Reviews

Side by Side Diff: toolchain_build/toolchain_build_pnacl.py

Issue 863093002: Enable -Werror for LLVM build (Closed) Base URL: https://chromium.googlesource.com/native_client/src/native_client.git@master
Patch Set: Disable -Werror on the Windows build of binutils. Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff |
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/python 1 #!/usr/bin/python
2 # Copyright (c) 2013 The Native Client Authors. All rights reserved. 2 # Copyright (c) 2013 The Native Client Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """Recipes for PNaCl toolchain packages. 6 """Recipes for PNaCl toolchain packages.
7 7
8 Recipes consist of specially-structured dictionaries, with keys for package 8 Recipes consist of specially-structured dictionaries, with keys for package
9 name, type, commands to execute, etc. The structure is documented in the 9 name, type, commands to execute, etc. The structure is documented in the
10 PackageBuilder docstring in toolchain_main.py. 10 PackageBuilder docstring in toolchain_main.py.
(...skipping 475 matching lines...)
486 def H(component_name): 486 def H(component_name):
487 # Return a package name for a component name with a host triple. 487 # Return a package name for a component name with a host triple.
488 return GSDJoin(component_name, host) 488 return GSDJoin(component_name, host)
489 # Return the file name with the appropriate suffix for an executable file. 489 # Return the file name with the appropriate suffix for an executable file.
490 def Exe(file): 490 def Exe(file):
491 if TripleIsWindows(host): 491 if TripleIsWindows(host):
492 return file + '.exe' 492 return file + '.exe'
493 else: 493 else:
494 return file 494 return file
495 495
496 werror = [] 496 # TODO(jfb): gold's build currently generates the following error on Windows:
497 # too many arguments for format.
498 binutils_do_werror = not TripleIsWindows(host)
497 extra_gold_deps = [] 499 extra_gold_deps = []
498 if host == 'le32-nacl': 500 if host == 'le32-nacl':
499 # TODO(bradnelson): Fix warnings so this can go away. 501 # TODO(bradnelson): Fix warnings so this can go away.
500 werror = ['--enable-werror=no'] 502 binutils_do_werror = False
501 extra_gold_deps = [H('llvm')] 503 extra_gold_deps = [H('llvm')]
502 504
503 # Binutils still has some warnings when building with clang 505 # Binutils still has some warnings when building with clang
504 if not options.gcc: 506 if not options.gcc:
505 warning_flags = ['-Wno-extended-offsetof', '-Wno-absolute-value', 507 warning_flags = ['-Wno-extended-offsetof', '-Wno-absolute-value',
506 '-Wno-unused-function', '-Wno-unused-const-variable', 508 '-Wno-unused-function', '-Wno-unused-const-variable',
507 '-Wno-unneeded-internal-declaration', 509 '-Wno-unneeded-internal-declaration',
508 '-Wno-unused-private-field', '-Wno-format-security'] 510 '-Wno-unused-private-field', '-Wno-format-security']
509 else: 511 else:
510 warning_flags = ['-Wno-unused-function', '-Wno-unused-value'] 512 warning_flags = ['-Wno-unused-function', '-Wno-unused-value']
511 513
512 tools = { 514 tools = {
513 # The binutils_pnacl package is used both for bitcode linking (gold) and 515 # The binutils_pnacl package is used both for bitcode linking (gold) and
514 # for its conventional use with arm-nacl-clang. 516 # for its conventional use with arm-nacl-clang.
515 H('binutils_pnacl'): { 517 H('binutils_pnacl'): {
516 'dependencies': ['binutils_pnacl_src'] + extra_gold_deps, 518 'dependencies': ['binutils_pnacl_src'] + extra_gold_deps,
517 'type': 'build', 519 'type': 'build',
518 'inputs' : { 'macros': os.path.join(NACL_DIR, 520 'inputs' : { 'macros': os.path.join(NACL_DIR,
519 'pnacl', 'support', 'clang_direct', 'nacl-arm-macros.s')}, 521 'pnacl', 'support', 'clang_direct', 'nacl-arm-macros.s')},
520 'commands': [ 522 'commands': [
521 command.SkipForIncrementalCommand([ 523 command.SkipForIncrementalCommand([
522 'sh', 524 'sh',
523 '%(binutils_pnacl_src)s/configure'] + 525 '%(binutils_pnacl_src)s/configure'] +
524 ConfigureBinutilsCommon() + 526 ConfigureBinutilsCommon() +
525 ConfigureHostArchFlags( 527 ConfigureHostArchFlags(
526 host, warning_flags, options, 528 host, warning_flags, options,
527 options.binutils_pnacl_extra_configure) + 529 options.binutils_pnacl_extra_configure) +
528 ['--target=arm-nacl', 530 [
529 '--program-prefix=le32-nacl-',
530 '--enable-targets=arm-nacl,i686-nacl,x86_64-nacl,' +
531 'mipsel-nacl',
532 '--enable-shared=no',
533 '--enable-gold=default', 531 '--enable-gold=default',
534 '--enable-plugins', 532 '--enable-plugins',
535 '--without-gas', 533 '--enable-shared=no',
536 '--with-sysroot=/le32-nacl'] + werror), 534 '--enable-targets=arm-nacl,i686-nacl,x86_64-nacl,mipsel-nacl',
535 '--enable-werror=' + ('yes' if binutils_do_werror else 'no'),
536 '--program-prefix=le32-nacl-',
537 '--target=arm-nacl',
538 '--with-sysroot=/le32-nacl',
539 '--without-gas'
540 ]),
537 command.Command(MakeCommand(host)), 541 command.Command(MakeCommand(host)),
538 command.Command(MAKE_DESTDIR_CMD + ['install-strip'])] + 542 command.Command(MAKE_DESTDIR_CMD + ['install-strip'])] +
539 [command.RemoveDirectory(os.path.join('%(output)s', dir)) 543 [command.RemoveDirectory(os.path.join('%(output)s', dir))
540 for dir in ('lib', 'lib32')] + 544 for dir in ('lib', 'lib32')] +
541 # Since it has dual use, just create links for both sets of names 545 # Since it has dual use, just create links for both sets of names
542 # (i.e. le32-nacl-foo and arm-nacl-foo) 546 # (i.e. le32-nacl-foo and arm-nacl-foo)
543 # TODO(dschuff): Use the redirector scripts here like binutils_x86 547 # TODO(dschuff): Use the redirector scripts here like binutils_x86
544 [command.Command([ 548 [command.Command([
545 'ln', '-f', 549 'ln', '-f',
546 command.path.join('%(output)s', 'bin', 'le32-nacl-' + tool), 550 command.path.join('%(output)s', 'bin', 'le32-nacl-' + tool),
(...skipping 20 matching lines...)
567 command.Runnable( 571 command.Runnable(
568 None, 572 None,
569 pnacl_commands.InstallDriverScripts, 573 pnacl_commands.InstallDriverScripts,
570 '%(src)s', '%(output)s', 574 '%(src)s', '%(output)s',
571 host_windows=TripleIsWindows(host) or TripleIsCygWin(host), 575 host_windows=TripleIsWindows(host) or TripleIsCygWin(host),
572 host_64bit=TripleIsX8664(host)) 576 host_64bit=TripleIsX8664(host))
573 ], 577 ],
574 }, 578 },
575 } 579 }
576 580
581 # TODO(jfb) Windows currently uses MinGW's GCC 4.8.1 which generates warnings
582 # on upstream LLVM code. Turn on -Werror once these are fixed.
583 llvm_do_werror = not TripleIsWindows(host)
584
577 llvm_cmake = { 585 llvm_cmake = {
578 H('llvm'): { 586 H('llvm'): {
579 'dependencies': ['clang_src', 'llvm_src', 'binutils_pnacl_src'], 587 'dependencies': ['clang_src', 'llvm_src', 'binutils_pnacl_src'],
580 'type': 'build', 588 'type': 'build',
581 'commands': [ 589 'commands': [
582 command.SkipForIncrementalCommand([ 590 command.SkipForIncrementalCommand([
583 'cmake', '-G', 'Ninja'] + 591 'cmake', '-G', 'Ninja'] +
584 CmakeHostArchFlags(host, options) + 592 CmakeHostArchFlags(host, options) +
585 ['-DCMAKE_BUILD_TYPE=RelWithDebInfo', 593 [
594 '-DBUILD_SHARED_LIBS=ON',
595 '-DCMAKE_BUILD_TYPE=RelWithDebInfo',
586 '-DCMAKE_INSTALL_PREFIX=%(output)s', 596 '-DCMAKE_INSTALL_PREFIX=%(output)s',
587 '-DCMAKE_INSTALL_RPATH=$ORIGIN/../lib', 597 '-DCMAKE_INSTALL_RPATH=$ORIGIN/../lib',
588 '-DLLVM_ENABLE_LIBCXX=OFF',
589 '-DBUILD_SHARED_LIBS=ON',
590 '-DLLVM_TARGETS_TO_BUILD=X86;ARM;Mips',
591 '-DLLVM_ENABLE_ASSERTIONS=ON',
592 '-DLLVM_ENABLE_ZLIB=OFF',
593 '-DLLVM_BUILD_TESTS=ON',
594 '-DLLVM_APPEND_VC_REV=ON', 598 '-DLLVM_APPEND_VC_REV=ON',
595 '-DLLVM_BINUTILS_INCDIR=%(abs_binutils_pnacl_src)s/include', 599 '-DLLVM_BINUTILS_INCDIR=%(abs_binutils_pnacl_src)s/include',
600 '-DLLVM_BUILD_TESTS=ON',
601 '-DLLVM_ENABLE_ASSERTIONS=ON',
602 '-DLLVM_ENABLE_LIBCXX=OFF',
603 '-LLVM_ENABLE_WERROR=' + ('ON' if llvm_do_werror else 'OFF'),
604 '-DLLVM_ENABLE_ZLIB=OFF',
596 '-DLLVM_EXTERNAL_CLANG_SOURCE_DIR=%(clang_src)s', 605 '-DLLVM_EXTERNAL_CLANG_SOURCE_DIR=%(clang_src)s',
606 '-DLLVM_TARGETS_TO_BUILD=X86;ARM;Mips',
597 '%(llvm_src)s']), 607 '%(llvm_src)s']),
598 command.Command(['ninja', '-v']), 608 command.Command(['ninja', '-v']),
599 command.Command(['ninja', 'install']), 609 command.Command(['ninja', 'install']),
600 ] + 610 ] +
601 CreateSymLinksToDirectToNaClTools(host) 611 CreateSymLinksToDirectToNaClTools(host)
602 }, 612 },
603 } 613 }
604 cleanup_static_libs = [] 614 cleanup_static_libs = []
605 shared = [] 615 shared = []
606 if host != 'le32-nacl': 616 if host != 'le32-nacl':
607 shared = ['--enable-shared'] 617 shared = ['--enable-shared']
608 cleanup_static_libs = [ 618 cleanup_static_libs = [
609 command.Remove(*[os.path.join('%(output)s', 'lib', f) for f 619 command.Remove(*[os.path.join('%(output)s', 'lib', f) for f
610 in '*.a', '*Hello.*', 'BugpointPasses.*']), 620 in '*.a', '*Hello.*', 'BugpointPasses.*']),
611 ] 621 ]
612 llvm_autoconf = { 622 llvm_autoconf = {
613 H('llvm'): { 623 H('llvm'): {
614 'dependencies': ['clang_src', 'llvm_src', 'binutils_pnacl_src', 624 'dependencies': ['clang_src', 'llvm_src', 'binutils_pnacl_src',
615 'subzero_src'], 625 'subzero_src'],
616 'type': 'build', 626 'type': 'build',
617 'commands': [ 627 'commands': [
618 command.SkipForIncrementalCommand([ 628 command.SkipForIncrementalCommand([
619 'sh', 629 'sh',
620 '%(llvm_src)s/configure'] + 630 '%(llvm_src)s/configure'] +
621 ConfigureHostArchFlags(host, [], options) + 631 ConfigureHostArchFlags(host, [], options) +
622 LLVMConfigureAssertionsFlags(options) + 632 LLVMConfigureAssertionsFlags(options) +
623 ['--prefix=/', 633 [
634 '--disable-bindings', # ocaml is currently the only binding.
635 '--disable-jit',
636 '--disable-terminfo',
624 '--disable-zlib', 637 '--disable-zlib',
625 '--disable-terminfo', 638 '--enable-optimized',
626 '--disable-jit', 639 '--enable-targets=x86,arm,mips',
627 '--disable-bindings', # ocaml is currently the only binding. 640 '--enable-werror=' + ('yes' if llvm_do_werror else 'no'),
641 '--prefix=/',
642 '--program-prefix=',
628 '--with-binutils-include=%(abs_binutils_pnacl_src)s/include', 643 '--with-binutils-include=%(abs_binutils_pnacl_src)s/include',
629 '--enable-targets=x86,arm,mips', 644 '--with-clang-srcdir=%(abs_clang_src)s'
630 '--program-prefix=', 645 ] + shared)] +
631 '--enable-optimized',
632 '--with-clang-srcdir=%(abs_clang_src)s'] + shared)] +
633 CopyHostLibcxxForLLVMBuild( 646 CopyHostLibcxxForLLVMBuild(
634 host, 647 host,
635 os.path.join('Release+Asserts', 'lib'), 648 os.path.join('Release+Asserts', 'lib'),
636 options) + 649 options) +
637 [command.Command(MakeCommand(host) + [ 650 [command.Command(MakeCommand(host) + [
638 'VERBOSE=1', 651 'VERBOSE=1',
639 'NACL_SANDBOX=0', 652 'NACL_SANDBOX=0',
640 'PNACL_BROWSER_TRANSLATOR=0', 653 'PNACL_BROWSER_TRANSLATOR=0',
641 'SUBZERO_SRC_ROOT=%(abs_subzero_src)s', 654 'SUBZERO_SRC_ROOT=%(abs_subzero_src)s',
642 'all']), 655 'all']),
(...skipping 431 matching lines...)
1074 'x86-32-%s' % pynacl.platform.GetOS(), unsandboxed_irt_canonical)) 1087 'x86-32-%s' % pynacl.platform.GetOS(), unsandboxed_irt_canonical))
1075 1088
1076 if args.build_sbtc and not args.pnacl_in_pnacl: 1089 if args.build_sbtc and not args.pnacl_in_pnacl:
1077 packages.update(pnacl_sandboxed_translator.SandboxedTranslators( 1090 packages.update(pnacl_sandboxed_translator.SandboxedTranslators(
1078 SANDBOXED_TRANSLATOR_ARCHES)) 1091 SANDBOXED_TRANSLATOR_ARCHES))
1079 1092
1080 tb = toolchain_main.PackageBuilder(packages, 1093 tb = toolchain_main.PackageBuilder(packages,
1081 upload_packages, 1094 upload_packages,
1082 leftover_args) 1095 leftover_args)
1083 tb.Main() 1096 tb.Main()
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine