Page MenuHomePhabricator

[WIP][Fuchsia] Set LLVM_TOOL_LLD_BUILD to allow some extra runtimes tests to run
Needs ReviewPublic

Authored by leonardchan on Jun 24 2022, 4:49 PM.

Details

Reviewers
phosek
Summary

LLVM_TOOL_LLD_BUILD is required for COMPILER_RT_HAS_LLD to be set which impacts tests in the following ways:

  • This sets config.has_lld in various lit files. This allows hwasan tests to run for arm runtimes and sets the feature lld-available which is required for a couple of tests.
  • Adds an "lld variant" of test suites for various sanitizers like msan that essentially run a suite of msan tests, but explicitly linked with lld.

Diff Detail

Event Timeline

leonardchan created this revision.Jun 24 2022, 4:49 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 24 2022, 4:49 PM
leonardchan requested review of this revision.Jun 24 2022, 4:49 PM

Won't be landing this until I'm sure any new tests that will be running from this won't fail locally.

An alternative approach to this is update this bit of cmake in compiler-rt/CMakeLists.txt:

set(COMPILER_RT_LLD_PATH ${LLVM_MAIN_SRC_DIR}/tools/lld)
if(EXISTS ${COMPILER_RT_LLD_PATH}/ AND LLVM_TOOL_LLD_BUILD)
  set(COMPILER_RT_HAS_LLD TRUE)
else()
  set(COMPILER_RT_LLD_PATH ${LLVM_MAIN_SRC_DIR}/../lld)
  if(EXISTS ${COMPILER_RT_LLD_PATH}/ AND LLVM_TOOL_LLD_BUILD)
    set(COMPILER_RT_HAS_LLD TRUE)
  endif()
endif()

if(ANDROID)
  set(COMPILER_RT_HAS_LLD TRUE)
  set(COMPILER_RT_TEST_USE_LLD TRUE)
  append_list_if(COMPILER_RT_HAS_FUSE_LD_LLD_FLAG -fuse-ld=lld SANITIZER_COMMON_LINK_FLAGS)
  append_list_if(COMPILER_RT_HAS_LLD -fuse-ld=lld COMPILER_RT_UNITTEST_LINK_FLAGS)
endif()

to something like:

set(COMPILER_RT_LLD_PATH ${LLVM_MAIN_SRC_DIR}/../lld)
if(EXISTS ${COMPILER_RT_LLD_PATH})
  set(COMPILER_RT_HAS_LLD TRUE)
endif()

if(ANDROID)
  set(COMPILER_RT_HAS_LLD TRUE)
  set(COMPILER_RT_TEST_USE_LLD TRUE)
endif()
append_list_if(COMPILER_RT_HAS_FUSE_LD_LLD_FLAG -fuse-ld=lld SANITIZER_COMMON_LINK_FLAGS)
append_list_if(COMPILER_RT_HAS_LLD -fuse-ld=lld COMPILER_RT_UNITTEST_LINK_FLAGS)

I'm thinking LLVM_TOOL_LLD_BUILD might be a remnant of times before the monorepo since lld doesn't exist under llvm/tools anymore.

Won't be landing this until I'm sure any new tests that will be running from this won't fail locally.

Or given https://reviews.llvm.org/D126936 and this could just pass magically on our bots, maybe we could just land this at the cost of being able to reproduce failures locally.

I'm thinking LLVM_TOOL_LLD_BUILD might be a remnant of times before the monorepo since lld doesn't exist under llvm/tools anymore.

Yes, that's correct. The proposed cleanup is the solution I'd prefer. I recently did a similar cleanup for libc++ in D126905.