Add an cross include path for ARM to work around clang bug 22937.
Clang appears to be missing an include path to find
bits/c++config.h so we were unable to compile the
unsandboxed c++ based cross tests and link against the
subzero unsandboxed ARM object files.
Work around this for now by finding and including the
missing path.
Turn on a few ARM cross tests that should be working
(mem_intrin and test_strengthreduce -- though the
strength-reduction isn't done for ARM). The test_bitmanip
still fails, because under Om1 we overflow the stack offset
and need to materialize that offset with a register first.
Update a few other references that still say x8632.
BUG= https://code.google.com/p/nativeclient/issues/detail?id=4076
R=jpp@chromium.org, stichnot@chromium.org
Review URL: https://codereview.chromium.org/1232183002 .
diff --git a/Makefile.standalone b/Makefile.standalone
index 664338b..0d0bad2 100644
--- a/Makefile.standalone
+++ b/Makefile.standalone
@@ -329,7 +329,9 @@
-i x8632,native,sse2 -i x8632,native,sse4.1,test_vector_ops \
-i x8632,sandbox,sse4.1,Om1 \
-i arm32,native,neon,Om1,simple_loop \
- -i arm32,native,neon,Om1,test_stacksave
+ -i arm32,native,neon,Om1,mem_intrin \
+ -i arm32,native,neon,Om1,test_stacksave \
+ -i arm32,native,neon,Om1,test_strengthreduce
PNACL_BIN_PATH=$(PNACL_BIN_PATH) \
$(LLVM_SRC_PATH)/utils/lit/lit.py -sv crosstest/Output
endif
diff --git a/pydir/crosstest.py b/pydir/crosstest.py
index ebc33f8..7a479c3 100755
--- a/pydir/crosstest.py
+++ b/pydir/crosstest.py
@@ -166,7 +166,7 @@
else:
objs.append(arg)
- # Add szrt_sb_x8632.o or szrt_native_x8632.o.
+ # Add szrt_sb_${target}.o or szrt_native_${target}.o.
objs.append((
'{root}/toolchain_build/src/subzero/build/runtime/' +
'szrt_{sb}_' + args.target + '.o'
@@ -176,12 +176,14 @@
compiler = '{bin}/{prefix}{cc}'.format(
bin=bindir, prefix='pnacl-' if args.sandbox else '',
cc='clang' if pure_c else 'clang++')
- sb_native_args = (['-O0', '--pnacl-allow-native', '-arch', 'x8632',
+ sb_native_args = (['-O0', '--pnacl-allow-native',
+ '-arch', target_info.target,
'-Wn,-defsym=__Sz_AbsoluteZero=0']
if args.sandbox else
['-g', '-target=' + triple,
'-lm', '-lpthread',
- '-Wl,--defsym=__Sz_AbsoluteZero=0'])
+ '-Wl,--defsym=__Sz_AbsoluteZero=0'] +
+ target_info.cross_headers)
shellcmd([compiler, args.driver] + objs +
['-o', os.path.join(args.dir, args.output)] + sb_native_args)
diff --git a/pydir/targets.py b/pydir/targets.py
index 0f6433c..c2188e5 100644
--- a/pydir/targets.py
+++ b/pydir/targets.py
@@ -1,26 +1,44 @@
#!/usr/bin/env python2
from collections import namedtuple
+import glob
+
+
+# Why have 'cross_headers':
+# For some reason, clang doesn't know how to find some of the libstdc++
+# headers (c++config.h). Manually add in one of the paths:
+# https://llvm.org/bugs/show_bug.cgi?id=22937
+# Otherwise, we could assume the system has arm-linux-gnueabihf-g++ and
+# use that instead of clang, but so far we've just been using clang for
+# the unsandboxed build.
+def FindARMCrossInclude():
+ return glob.glob(
+ '/usr/arm-linux-gnueabihf/include/c++/*/arm-linux-gnueabihf')[-1]
+
TargetInfo = namedtuple('TargetInfo',
- ['target', 'triple', 'llc_flags', 'ld_emu'])
+ ['target', 'triple', 'llc_flags', 'ld_emu',
+ 'cross_headers'])
X8632Target = TargetInfo(target='x8632',
triple='i686-none-linux',
llc_flags=['-mcpu=pentium4m'],
- ld_emu='elf_i386_nacl')
+ ld_emu='elf_i386_nacl',
+ cross_headers=[])
X8664Target = TargetInfo(target='x8664',
triple='x86_64-none-linux',
llc_flags=['-mcpu=x86-64'],
- ld_emu='elf_x86_64_nacl')
+ ld_emu='elf_x86_64_nacl',
+ cross_headers=[])
ARM32Target = TargetInfo(target='arm32',
triple='armv7a-none-linux-gnueabihf',
llc_flags=['-mcpu=cortex-a9',
'-float-abi=hard',
'-mattr=+neon'],
- ld_emu='armelf_nacl')
+ ld_emu='armelf_nacl',
+ cross_headers=['-isystem', FindARMCrossInclude()])
def ConvertTripleToNaCl(nonsfi_triple):