https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102215
Bug ID: 102215 Summary: [GCN offloading] Missing '__atomic_compare_exchange_1' etc. Product: gcc Version: 12.0 Status: UNCONFIRMED Keywords: openmp Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: tschwinge at gcc dot gnu.org CC: ams at gcc dot gnu.org, jakub at gcc dot gnu.org, jules at gcc dot gnu.org Target Milestone: --- Target: GCN The recent commit 090f0d78f194e3cda23fe904016db77ea36c38fa "openmp: Improve expand_omp_atomic_pipeline" regresses GCN offloading testing as follows: [-PASS:-]{+FAIL:+} libgomp.c/../libgomp.c-c++-common/reduction-16.c (test for excess errors) [-PASS:-]{+UNRESOLVED:+} libgomp.c/../libgomp.c-c++-common/reduction-16.c [-execution test-]{+compilation failed to produce executable+} ld: error: undefined symbol: __atomic_compare_exchange_1 >>> referenced by /tmp/cce2YauE.o:(test_char._omp_fn.1) >>> referenced by /tmp/cce2YauE.o:(test_char._omp_fn.1) >>> referenced by /tmp/cce2YauE.o:(test_char._omp_fn.0) >>> referenced by /tmp/cce2YauE.o:(test_char._omp_fn.0) ld: error: undefined symbol: __atomic_compare_exchange_2 >>> referenced by /tmp/cce2YauE.o:(test_short._omp_fn.1) >>> referenced by /tmp/cce2YauE.o:(test_short._omp_fn.1) >>> referenced by /tmp/cce2YauE.o:(test_short._omp_fn.0) >>> referenced by /tmp/cce2YauE.o:(test_short._omp_fn.0) collect2: error: ld returned 1 exit status mkoffload: fatal error: [...]/gcc/x86_64-pc-linux-gnu-accel-amdgcn-amdhsa-gcc returned 1 exit status Similar for 'libgomp.c++/../libgomp.c-c++-common/reduction-16.c'. And: [-PASS:-]{+FAIL:+} libgomp.c/target-43.c (test for excess errors) [-PASS:-]{+UNRESOLVED:+} libgomp.c/target-43.c [-execution test-]{+compilation failed to produce executable+} ld: error: undefined symbol: __atomic_compare_exchange_1 >>> referenced by /tmp/cc1Kwlmj.o:(main._omp_fn.0) >>> referenced by /tmp/cc1Kwlmj.o:(main._omp_fn.0) collect2: error: ld returned 1 exit status mkoffload: fatal error: [...]/gcc/x86_64-pc-linux-gnu-accel-amdgcn-amdhsa-gcc returned 1 exit status These all do: { dg-additional-options "-foffload-options=nvptx-none=-latomic" { target { offload_target_nvptx } } } Do we now also need libatomic for GCN or should this be handled in the GCN back end?