Closed
Description
libomp_check_linker_flag
from https://github.com/llvm/llvm-project/blob/main/openmp/runtime/cmake/LibompCheckLinkerFlag.cmake for some reason checks linker flags by performing a nested CMake build (!!!) and checking the output of that build. This means that the output is not the output of the linker command, but that of CMake/Ninja, for example:
Change Dir:
/builddir/build/BUILD/openmp-16.0.1.src/redhat-linux-build/CMakeFiles/CMakeTmp/link_flag_check_LIBOMP_HAVE_VERSION_SCRIPT_FLAG/build
Run Build Command(s):/usr/bin/ninja-build -v && [1/2] /usr/bin/clang
-Dfoo_EXPORTS -O2 -flto=thin -fexceptions -g -grecord-gcc-switches -pipe
-Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3
-Wp,-D_GLIBCXX_ASSERTIONS --config
/usr/lib/rpm/redhat/redhat-hardened-clang.cfg -fstack-protector-strong -m64
-mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection
-fcf-protection -fPIC -MD -MT CMakeFiles/foo.dir/src_to_link.c.o -MF
CMakeFiles/foo.dir/src_to_link.c.o.d -o CMakeFiles/foo.dir/src_to_link.c.o
-c
/builddir/build/BUILD/openmp-16.0.1.src/redhat-linux-build/CMakeFiles/CMakeTmp/link_flag_check_LIBOMP_HAVE_VERSION_SCRIPT_FLAG/src_to_link.c
[2/2] : && /usr/bin/clang -fPIC -O2 -flto=thin -fexceptions -g
-grecord-gcc-switches -pipe -Wall -Werror=format-security
-Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS
--config /usr/lib/rpm/redhat/redhat-hardened-clang.cfg
-fstack-protector-strong -m64 -mtune=generic -fasynchronous-unwind-tables
-fstack-clash-protection -fcf-protection
-Wl,--version-script=/builddir/build/BUILD/openmp-16.0.1.src/runtime/src/exports_test_so.txt
-shared -Wl,-soname,libfoo.so -o libfoo.so
CMakeFiles/foo.dir/src_to_link.c.o && :
This has lots of opportunities for false positives: This particular case fails because it contains error
as part of -Werror=format-security
.