Page MenuHomePhabricator

[runtimes][openmp] Change to not treat ARCH-unknown-linux-gnu as errors
ClosedPublic

Authored by kaz7 on Nov 21 2021, 10:20 PM.

Details

Summary

When OpenMP is compiled as a part runtimes for multiple targets, openmp
is compiled under build/runtimes/runtimes-arch-unknown-linux-gnu-bins
directory. Old implementation treats this directory name as errors.
This patch adds a guard like "[Uu]known[^-]".

Diff Detail

Event Timeline

kaz7 created this revision.Nov 21 2021, 10:20 PM
kaz7 requested review of this revision.Nov 21 2021, 10:20 PM
kaz7 added a comment.Nov 22 2021, 11:10 PM

Hi, I noticed this problem when I compiled llvm with following settings.

$ cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=`pwd`/../testinstall -DLLVM_ENABLE_PROJECTS=clang -DLLVM_ENABLE_RUNTIMES="libcxx;libcxxabi;openmp" -DLLVM_TARGETS_TO_BUILD=X86 -DLLVM_RUNTIME_TARGETS=x86_64-unknown-linux-gnu -DLLVM_DISTRIBUTION_COMPONENTS="clang;runtimes;opt;llvm-link" $HOME/llvm-upstream/llvm-project/llvm

The build fails because of missing "--version-script" flag. This is caused by failures of libomp linker tests like below. These failures are caused by "unknown" in triple.

$ ninja distribution
...
-- Performing Test LIBOMP_HAVE_X_FLAG
-- Performing Test LIBOMP_HAVE_X_FLAG - Failed
-- Performing Test LIBOMP_HAVE_WARN_SHARED_TEXTREL_FLAG
-- Performing Test LIBOMP_HAVE_WARN_SHARED_TEXTREL_FLAG - Failed
-- Performing Test LIBOMP_HAVE_AS_NEEDED_FLAG
-- Performing Test LIBOMP_HAVE_AS_NEEDED_FLAG - Failed
-- Performing Test LIBOMP_HAVE_VERSION_SCRIPT_FLAG
-- Performing Test LIBOMP_HAVE_VERSION_SCRIPT_FLAG - Failed
-- Performing Test LIBOMP_HAVE_STATIC_LIBGCC_FLAG
-- Performing Test LIBOMP_HAVE_STATIC_LIBGCC_FLAG - Failed
-- Performing Test LIBOMP_HAVE_Z_NOEXECSTACK_FLAG
-- Performing Test LIBOMP_HAVE_Z_NOEXECSTACK_FLAG - Failed
...
[633/1430] Linking C shared library openmp/runtime/src/libomp.so
FAILED: openmp/runtime/src/libomp.so
: && /home/jam/llvm-dev/test/./bin/clang --target=x86_64-unknown-linux-gnu -fPIC -fPIC -fno-semantic-interposition -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wmissing-field-initializers -Wimplicit-fallthrough -Wcovered-switch-default -Wno-comment -Wstring-conversion -Wmisleading-indentation -fdiagnostics-color -ffunction-sections -fdata-sections -Wall -Wcast-qual -Wformat-pedantic -Wimplicit-fallthrough -Wsign-compare -Wno-extra -Wno-pedantic -O3 -DNDEBUG  -Wl,-z,defs -Wl,-z,nodelete -shared -Wl,-soname,libomp.so -o openmp/runtime/src/libomp.so openmp/runtime/src/CMakeFiles/omp.dir/kmp_alloc.cpp.o openmp/runtime/src/CMakeFiles/omp.dir/kmp_atomic.cpp.o openmp/runtime/src/CMakeFiles/omp.dir/kmp_csupport.cpp.o openmp/runtime/src/CMakeFiles/omp.dir/kmp_debug.cpp.o openmp/runtime/src/CMakeFiles/omp.dir/kmp_itt.cpp.o openmp/runtime/src/CMakeFiles/omp.dir/kmp_environment.cpp.o openmp/runtime/src/CMakeFiles/omp.dir/kmp_error.cpp.o openmp/runtime/src/CMakeFiles/omp.dir/kmp_global.cpp.o openmp/runtime/src/CMakeFiles/omp.dir/kmp_i18n.cpp.o openmp/runtime/src/CMakeFiles/omp.dir/kmp_io.cpp.o openmp/runtime/src/CMakeFiles/omp.dir/kmp_runtime.cpp.o openmp/runtime/src/CMakeFiles/omp.dir/kmp_settings.cpp.o openmp/runtime/src/CMakeFiles/omp.dir/kmp_str.cpp.o openmp/runtime/src/CMakeFiles/omp.dir/kmp_tasking.cpp.o openmp/runtime/src/CMakeFiles/omp.dir/kmp_threadprivate.cpp.o openmp/runtime/src/CMakeFiles/omp.dir/kmp_utility.cpp.o openmp/runtime/src/CMakeFiles/omp.dir/kmp_barrier.cpp.o openmp/runtime/src/CMakeFiles/omp.dir/kmp_wait_release.cpp.o openmp/runtime/src/CMakeFiles/omp.dir/kmp_affinity.cpp.o openmp/runtime/src/CMakeFiles/omp.dir/kmp_dispatch.cpp.o openmp/runtime/src/CMakeFiles/omp.dir/kmp_lock.cpp.o openmp/runtime/src/CMakeFiles/omp.dir/kmp_sched.cpp.o openmp/runtime/src/CMakeFiles/omp.dir/z_Linux_util.cpp.o openmp/runtime/src/CMakeFiles/omp.dir/kmp_gsupport.cpp.o openmp/runtime/src/CMakeFiles/omp.dir/thirdparty/ittnotify/ittnotify_static.cpp.o openmp/runtime/src/CMakeFiles/omp.dir/kmp_taskdeps.cpp.o openmp/runtime/src/CMakeFiles/omp.dir/kmp_cancel.cpp.o openmp/runtime/src/CMakeFiles/omp.dir/kmp_ftn_cdecl.cpp.o openmp/runtime/src/CMakeFiles/omp.dir/kmp_ftn_extra.cpp.o openmp/runtime/src/CMakeFiles/omp.dir/kmp_version.cpp.o openmp/runtime/src/CMakeFiles/omp.dir/ompt-general.cpp.o openmp/runtime/src/CMakeFiles/omp.dir/ompd-specific.cpp.o openmp/runtime/src/CMakeFiles/omp.dir/z_Linux_asm.S.o  -lpthread -lrt  -ldl && cd /home/jam/llvm-dev/test/runtimes/runtimes-x86_64-unknown-linux-gnu-bins/openmp/runtime/src && /usr/bin/cmake -E create_symlink libomp.so libgomp.so && /usr/bin/cmake -E create_symlink libomp.so libiomp5.so
/usr/bin/ld: openmp/runtime/src/libomp.so: version node not found for symbol omp_capture_affinity_@OMP_5.0
/usr/bin/ld: failed to set dynamic section sizes: bad value
clang-14: error: linker command failed with exit code 1 (use -v to see invocation)
kaz7 added a comment.Nov 29 2021, 8:02 PM

ping. please let me know any questions.

jdoerfert accepted this revision.Nov 30 2021, 7:01 AM

Seems reasonable.

This revision is now accepted and ready to land.Nov 30 2021, 7:01 AM