https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104285
Bug ID: 104285 Summary: openmp offload linker issue Product: gcc Version: 12.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: xw111luoye at gmail dot com Target Milestone: --- miniQMC https://github.com/ye-luo/miniqmc ships a set of OpenMP offload tests. ``` cmake -DCMAKE_CXX_COMPILER=g++ -DENABLE_OFFLOAD=ON .. make -j32 ``` When those tests are compiled into individual executables. All tests compile/link/run fine. However if all the tests are linked together into a single executable test_omptarget_all_in_one I got ``` lto1: fatal error: CMakeFiles/test_omptarget_all_in_one.dir/test_omp_reduction.cpp.o: section _ZN11qmcplusplusL29____C_A_T_C_H____T_E_S_T____0Ev$_omp_fn$1.3169 is missing compilation terminated. mkoffload: fatal error: /soft/gcc/gcc-12-dev-2022-01-28/bin/x86_64-pc-linux-gnu-accel-nvptx-none-gcc returned 1 exit status compilation terminated. lto-wrapper: fatal error: /soft/gcc/gcc-12-dev-2022-01-28/libexec/gcc/x86_64-pc-linux-gnu/12.0.1//accel/nvptx-none/mkoffload returned 1 exit status compilation terminated. /usr/bin/ld: error: lto-wrapper failed collect2: error: ld returned 1 exit status make[2]: *** [src/Platforms/tests/OMPTarget/CMakeFiles/test_omptarget_all_in_one.dir/build.make:359: src/Platforms/tests/OMPTarget/test_omptarget_all_in_one] Error 1 make[1]: *** [CMakeFiles/Makefile2:1656: src/Platforms/tests/OMPTarget/CMakeFiles/test_omptarget_all_in_one.dir/all] Error 2 make: *** [Makefile:101: all] Error 2 ``` gcc compiler commit 3f0fcda37f58d4108feb67de08f181a32bcb6388