public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libgomp/65338] New: [5 Regression] Offloading from DSO is broken after OpenACC merge to trunk
@ 2015-03-06 19:06 iverbin at gcc dot gnu.org
  2015-03-09 11:27 ` [Bug libgomp/65338] " tschwinge at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: iverbin at gcc dot gnu.org @ 2015-03-06 19:06 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65338

            Bug ID: 65338
           Summary: [5 Regression] Offloading from DSO is broken after
                    OpenACC merge to trunk
           Product: gcc
           Version: 5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libgomp
          Assignee: unassigned at gcc dot gnu.org
          Reporter: iverbin at gcc dot gnu.org
                CC: jakub at gcc dot gnu.org, kyukhin at gcc dot gnu.org,
                    tschwinge at gcc dot gnu.org

The testcase:

+++++ test.c: +++++

int f_aaa (void);

int main ()
{
  int x = f_aaa ();
  #pragma omp target
    x++;
  return x;
}

+++++ libaaa.c: +++++

int f_aaa (void)
{
  int x = 0;
  #pragma omp target
    x = 10;
  return x;
}

++++++++++

$ gcc -fopenmp -shared -fPIC libaaa.c -o libaaa.so
$ gcc -fopenmp -L. -laaa test.c
$ ./a.out
libgomp: Target function wasn't mapped


The problem is caused by this change:

-gomp_register_images_for_device (struct gomp_device_descr *device)
+gomp_register_image_for_device (struct gomp_device_descr *device,
+                               struct offload_image_descr *image)
 {
-  int i;
-  for (i = 0; i < num_offload_images; i++)
+  if (!device->offload_regions_registered
+      && (device->type == image->type
+         || device->type == OFFLOAD_TARGET_TYPE_HOST))
     {
-      struct offload_image_descr *image = &offload_images[i];
-      if (image->type == device->type)
-       device->register_image_func (image->host_table, image->target_data);
+      device->register_image_func (image->host_table, image->target_data);
+      device->offload_regions_registered = true;
     }
 }

We should at least remove device->offload_regions_registered, or rework
loading/registration to support dlopen'ed libraries. Related mail thread:
https://gcc.gnu.org/ml/gcc-patches/2015-02/msg01455.html


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-04-07 17:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-06 19:06 [Bug libgomp/65338] New: [5 Regression] Offloading from DSO is broken after OpenACC merge to trunk iverbin at gcc dot gnu.org
2015-03-09 11:27 ` [Bug libgomp/65338] " tschwinge at gcc dot gnu.org
2015-03-09 12:10 ` [Bug libgomp/65338] " rguenth at gcc dot gnu.org
2015-04-07 17:49 ` iverbin at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).