Hi,

This patch was previously posted here by Cesar:

https://gcc.gnu.org/ml/gcc-patches/2017-10/msg00668.html

This patch is necessary when not all objects containing offload code
are linked into the final executable, including those in static
libraries. Re-tested with offloading to nvptx. I will apply to the
openacc-gcc-9-branch shortly.

Thanks,

Julian

ChangeLog

2019-07-10  Cesar Philippidis  <ce...@codesourcery.com>

        libgomp/
        * target.c (gomp_load_image_to_device): Allow the accelerator to
        possess more offloaded functions than the host.
>From 8fa310efa11254ed430d7e5dca80333a612b699e Mon Sep 17 00:00:00 2001
From: Cesar Philippidis <ce...@codesourcery.com>
Date: Sun, 7 Jul 2019 11:25:51 -0700
Subject: [PATCH 3/3] Allow the accelerator to have more offloaded functions
 than the host

	libgomp/
	* target.c (gomp_load_image_to_device): Allow the accelerator to
	possess more offloaded functions than the host.
---
 libgomp/ChangeLog.openacc | 5 +++++
 libgomp/target.c          | 2 +-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/libgomp/ChangeLog.openacc b/libgomp/ChangeLog.openacc
index 1d88bd54cd2..00c58601336 100644
--- a/libgomp/ChangeLog.openacc
+++ b/libgomp/ChangeLog.openacc
@@ -1,3 +1,8 @@
+2019-07-10  Cesar Philippidis  <ce...@codesourcery.com>
+
+	* target.c (gomp_load_image_to_device): Allow the accelerator to
+	possess more offloaded functions than the host.
+
 2019-07-10  Julian Brown  <jul...@codesourcery.com>
 
 	* oacc-parallel.c (GOACC_enter_exit_data): Fix optional arguments for
diff --git a/libgomp/target.c b/libgomp/target.c
index a4ed763d507..c81e5ababb7 100644
--- a/libgomp/target.c
+++ b/libgomp/target.c
@@ -2131,7 +2131,7 @@ gomp_load_image_to_device (struct gomp_device_descr *devicep, unsigned version,
     = devicep->load_image_func (devicep->target_id, version,
 				target_data, &target_table);
 
-  if (num_target_entries != num_funcs + num_vars)
+  if (num_target_entries < num_funcs + num_vars)
     {
       gomp_mutex_unlock (&devicep->lock);
       if (is_register_lock)
-- 
2.22.0

Reply via email to