This is an archive of the discontinued LLVM Phabricator instance.

[CMake][compiler-rt][RISCV] Support RISC-V cross-compilation
ClosedPublic

Authored by luismarques on Nov 25 2020, 12:24 PM.

Details

Summary

This seems to be a safe way to ensure that the Compiler-RT test compiler flags are properly set in all cross-compilation scenarios. Without this when BUILTINS_TEST_TARGET_CFLAGS is set in compiler-rt/test/builtins/CMakeLists.txt the other flags are cleared (I had been using a different workaround for that issue).

@pzheng had suggested an alternative fix in [1]:

-  if(ANDROID OR ${arch} MATCHES "arm|aarch64")
+  if(ANDROID OR ${arch} MATCHES "arm|aarch64" OR
+      COMPILER_RT_TEST_COMPILER_CFLAGS)

I'm not sure that's correct and safe in all scenarios. If it is, couldn't the COMPILER_RT_TEST_COMPILER_CFLAGS condition subsume the other ones anyway? If the answer to this isn't clear I suggest we just add the RISC-V matches for now, as done in this patch.

[1] https://bugs.llvm.org/show_bug.cgi?id=44244

Diff Detail

Event Timeline

luismarques created this revision.Nov 25 2020, 12:24 PM
Herald added a project: Restricted Project. · View Herald TranscriptNov 25 2020, 12:24 PM
Herald added subscribers: Restricted Project, NickHung, evandro and 13 others. · View Herald Transcript
luismarques requested review of this revision.Nov 25 2020, 12:24 PM
lenary accepted this revision.Jan 14 2021, 9:43 AM

LGTM

This revision is now accepted and ready to land.Jan 14 2021, 9:43 AM