assert(env.Bit('built_elsewhere'))
env.Replace(CC='true', CXX='true', LINK='true', AR='true',
RANLIB='true', AS='true', ASPP='true', LD='true',
- STRIP='true')
+ STRIP='true', PNACLOPT='true', PNACLFINALIZE='true')
def _SetEnvForNativeSdk(env, sdk_path):
else:
ld_arch_flag = arch_flag
+ llc_mtriple_flag = ''
+ if env.Bit('minsfi'):
+ llc_cpu = ''
+ if env.Bit('build_x86_32'):
+ llc_cpu = 'i686'
+ elif env.Bit('build_x86_64'):
+ llc_cpu = 'x86_64'
+
+ if env.Bit('host_linux'):
+ llc_mtriple_flag = ' -mtriple=%s-linux-gnu' % llc_cpu
+ elif env.Bit('host_mac'):
+ llc_mtriple_flag = ' -mtriple=%s-apple-darwin' % llc_cpu
+
translator_root = os.path.join(os.path.dirname(root), 'pnacl_translator')
binprefix = os.path.join(root, 'bin', 'pnacl-')
pnacl_cxx = binprefix + 'clang++' + binext
pnacl_ld = binprefix + 'ld' + binext
- pnacl_nativeld = binprefix + 'nativeld' + binext
pnacl_disass = binprefix + 'dis' + binext
pnacl_finalize = binprefix + 'finalize' + binext
+ pnacl_opt = binprefix + 'opt' + binext
pnacl_strip = binprefix + 'strip' + binext
+ pnacl_llc = binprefix + 'llc' + binext
# NOTE: XXX_flags start with space for easy concatenation
# The flags generated here get baked into the commands (CC, CXX, LINK)
pnacl_cc_flags = ' -std=gnu99'
pnacl_ld_flags = ' ' + ' '.join(env['PNACL_BCLDFLAGS'])
pnacl_translate_flags = ''
+ pnacl_llc_flags = ''
if env.Bit('nacl_pic'):
pnacl_cc_flags += ' -fPIC'
pnacl_ld_flags += ' -fPIC'
pnacl_translate_flags += ' -fPIC'
+ if env.Bit('minsfi'):
+ pnacl_llc_flags += ' -relocation-model=pic -filetype=obj'
+ pnacl_ld_flags += ' -nostdlib -Wl,-r -L' + os.path.join(root, 'usr', 'lib')
+
if env.Bit('use_sandboxed_translator'):
sb_flags = ' --pnacl-sb'
pnacl_ld_flags += sb_flags
pnacl_translate_flags += ' -sfi-zero-based-sandbox'
env.Replace(# Replace header and lib paths.
- NACL_SDK_INCLUDE=os.path.join(root, 'usr', 'include'),
- NACL_SDK_LIB=os.path.join(root, 'lib'),
+ NACL_SDK_INCLUDE=os.path.join(root, 'le32-nacl', 'include'),
+ NACL_SDK_LIB=os.path.join(root, 'le32-nacl', 'lib'),
# Remove arch-specific flags (if any)
BASE_LINKFLAGS='',
BASE_CFLAGS='',
# with shared libraries except use them with the toolchain.
SHLINK=pnacl_cxx + ld_arch_flag + pnacl_ld_flags,
LD=pnacl_ld,
- NATIVELD=pnacl_nativeld,
AR=pnacl_ar,
AS=pnacl_as + ld_arch_flag,
RANLIB=pnacl_ranlib,
STRIP=pnacl_strip,
TRANSLATE=pnacl_translate + arch_flag + pnacl_translate_flags,
PNACLFINALIZE=pnacl_finalize,
+ PNACLOPT=pnacl_opt,
+ LLC=pnacl_llc + llc_mtriple_flag + pnacl_llc_flags,
)
if env.Bit('built_elsewhere'):
CXX=arch_flag + cc_flags,
ASPP=arch_flag + cc_flags,
LINK=cc_flags) # Already has -arch
- env['LD'] = '${NATIVELD}' + arch_flag
+ env['LD'] = 'NO-NATIVE-LD-INVOCATION-ALLOWED'
env['SHLINK'] = '${LINK}'
if env.Bit('built_elsewhere'):
_StubOutEnvToolsForBuiltElsewhere(env)
version = int(SCons.Script.ARGUMENTS['toolchain_feature_version'])
else:
version_file = os.path.join(root, 'FEATURE_VERSION')
+ # There is no pnacl_newlib toolchain on ARM, only a pnacl_translator, so
+ # use that if necessary. Otherwise use it if we are doing sandboxed
+ # translation.
+ if not os.path.exists(version_file) or env.Bit('use_sandboxed_translator'):
+ version_file = os.path.join(os.path.dirname(root), 'pnacl_translator',
+ 'FEATURE_VERSION')
if os.path.exists(version_file):
with open(version_file, 'r') as fh:
version = int(fh.read())