Jan Voung | 8e32fed | 2015-06-17 10:16:23 -0700 | [diff] [blame] | 1 | #!/usr/bin/env python2 |
| 2 | |
| 3 | from collections import namedtuple |
Jan Voung | 112b6e8 | 2015-07-13 11:36:53 -0700 | [diff] [blame] | 4 | import glob |
| 5 | |
| 6 | |
| 7 | # Why have 'cross_headers': |
| 8 | # For some reason, clang doesn't know how to find some of the libstdc++ |
| 9 | # headers (c++config.h). Manually add in one of the paths: |
| 10 | # https://llvm.org/bugs/show_bug.cgi?id=22937 |
| 11 | # Otherwise, we could assume the system has arm-linux-gnueabihf-g++ and |
| 12 | # use that instead of clang, but so far we've just been using clang for |
| 13 | # the unsandboxed build. |
| 14 | def FindARMCrossInclude(): |
| 15 | return glob.glob( |
| 16 | '/usr/arm-linux-gnueabihf/include/c++/*/arm-linux-gnueabihf')[-1] |
| 17 | |
Jan Voung | 8e32fed | 2015-06-17 10:16:23 -0700 | [diff] [blame] | 18 | |
| 19 | TargetInfo = namedtuple('TargetInfo', |
Jan Voung | 112b6e8 | 2015-07-13 11:36:53 -0700 | [diff] [blame] | 20 | ['target', 'triple', 'llc_flags', 'ld_emu', |
| 21 | 'cross_headers']) |
Jan Voung | 8e32fed | 2015-06-17 10:16:23 -0700 | [diff] [blame] | 22 | |
| 23 | X8632Target = TargetInfo(target='x8632', |
| 24 | triple='i686-none-linux', |
| 25 | llc_flags=['-mcpu=pentium4m'], |
Jan Voung | 112b6e8 | 2015-07-13 11:36:53 -0700 | [diff] [blame] | 26 | ld_emu='elf_i386_nacl', |
| 27 | cross_headers=[]) |
Jan Voung | 8e32fed | 2015-06-17 10:16:23 -0700 | [diff] [blame] | 28 | |
| 29 | X8664Target = TargetInfo(target='x8664', |
| 30 | triple='x86_64-none-linux', |
| 31 | llc_flags=['-mcpu=x86-64'], |
Jan Voung | 112b6e8 | 2015-07-13 11:36:53 -0700 | [diff] [blame] | 32 | ld_emu='elf_x86_64_nacl', |
| 33 | cross_headers=[]) |
Jan Voung | 8e32fed | 2015-06-17 10:16:23 -0700 | [diff] [blame] | 34 | |
| 35 | ARM32Target = TargetInfo(target='arm32', |
| 36 | triple='armv7a-none-linux-gnueabihf', |
| 37 | llc_flags=['-mcpu=cortex-a9', |
| 38 | '-float-abi=hard', |
| 39 | '-mattr=+neon'], |
Jan Voung | 112b6e8 | 2015-07-13 11:36:53 -0700 | [diff] [blame] | 40 | ld_emu='armelf_nacl', |
| 41 | cross_headers=['-isystem', FindARMCrossInclude()]) |
Jan Voung | 8e32fed | 2015-06-17 10:16:23 -0700 | [diff] [blame] | 42 | |
Jan Voung | 8e32fed | 2015-06-17 10:16:23 -0700 | [diff] [blame] | 43 | def ConvertTripleToNaCl(nonsfi_triple): |
| 44 | return nonsfi_triple.replace('linux', 'nacl') |