This patch adds support to handle reverse offload to libgomp's plugin-gcn.c and to AMD GCN's libgomp target.c. In theory, that's all whats needed for GCN – in practice there a known issue with private stack variables which has to be addressed independently. Once this and the target.c generic code is committed, omp requires reverse-offload support can be claimed for the device (→ GOMP_OFFLOAD_get_num_devices). Note: Contrary to nvptx, the code to handle reverse offload is already enabled if there is 'omp requires reverse_offload' (+ target functions) in the code; for nvptx, an actual reverse-offload-target region has to exist in the code. This probably does not matter that much in practice. The '#if 1' code block inside plugin-gcn.c has to be replaced by the target.c/libgomp-plugins.h/libgomp.h/libgomp.map patch that is part of the patch: https://gcc.gnu.org/pipermail/gcc-patches/2022-September/602321.html "[Patch] libgomp/nvptx: Prepare for reverse-offload callback handling" Andrew did suggest a while back to piggyback on the console_output handling, avoiding another atomic access. - If this is still wanted, I like to have some guidance regarding how to actually implement it. Comments, suggestions? If not, OK for mainline?* Tobias *Without the '#if 1' code and once the non-nvptx bits of the other patch have been approved and committed. ----------------- Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955