diff options
author | Thomas Schwinge <thomas@codesourcery.com> | 2022-07-05 18:23:15 +0200 |
---|---|---|
committer | Thomas Schwinge <thomas@codesourcery.com> | 2022-07-06 22:53:04 +0200 |
commit | 3f05e03d6cfdf723ca0556318b6a9aa37be438e7 (patch) | |
tree | 7ef272d37b6d5817125bb1ec3359699c8e665e94 /libgomp/target.c | |
parent | 2f0d819a81edee50a98a8a05eed585f0a72bb932 (diff) | |
download | gcc-3f05e03d6cfdf723ca0556318b6a9aa37be438e7.zip gcc-3f05e03d6cfdf723ca0556318b6a9aa37be438e7.tar.gz gcc-3f05e03d6cfdf723ca0556318b6a9aa37be438e7.tar.bz2 |
Restore 'GOMP_offload_unregister_ver' functionality
The recent commit 683f11843974f0bdf42f79cdcbb0c2b43c7b81b0
"OpenMP: Move omp requires checks to libgomp" changed the
'GOMP_offload_register_ver' interface but didn't change
'GOMP_offload_unregister_ver' accordingly, so we're no longer
actually unregistering.
gcc/
* config/gcn/mkoffload.cc (process_obj): Clarify 'target_data' ->
'[...]_data'.
* config/nvptx/mkoffload.cc (process): Likewise.
libgomp/
* target.c (GOMP_offload_register_ver): Clarify 'target_data' ->
'data'.
(GOMP_offload_unregister_ver): Likewise. Fix up 'target_data'.
Diffstat (limited to 'libgomp/target.c')
-rw-r--r-- | libgomp/target.c | 30 |
1 files changed, 23 insertions, 7 deletions
diff --git a/libgomp/target.c b/libgomp/target.c index 4dac818..c66c61b 100644 --- a/libgomp/target.c +++ b/libgomp/target.c @@ -2334,23 +2334,29 @@ gomp_requires_to_name (char *buf, size_t size, int requires_mask) /* This function should be called from every offload image while loading. It gets the descriptor of the host func and var tables HOST_TABLE, TYPE of - the target, and TARGET_DATA needed by target plugin. */ + the target, and DATA. */ void GOMP_offload_register_ver (unsigned version, const void *host_table, - int target_type, const void *target_data) + int target_type, const void *data) { int i; - int omp_req = 0; if (GOMP_VERSION_LIB (version) > GOMP_VERSION) gomp_fatal ("Library too old for offload (version %u < %u)", GOMP_VERSION, GOMP_VERSION_LIB (version)); + int omp_req; + const void *target_data; if (GOMP_VERSION_LIB (version) > 1) { - omp_req = (int) (size_t) ((void **) target_data)[0]; - target_data = &((void **) target_data)[1]; + omp_req = (int) (size_t) ((void **) data)[0]; + target_data = &((void **) data)[1]; + } + else + { + omp_req = 0; + target_data = data; } gomp_mutex_lock (®ister_lock); @@ -2413,14 +2419,24 @@ GOMP_offload_register (const void *host_table, int target_type, /* This function should be called from every offload image while unloading. It gets the descriptor of the host func and var tables HOST_TABLE, TYPE of - the target, and TARGET_DATA needed by target plugin. */ + the target, and DATA. */ void GOMP_offload_unregister_ver (unsigned version, const void *host_table, - int target_type, const void *target_data) + int target_type, const void *data) { int i; + if (GOMP_VERSION_LIB (version) > GOMP_VERSION) + gomp_fatal ("Library too old for offload (version %u < %u)", + GOMP_VERSION, GOMP_VERSION_LIB (version)); + + const void *target_data; + if (GOMP_VERSION_LIB (version) > 1) + target_data = &((void **) data)[1]; + else + target_data = data; + gomp_mutex_lock (®ister_lock); /* Unload image from all initialized devices. */ |