OLD | NEW |
---|---|
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 target libs.""" | 6 """Recipes for PNaCl target libs.""" |
7 | 7 |
8 import fnmatch | 8 import fnmatch |
9 import os | 9 import os |
10 import sys | 10 import sys |
(...skipping 799 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
810 'unwind-dw2-fde-glibc.o', arch, no_nacl_gcc), | 810 'unwind-dw2-fde-glibc.o', arch, no_nacl_gcc), |
811 command.Command([PnaclTool('ar'), 'rc', | 811 command.Command([PnaclTool('ar'), 'rc', |
812 command.path.join('%(output)s', 'libgcc_eh.a'), | 812 command.path.join('%(output)s', 'libgcc_eh.a'), |
813 'unwind-dw2.o', 'unwind-dw2-fde-glibc.o']), | 813 'unwind-dw2.o', 'unwind-dw2-fde-glibc.o']), |
814 ], | 814 ], |
815 }, | 815 }, |
816 }) | 816 }) |
817 return libs | 817 return libs |
818 | 818 |
819 def UnsandboxedRuntime(arch, is_canonical): | 819 def UnsandboxedRuntime(arch, is_canonical): |
820 assert arch in ('arm-linux', 'x86-32-linux', 'x86-32-mac') | 820 assert arch in ('arm-linux', 'x86-32-linux', 'x86-32-mac', 'x86-64-linux') |
821 | 821 |
822 prefix = { | 822 compiler = { |
823 'arm-linux': 'arm-linux-gnueabihf-', | 823 'arm-linux': 'arm-linux-gnueabihf-gcc', |
824 'x86-32-linux': '', | 824 'x86-32-linux': 'gcc', |
825 'x86-32-mac': '', | 825 'x86-32-mac': 'gcc', |
826 # x86-64 can't use gcc because the gcc available in the bots does not | |
827 # support x32. clang is good enough for the task, and it is available in | |
828 # the bots. | |
829 'x86-64-linux': '%(abs_target_lib_compiler)s/bin/clang', | |
Petr Hosek
2015/12/22 17:26:41
Couldn't we use clang for other targets as well?
John
2015/12/22 18:12:00
clang fails to build the arm unsandboxed runtime:
| |
826 }[arch] | 830 }[arch] |
827 arch_cflags = { | 831 arch_cflags = { |
828 'arm-linux': ['-mcpu=cortex-a9', '-D__arm_nonsfi_linux__'], | 832 'arm-linux': ['-mcpu=cortex-a9', '-D__arm_nonsfi_linux__'], |
829 'x86-32-linux': ['-m32'], | 833 'x86-32-linux': ['-m32'], |
830 'x86-32-mac': ['-m32'], | 834 'x86-32-mac': ['-m32'], |
835 'x86-64-linux': ['-mx32'], | |
831 }[arch] | 836 }[arch] |
832 | 837 |
833 libs = { | 838 libs = { |
834 GSDJoin('unsandboxed_runtime', arch): { | 839 GSDJoin('unsandboxed_runtime', arch): { |
835 'type': TargetLibBuildType(is_canonical), | 840 'type': TargetLibBuildType(is_canonical), |
836 'output_subdir': os.path.join('translator', arch, 'lib'), | 841 'output_subdir': os.path.join('translator', arch, 'lib'), |
837 'dependencies': [ 'subzero_src', 'target_lib_compiler'], | 842 'dependencies': [ 'subzero_src', 'target_lib_compiler'], |
838 # This lib #includes | 843 # This lib #includes |
839 # arbitrary stuff from native_client/src/{include,untrusted,trusted} | 844 # arbitrary stuff from native_client/src/{include,untrusted,trusted} |
840 'inputs': { 'support': os.path.join(NACL_DIR, 'src', 'nonsfi', 'irt'), | 845 'inputs': { 'support': os.path.join(NACL_DIR, 'src', 'nonsfi', 'irt'), |
841 'untrusted': os.path.join( | 846 'untrusted': os.path.join( |
842 NACL_DIR, 'src', 'untrusted', 'irt'), | 847 NACL_DIR, 'src', 'untrusted', 'irt'), |
843 'include': os.path.join(NACL_DIR, 'src'), }, | 848 'include': os.path.join(NACL_DIR, 'src'), }, |
844 'commands': [ | 849 'commands': [ |
845 # The NaCl headers insist on having a platform macro such as | 850 # The NaCl headers insist on having a platform macro such as |
846 # NACL_LINUX defined, but src/nonsfi/irt_interfaces.c does not | 851 # NACL_LINUX defined, but src/nonsfi/irt_interfaces.c does not |
847 # itself use any of these macros, so defining NACL_LINUX here | 852 # itself use any of these macros, so defining NACL_LINUX here |
848 # even on non-Linux systems is OK. | 853 # even on non-Linux systems is OK. |
849 # TODO(dschuff): this include path breaks the input encapsulation | 854 # TODO(dschuff): this include path breaks the input encapsulation |
850 # for build rules. | 855 # for build rules. |
851 command.Command([prefix + 'gcc'] + arch_cflags + ['-O2', '-Wall', | 856 command.Command([compiler] + arch_cflags + ['-O2', '-Wall', |
852 '-Werror', '-I%(top_srcdir)s/..', | 857 '-Werror', '-I%(top_srcdir)s/..', |
853 '-DNACL_LINUX=1', '-DDEFINE_MAIN', | 858 '-DNACL_LINUX=1', '-DDEFINE_MAIN', |
854 '-c', command.path.join('%(support)s', 'irt_interfaces.c'), | 859 '-c', command.path.join('%(support)s', 'irt_interfaces.c'), |
855 '-o', command.path.join('%(output)s', 'unsandboxed_irt.o')]), | 860 '-o', command.path.join('%(output)s', 'unsandboxed_irt.o')]), |
856 command.Command([prefix + 'gcc'] + arch_cflags + ['-O2', '-Wall', | 861 command.Command([compiler] + arch_cflags + ['-O2', '-Wall', |
857 '-Werror', '-I%(top_srcdir)s/..', | 862 '-Werror', '-I%(top_srcdir)s/..', |
858 '-c', command.path.join('%(support)s', 'irt_random.c'), | 863 '-c', command.path.join('%(support)s', 'irt_random.c'), |
859 '-o', command.path.join('%(output)s', 'irt_random.o')]), | 864 '-o', command.path.join('%(output)s', 'irt_random.o')]), |
860 command.Command([prefix + 'gcc'] + arch_cflags + ['-O2', '-Wall', | 865 command.Command([compiler] + arch_cflags + ['-O2', '-Wall', |
861 '-Werror', '-I%(top_srcdir)s/..', | 866 '-Werror', '-I%(top_srcdir)s/..', |
862 '-c', command.path.join('%(untrusted)s', 'irt_query_list.c'), | 867 '-c', command.path.join('%(untrusted)s', 'irt_query_list.c'), |
863 '-o', command.path.join('%(output)s', 'irt_query_list.o')]), | 868 '-o', command.path.join('%(output)s', 'irt_query_list.o')]), |
864 ] + SubzeroRuntimeCommands(arch, '%(output)s'), | 869 ] + SubzeroRuntimeCommands(arch, '%(output)s'), |
865 }, | 870 }, |
866 } | 871 } |
867 return libs | 872 return libs |
868 | 873 |
869 | 874 |
870 def SDKCompiler(arches): | 875 def SDKCompiler(arches): |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
910 'includedir=' +os.path.join('%(output)s', | 915 'includedir=' +os.path.join('%(output)s', |
911 TripleFromArch(MultilibArch(arch)), | 916 TripleFromArch(MultilibArch(arch)), |
912 'include'), | 917 'include'), |
913 'libdir=' + os.path.join('%(output)s', MultilibLibDir(arch)), | 918 'libdir=' + os.path.join('%(output)s', MultilibLibDir(arch)), |
914 'install'] + scons_flags, | 919 'install'] + scons_flags, |
915 cwd=NACL_DIR), | 920 cwd=NACL_DIR), |
916 ], | 921 ], |
917 } | 922 } |
918 } | 923 } |
919 return libs | 924 return libs |
OLD | NEW |