https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104285
--- Comment #1 from Ye Luo <xw111luoye at gmail dot com> --- Here is a minimal reproducer. https://github.com/ye-luo/openmp-target/tree/master/tests/linking/two_identical_templates $ g++ -fopenmp -foffload=nvptx-none -O3 -c test_a.cpp $ g++ -fopenmp -foffload=nvptx-none -c test_a.cpp $ g++ -fopenmp -foffload=nvptx-none -c test_b.cpp $ g++ -fopenmp -foffload=nvptx-none main.cpp test_a.o test_b.o lto1: fatal error: test_a.o: section _Z8test_mapIfEvv$_omp_fn$0.2375 is missing compilation terminated. mkoffload: fatal error: 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-02-08/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 $ g++ -fopenmp -foffload=disable -c test_a.cpp $ g++ -fopenmp -foffload=disable -c test_b.cpp g++ -fopenmp -foffload=disable main.cpp test_a.o test_b.o Using be862bf1f612c884597ace4cbfdec972a0bf0eef from master