I guess the problem is the following:
Stage2 builds libomp.so instrumented with AddressSanitizer. Then omp tests are compiled without -fsanitize=address and load instrumented libomp.so which fails on missing symbols.
You can try to solve this in two ways:
1. Disable sanitizers on libomp.so even -DLLVM_USE_SANITIZER= is set. That can be hard if it uses some part of llvm as dependency. If so, you can try to build non-instrumented libomp.so using ExternalProject_Add.
Should work but sanitizer will cover only the compiler binary not libomp.so.
2. Use asan in all tests e.g. with -DOPENMP_TEST_FLAGS=-fsanitize=address (better to do so in cmake file). Problem here is that stage2 does not build asan because it uses LLVM_USE_SANITIZER. We can just use stage1 compiler which contains asan libs. With a hack like this:
if(LLVM_USE_SANITIZER)
set(OPENMP_TEST_C_COMPILER ${CMAKE_C_COMPILER})
set(OPENMP_TEST_CXX_COMPILER ${CMAKE_CXX_COMPILER})
set(saved_CMAKE_C_FLAGS ${CMAKE_C_FLAGS})
set(saved_CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
unset(CMAKE_C_FLAGS)
append_common_sanitizer_flags()
set(OPENMP_TEST_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address ${OPENMP_TEST_FLAGS}")
set(CMAKE_C_FLAGS ${saved_CMAKE_C_FLAGS})
set(CMAKE_CXX_FLAGS ${saved_CMAKE_CXX_FLAGS})
endif()
I can run most of the test:
Unsupported : 39
Passed : 241
Expectedly Failed: 2
Failed : 33 (it was 270+ before)
then you can fix or disable failing tests