]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[WIP] OpenMP 5.0: requires directive: workaround to fix libgomp IntelMIC plugin build
authorThomas Schwinge <thomas@codesourcery.com>
Wed, 3 Mar 2021 21:37:58 +0000 (22:37 +0100)
committerThomas Schwinge <thomas@codesourcery.com>
Thu, 25 Mar 2021 11:06:42 +0000 (12:06 +0100)
Fix-up for og10 commit c2e4a17adc0989f216c7fc3f93f150c66adba23a "OpenMP 5.0:
requires directive".

The GCC offloading target configurations don't build/use
'crtoffloadbegin.o'/'crtoffloadtable.o'/'crtoffloadend.o'
('libgcc/offloadstuff.c'), but the libgomp IntelMIC plugin still does link
against libgomp, and the latter unconditionally refers to
'__requires_mask_table', '__requires_mask_table_end':

    make[3]: Entering directory '[...]/build-gcc-offload-x86_64-intelmicemul-linux-gnu/x86_64-intelmicemul-linux-gnu/liboffloadmic/plugin'
    [...]/build-gcc-offload-x86_64-intelmicemul-linux-gnu/./gcc/xg++ [...] -loffloadmic_target -lcoi_device -lgomp -rdynamic ../ofldbegin.o offload_target_main.o ../ofldend.o -o offload_target_main
    ./../../libgomp/.libs/libgomp.so: undefined reference to `__requires_mask_table_end'
    ./../../libgomp/.libs/libgomp.so: undefined reference to `__requires_mask_table'
    collect2: error: ld returned 1 exit status
    Makefile:806: recipe for target 'offload_target_main' failed
    make[3]: *** [offload_target_main] Error 1

I have not researched what a proper fix would look like.

libgomp/
* target.c (__requires_mask_table, __requires_mask_table_end): Add
'__attribute__((weak))'.

libgomp/ChangeLog.omp
libgomp/target.c

index 0e3fd122f85005ec71ba1cb0408e2ebc79d35ceb..03ca74c8f3d5746919b1bc4a95534c2b8be25e4b 100644 (file)
@@ -1,3 +1,8 @@
+2021-03-25  Thomas Schwinge  <thomas@codesourcery.com>
+
+       * target.c (__requires_mask_table, __requires_mask_table_end): Add
+       '__attribute__((weak))'.
+
 2021-03-01  Kwok Cheung Yeung  <kcy@codesourcery.com>
 
        * testsuite/libgomp.c-c++-common/collapse-4.c: New.
index 699dc72cb72236f4c5aeb1e1d4bee1108f964e6e..9c7582635aa3df7a0fa1ea5a4c6b9e7897cfb617 100644 (file)
@@ -104,7 +104,9 @@ static unsigned int gomp_requires_mask;
 
 /* Start/end of .gnu.gomp.requires section of program, defined in
    crtoffloadbegin/end.o.  */
+__attribute__((weak))
 extern const unsigned int __requires_mask_table[];
+__attribute__((weak))
 extern const unsigned int __requires_mask_table_end[];
 
 /* Similar to gomp_realloc, but release register_lock before gomp_fatal.  */