blob: 3635e13142afda9fb855f2b98a7100a1ece41190 [file] [log] [blame]
Jan Voung8e32fed2015-06-17 10:16:23 -07001#!/usr/bin/env python2
2
3from collections import namedtuple
Jan Voung112b6e82015-07-13 11:36:53 -07004import 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.
14def FindARMCrossInclude():
15 return glob.glob(
16 '/usr/arm-linux-gnueabihf/include/c++/*/arm-linux-gnueabihf')[-1]
17
Jan Voung8e32fed2015-06-17 10:16:23 -070018
19TargetInfo = namedtuple('TargetInfo',
Jan Voung112b6e82015-07-13 11:36:53 -070020 ['target', 'triple', 'llc_flags', 'ld_emu',
21 'cross_headers'])
Jan Voung8e32fed2015-06-17 10:16:23 -070022
23X8632Target = TargetInfo(target='x8632',
24 triple='i686-none-linux',
25 llc_flags=['-mcpu=pentium4m'],
Jan Voung112b6e82015-07-13 11:36:53 -070026 ld_emu='elf_i386_nacl',
27 cross_headers=[])
Jan Voung8e32fed2015-06-17 10:16:23 -070028
29X8664Target = TargetInfo(target='x8664',
30 triple='x86_64-none-linux',
31 llc_flags=['-mcpu=x86-64'],
Jan Voung112b6e82015-07-13 11:36:53 -070032 ld_emu='elf_x86_64_nacl',
33 cross_headers=[])
Jan Voung8e32fed2015-06-17 10:16:23 -070034
35ARM32Target = TargetInfo(target='arm32',
36 triple='armv7a-none-linux-gnueabihf',
37 llc_flags=['-mcpu=cortex-a9',
38 '-float-abi=hard',
39 '-mattr=+neon'],
Jan Voung112b6e82015-07-13 11:36:53 -070040 ld_emu='armelf_nacl',
41 cross_headers=['-isystem', FindARMCrossInclude()])
Jan Voung8e32fed2015-06-17 10:16:23 -070042
Jan Voung8e32fed2015-06-17 10:16:23 -070043def ConvertTripleToNaCl(nonsfi_triple):
44 return nonsfi_triple.replace('linux', 'nacl')