public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Kwok Yeung <kcy@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc/devel/omp/gcc-11] [WIP] OpenMP 5.0: requires directive: workaround to fix libgomp IntelMIC plugin build
Date: Thu, 13 May 2021 16:20:17 +0000 (GMT)	[thread overview]
Message-ID: <20210513162017.718EE3938380@sourceware.org> (raw)

https://gcc.gnu.org/g:6da4ffd4a790f5f0abf290147217ca46a36f981e

commit 6da4ffd4a790f5f0abf290147217ca46a36f981e
Author: Thomas Schwinge <thomas@codesourcery.com>
Date:   Wed Mar 3 22:37:58 2021 +0100

    [WIP] OpenMP 5.0: requires directive: workaround to fix libgomp IntelMIC plugin build
    
    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))'.

Diff:
---
 libgomp/ChangeLog.omp | 5 +++++
 libgomp/target.c      | 2 ++
 2 files changed, 7 insertions(+)

diff --git a/libgomp/ChangeLog.omp b/libgomp/ChangeLog.omp
index 0519191a936..db1d2bdac3a 100644
--- a/libgomp/ChangeLog.omp
+++ b/libgomp/ChangeLog.omp
@@ -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.
diff --git a/libgomp/target.c b/libgomp/target.c
index af39d283608..2633ab1e43f 100644
--- a/libgomp/target.c
+++ b/libgomp/target.c
@@ -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.  */


                 reply	other threads:[~2021-05-13 16:20 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210513162017.718EE3938380@sourceware.org \
    --to=kcy@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).