Index: openmp/libomptarget/src/omptarget.cpp =================================================================== --- openmp/libomptarget/src/omptarget.cpp +++ openmp/libomptarget/src/omptarget.cpp @@ -89,11 +89,16 @@ // 2) load image into the target table. __tgt_target_table *TargetTable = TransTable->TargetsTable[device_id] = Device.load_binary(img); - // Unable to get table for this image: invalidate image and fail. + // Target table for this image is empty. It could happen under following two + // conditions: + // 1. Invalidate image: offloading fails; + // 2. Empty target entry like empty target region: offloading successes but + // needs to skip further actions. if (!TargetTable) { DP("Unable to generate entries table for device id %d.\n", device_id); TransTable->TargetsImages[device_id] = 0; - rc = OFFLOAD_FAIL; + if (img->EntriesBegin != img->EntriesEnd) {} + rc = OFFLOAD_FAIL; break; } Index: openmp/libomptarget/src/rtl.cpp =================================================================== --- openmp/libomptarget/src/rtl.cpp +++ openmp/libomptarget/src/rtl.cpp @@ -234,8 +234,6 @@ // Attempt to load all plugins available in the system. std::call_once(initFlag, &RTLsTy::LoadRTLs, this); - if (desc->HostEntriesBegin == desc->HostEntriesEnd) - return; RTLsMtx.lock(); // Register the images with the RTLs that understand them, if any. for (int32_t i = 0; i < desc->NumDeviceImages; ++i) { @@ -322,8 +320,6 @@ void RTLsTy::UnregisterLib(__tgt_bin_desc *desc) { DP("Unloading target library!\n"); - if (desc->HostEntriesBegin == desc->HostEntriesEnd) - return; RTLsMtx.lock(); // Find which RTL understands each image, if any. for (int32_t i = 0; i < desc->NumDeviceImages; ++i) {