ASAN tests on ARM

Hi,

I'm trying to run the ASAN tests on ARM (to fix the CMake RT bot we
have) and I'm hitting a different bug on my Chomebook than I have on
the bots:

[6/32] Generating ASAN_INST_TEST_OBJECTS.asan_interface_test.cc.arm-inline.o
...
clang-3.6: warning: argument unused during compilation: '-march=armv7-a'
clang (LLVM option parsing): Unknown command line argument
'-asan-instrument-assembly'.
clang (LLVM option parsing): Did you mean '-asan-instrument-atomics'?

Is that option unavailable on ARM? If so, shouldn't the tests for it
be also disabled?

cheers,
--renato

Hi,

this happens when x86 target is not compiled in. We really should (and
will) do something about it.

Btw, you've asked the same question a month ago :slight_smile: Sorry it has been
an issue for such a long time.

No worries, I also haven't done much. But I need to get the RT bot
green soon enough. Is that a CMake issue? Or a lit issues?

--renato

The flag itself is target-specific, which seems to be very uncommon in
LLVM. Perhaps it's better to move it to some common part of the code.
This flag makes sense for other platforms as well, it is just not
implemented there.

Alternatively, we could fix compiler-rt cmake not to pass this flag
when targetting non-x86. This is not so easy because we use custom
commands to build tests with just-built clang (different from
CMAKE_C_COMPILER), and we don't have any support for testing the
features of this custom compiler. Also, there are plan to kill this
code and build compiler-rt in sub-trees with normal CMake rules.

Would it make sense to run the same test without that flag on ARM? If
not, than we should move those tests to X86 directories and not run
them if the X86 backend is not built.

When configuring Clang/LLVM I see that compiler RT follows the same
back-ends as I request for Clang, which should be ok for
text-comparison tests, but not for execution. Does Compiler-RT have
any knowledge of that difference when testing?

cheers,
--renato

The flag itself is target-specific, which seems to be very uncommon in
LLVM. Perhaps it's better to move it to some common part of the code.
This flag makes sense for other platforms as well, it is just not
implemented there.

Would it make sense to run the same test without that flag on ARM? If
not, than we should move those tests to X86 directories and not run
them if the X86 backend is not built.

That's a third option. This flag only really makes sense for one or
several test cases in a large GTest file. They can be split and moved
to X86. But this adds more complexity to build system which, in my
opinion, is never good.

When configuring Clang/LLVM I see that compiler RT follows the same
back-ends as I request for Clang, which should be ok for
text-comparison tests, but not for execution. Does Compiler-RT have
any knowledge of that difference when testing?

Compiler-rt and llvm build systems know very little about cross-compiling.

That's a third option. This flag only really makes sense for one or
several test cases in a large GTest file. They can be split and moved
to X86. But this adds more complexity to build system which, in my
opinion, is never good.

Roger.

Compiler-rt and llvm build systems know very little about cross-compiling.

Well, right now, it doesn't matter how many targets you build LLVM
for, it'll only run the unit tests on the host platform. It doesn't
seem to have been designed that way, but it works.

Compiler-rt, OTOH, tries to run AArch64 unit tests, which there's no
guarantee they'll work on any other platform. There may be something
missing in its CMake files that is present in the LLVM's?

cheers,
--renato

That's a third option. This flag only really makes sense for one or
several test cases in a large GTest file. They can be split and moved
to X86. But this adds more complexity to build system which, in my
opinion, is never good.

Roger.

Compiler-rt and llvm build systems know very little about cross-compiling.

Well, right now, it doesn't matter how many targets you build LLVM
for, it'll only run the unit tests on the host platform. It doesn't
seem to have been designed that way, but it works.

Compiler-rt, OTOH, tries to run AArch64 unit tests, which there's no
guarantee they'll work on any other platform. There may be something
missing in its CMake files that is present in the LLVM's?

I guess the only difference is that compiler-rt tests require
execution of target binaries.
There is platform test logic in cmake/config-ix.cmake that tries
compilation (but not execution) for arm and aarch64 on ARM hosts.
Maybe the easiest fix would be to try both on aarch64 host, and only
32-bit arm on 32-bit arm host?

Not all AArch64 systems can run AArch32 code (needs special kernel
configuration), so I wouldn't assume anything on either arches.

I guess the least problematic would be to get config-ix to try_compile
and try_run on each arch you think should run, so that you can get x86
on x86_64 and AArch32 on 32-bit-supporting-AArch64. You should only
fail if the arch can't compile a chosen arch, but only enable the
tests if the arch can run. Warnings during CMake time would be
appropriate, I think.

cheers,
--renato