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', |
826 }[arch] | 830 }[arch] |
| 831 |
827 arch_cflags = { | 832 arch_cflags = { |
828 'arm-linux': ['-mcpu=cortex-a9', '-D__arm_nonsfi_linux__'], | 833 'arm-linux': ['-mcpu=cortex-a9', '-D__arm_nonsfi_linux__'], |
829 'x86-32-linux': ['-m32'], | 834 'x86-32-linux': ['-m32'], |
830 'x86-32-mac': ['-m32'], | 835 'x86-32-mac': ['-m32'], |
| 836 'x86-64-linux': ['-mx32'], |
831 }[arch] | 837 }[arch] |
832 | 838 |
833 libs = { | 839 libs = { |
834 GSDJoin('unsandboxed_runtime', arch): { | 840 GSDJoin('unsandboxed_runtime', arch): { |
835 'type': TargetLibBuildType(is_canonical), | 841 'type': TargetLibBuildType(is_canonical), |
836 'output_subdir': os.path.join('translator', arch, 'lib'), | 842 'output_subdir': os.path.join('translator', arch, 'lib'), |
837 'dependencies': [ 'subzero_src', 'target_lib_compiler'], | 843 'dependencies': [ 'subzero_src', 'target_lib_compiler'], |
838 # This lib #includes | 844 # This lib #includes |
839 # arbitrary stuff from native_client/src/{include,untrusted,trusted} | 845 # arbitrary stuff from native_client/src/{include,untrusted,trusted} |
840 'inputs': { 'support': os.path.join(NACL_DIR, 'src', 'nonsfi', 'irt'), | 846 'inputs': { 'support': os.path.join(NACL_DIR, 'src', 'nonsfi', 'irt'), |
841 'untrusted': os.path.join( | 847 'untrusted': os.path.join( |
842 NACL_DIR, 'src', 'untrusted', 'irt'), | 848 NACL_DIR, 'src', 'untrusted', 'irt'), |
843 'include': os.path.join(NACL_DIR, 'src'), }, | 849 'include': os.path.join(NACL_DIR, 'src'), }, |
844 'commands': [ | 850 'commands': [ |
845 # The NaCl headers insist on having a platform macro such as | 851 # The NaCl headers insist on having a platform macro such as |
846 # NACL_LINUX defined, but src/nonsfi/irt_interfaces.c does not | 852 # NACL_LINUX defined, but src/nonsfi/irt_interfaces.c does not |
847 # itself use any of these macros, so defining NACL_LINUX here | 853 # itself use any of these macros, so defining NACL_LINUX here |
848 # even on non-Linux systems is OK. | 854 # even on non-Linux systems is OK. |
849 # TODO(dschuff): this include path breaks the input encapsulation | 855 # TODO(dschuff): this include path breaks the input encapsulation |
850 # for build rules. | 856 # for build rules. |
851 command.Command([prefix + 'gcc'] + arch_cflags + ['-O2', '-Wall', | 857 command.Command([compiler] + arch_cflags + ['-O2', '-Wall', |
852 '-Werror', '-I%(top_srcdir)s/..', | 858 '-Werror', '-I%(top_srcdir)s/..', |
853 '-DNACL_LINUX=1', '-DDEFINE_MAIN', | 859 '-DNACL_LINUX=1', '-DDEFINE_MAIN', |
854 '-c', command.path.join('%(support)s', 'irt_interfaces.c'), | 860 '-c', command.path.join('%(support)s', 'irt_interfaces.c'), |
855 '-o', command.path.join('%(output)s', 'unsandboxed_irt.o')]), | 861 '-o', command.path.join('%(output)s', 'unsandboxed_irt.o')]), |
856 command.Command([prefix + 'gcc'] + arch_cflags + ['-O2', '-Wall', | 862 command.Command([compiler] + arch_cflags + ['-O2', '-Wall', |
857 '-Werror', '-I%(top_srcdir)s/..', | 863 '-Werror', '-I%(top_srcdir)s/..', |
858 '-c', command.path.join('%(support)s', 'irt_random.c'), | 864 '-c', command.path.join('%(support)s', 'irt_random.c'), |
859 '-o', command.path.join('%(output)s', 'irt_random.o')]), | 865 '-o', command.path.join('%(output)s', 'irt_random.o')]), |
860 command.Command([prefix + 'gcc'] + arch_cflags + ['-O2', '-Wall', | 866 command.Command([compiler] + arch_cflags + ['-O2', '-Wall', |
861 '-Werror', '-I%(top_srcdir)s/..', | 867 '-Werror', '-I%(top_srcdir)s/..', |
862 '-c', command.path.join('%(untrusted)s', 'irt_query_list.c'), | 868 '-c', command.path.join('%(untrusted)s', 'irt_query_list.c'), |
863 '-o', command.path.join('%(output)s', 'irt_query_list.o')]), | 869 '-o', command.path.join('%(output)s', 'irt_query_list.o')]), |
864 ] + SubzeroRuntimeCommands(arch, '%(output)s'), | 870 ] + SubzeroRuntimeCommands(arch, '%(output)s'), |
865 }, | 871 }, |
866 } | 872 } |
867 return libs | 873 return libs |
868 | 874 |
869 | 875 |
870 def SDKCompiler(arches): | 876 def SDKCompiler(arches): |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
910 'includedir=' +os.path.join('%(output)s', | 916 'includedir=' +os.path.join('%(output)s', |
911 TripleFromArch(MultilibArch(arch)), | 917 TripleFromArch(MultilibArch(arch)), |
912 'include'), | 918 'include'), |
913 'libdir=' + os.path.join('%(output)s', MultilibLibDir(arch)), | 919 'libdir=' + os.path.join('%(output)s', MultilibLibDir(arch)), |
914 'install'] + scons_flags, | 920 'install'] + scons_flags, |
915 cwd=NACL_DIR), | 921 cwd=NACL_DIR), |
916 ], | 922 ], |
917 } | 923 } |
918 } | 924 } |
919 return libs | 925 return libs |
OLD | NEW |