[8/9/10,Regression,PR87833] Intel MIC (emulated) offloading still broken

Message ID 87y2wmojxu.fsf@euler.schwinge.homeip.net
State New
Headers show
  • [8/9/10,Regression,PR87833] Intel MIC (emulated) offloading still broken
Related show

Commit Message

Thomas Schwinge Nov. 11, 2019, 9:12 a.m.

On 2019-05-29T09:50:42-0600, Jeff Law <law@redhat.com> wrote:
> On 5/29/19 8:32 AM, Thomas Schwinge wrote:

>> On Thu, 9 May 2019 15:46:06 +0300, Ilya Verbin <iverbin@gmail.com> wrote:

>>> I have left Intel 3 years ago. If you have any questions regarding MIC

>>> offloading, you can reach me by iverbin@gmail.com


>> We're (a) looking for somebody to step up as a maintainer for that, and

That's still unresolved.

At the 2019 GNU Tools Cauldron, we discussed this topic in the OMP BoF,
and decided that despite its unmaintained status, we shall try to keep
GCC's Intel MIC (emulated) offloading support functional (at least until
any more complicated problems arise), because it might be useful for
Jakub once a year or so, for testing OMP changes.

>> (b) that person to get active, and take ownership of

>> <https://gcc.gnu.org/PR87833>, and review the proposed patch,

>> <http://mid.mail-archive.com/20190502213457.20953-1-hjl.tools@gmail.com>.

> My question would be where in the world is the -fno-pie stuff coming

> from.  It's also not clear where mkoffload is being called within c#5

> (presumably via the linker plugin) AFAICT we don't get the command line

> for that.  -v  or -Wl,-v probably would have helped.  It's difficult to

> know if HJ's patch is correct or not given the missing bits of information.


> But I'm willing to trust HJ here.  I'll ack the patch for the trunk.

> You or HJ can go ahead and install it.

I too have not made an attempt to really understand this problem and
solution.  See attached; as posted by H.J.,
I have now committed "[PR87833] x86: Put -fPIC and -shared the last to
create offload image" to trunk in r278041, gcc-9-branch in r278042,
gcc-8-branch in r278043.

> THe bigger question about the viability/usability of MIC is punted ;-)



From 38b44bd6947089744a525e61e499fda7975a7c7e Mon Sep 17 00:00:00 2001
From: tschwinge <tschwinge@138bc75d-0d04-0410-961f-82ee72b054a4>
Date: Mon, 11 Nov 2019 08:39:32 +0000
Subject: [PATCH] [PR87833] x86: Put -fPIC and -shared the last to create
 offload image

On x86, since -fPIC and -shared should be used to create offload image,
we put them the last to properly create offload image.

2019-11-11  H.J. Lu  <hjl.tools@gmail.com>

	PR target/87833
	* config/i386/intelmic-mkoffload.c (prepare_target_image): Put
	-fPIC and -shared the last to create offload image.

Backport from trunk r278041.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@278043 138bc75d-0d04-0410-961f-82ee72b054a4
 gcc/ChangeLog                        | 7 +++++++
 gcc/config/i386/intelmic-mkoffload.c | 5 +++--
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 29441ada5dd3..94eaf1bc624d 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,10 @@ 
+2019-11-11  H.J. Lu  <hjl.tools@gmail.com>
+	Backport from trunk:
+	PR target/87833
+	* config/i386/intelmic-mkoffload.c (prepare_target_image): Put
+	-fPIC and -shared the last to create offload image.
 2019-11-11  Thomas Schwinge  <thomas@codesourcery.com>
 	Backport from trunk:
diff --git a/gcc/config/i386/intelmic-mkoffload.c b/gcc/config/i386/intelmic-mkoffload.c
index b8f116446e63..008968e3e376 100644
--- a/gcc/config/i386/intelmic-mkoffload.c
+++ b/gcc/config/i386/intelmic-mkoffload.c
@@ -453,8 +453,6 @@  prepare_target_image (const char *target_compiler, int argc, char **argv)
   if (verbose)
     obstack_ptr_grow (&argv_obstack, "-v");
   obstack_ptr_grow (&argv_obstack, "-xlto");
-  obstack_ptr_grow (&argv_obstack, "-shared");
-  obstack_ptr_grow (&argv_obstack, "-fPIC");
   obstack_ptr_grow (&argv_obstack, opt1);
   for (int i = 1; i < argc; i++)
@@ -466,6 +464,9 @@  prepare_target_image (const char *target_compiler, int argc, char **argv)
   if (!out_obj_filename)
     fatal_error (input_location, "output file not specified");
   obstack_ptr_grow (&argv_obstack, opt2);
+  /* NB: Put -fPIC and -shared the last to create shared library.  */
+  obstack_ptr_grow (&argv_obstack, "-fPIC");
+  obstack_ptr_grow (&argv_obstack, "-shared");
   obstack_ptr_grow (&argv_obstack, "-o");
   obstack_ptr_grow (&argv_obstack, target_so_filename);
   compile_for_target (&argv_obstack);