From patchwork Thu May 2 21:34:57 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "H.J. Lu" X-Patchwork-Id: 1094564 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-500031-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="ShZ1+I6g"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 44w7pQ5Jygz9s9N for ; Fri, 3 May 2019 07:35:08 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:date:message-id:mime-version :content-transfer-encoding; q=dns; s=default; b=RBRMygpWWvrNQBF1 cIsEVGKrUGptyxw1QEU1eduFeKhZMww2k5e/Q2nzLPvUPG9lLl4FJfbfspmTj6SB Z4eeqwDQxmlPlq2C2SXbsTTOQA2689hYfs9dha8E5qjSREp4oDI1u/Yk0UYLkzbN 5/ePIpdZuwOPB3rbg3uSi+seBOQ= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:date:message-id:mime-version :content-transfer-encoding; s=default; bh=+56ZDMF89fCCiN0KUh5GLZ MpG9Y=; b=ShZ1+I6gn1faGzI0u6vGEEmsk8T8AJkixB/KA5tpQvfljmlboJkO/Q 6tYepWt1cg/WAyJjEJoJtQXvBWfvHB2czbfZLN4tXfp1yg8tw/WqKWNaE65UDPNS VugPNKMaPBoYtBNImbbn/8pqP4TOcufeXkqIDvfot4Z6sUCTQFHnw= Received: (qmail 74048 invoked by alias); 2 May 2019 21:35:01 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 74040 invoked by uid 89); 2 May 2019 21:35:01 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-22.3 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_SOFTFAIL autolearn=ham version=3.3.1 spammy=HX-Languages-Length:1514, HContent-Transfer-Encoding:8bit X-HELO: mga02.intel.com Received: from mga02.intel.com (HELO mga02.intel.com) (134.134.136.20) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 02 May 2019 21:34:59 +0000 Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 02 May 2019 14:34:57 -0700 Received: from gnu-cfl-1.sc.intel.com ([172.25.70.237]) by fmsmga006.fm.intel.com with ESMTP; 02 May 2019 14:34:58 -0700 From: "H.J. Lu" To: gcc-patches@gcc.gnu.org Subject: [PATCH] x86: Put -fPIC and -shared the last to create offload image Date: Thu, 2 May 2019 14:34:57 -0700 Message-Id: <20190502213457.20953-1-hjl.tools@gmail.com> MIME-Version: 1.0 X-IsSubscribed: yes On x86, since -fPIC and -shared should be used to create offload image, we put them the last to properly create offload image. PR target/87833 * config/i386/intelmic-mkoffload.c (prepare_target_image): Put -fPIC and -shared the last to create offload image. --- gcc/config/i386/intelmic-mkoffload.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/gcc/config/i386/intelmic-mkoffload.c b/gcc/config/i386/intelmic-mkoffload.c index 2a3e912ee74..0b12edc72c1 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); From patchwork Mon Nov 11 09:12:45 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Schwinge X-Patchwork-Id: 1192833 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-512921-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="x+NUwQ5O"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 47BQCF07ywz9sP3 for ; Mon, 11 Nov 2019 20:13:11 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:in-reply-to:references:date:message-id :mime-version:content-type; q=dns; s=default; b=te4pDzAZReoQhLAU 8MXZqWI4Su2U95pkByEkd8IYhAPoWgXkzFLPfwk3T3EJ7GW2imIkERsREtd88hNO A7PyxVEQ8k43AQTKYGhn9WFOqfF/7uKYThzf4uHz3Yr0bDFaXTDPyRsEvPYmpDG+ 9arVyXHO76i5IBwzOsZx7wiQw5U= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:in-reply-to:references:date:message-id :mime-version:content-type; s=default; bh=qA/Xu8H7t0XarUJY0pEP4c FVP/g=; b=x+NUwQ5O4FBGM6qEUxkEjIJbN+509uVBlf3hogxg3CtWYlt7K5czHm 5baxiJ8KpdDGZFfbXkb5IXaE/Nyrtqy2Oz5IXMOq5e2v1I+4fm8zvLkY3EDeHu5A +tk6agAN4Xflr6V+horPwqi40jge4ORc1rf47WcPXRhMsbdaJBTf8= Received: (qmail 30987 invoked by alias); 11 Nov 2019 09:13:03 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 30971 invoked by uid 89); 11 Nov 2019 09:13:03 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-17.7 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_SHORT autolearn=ham version=3.3.1 spammy=helped, somebody, Law, ahead X-HELO: esa4.mentor.iphmx.com Received: from esa4.mentor.iphmx.com (HELO esa4.mentor.iphmx.com) (68.232.137.252) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 11 Nov 2019 09:13:01 +0000 IronPort-SDR: QhmACchZsKE221hdIqPwrK8rXGVMFN1ngdqSqJsnPFCCBSnMo61kwPqI3ni40qIK2u0fwzGV4b 928dgbIprh72i2L54SrEqHWfvvaJzBnFxx018hn8sHX4b5dPI/s0ll0LtZlct/0kXueWtC8/Ky R++76UzIMsxy148ysGVngk7kyj0/sdJnqrYH0kndIC1wtFIgc/7YdQ1nx/J6xRs9imNIOm1MvJ 30zUqfpaVBKoA6DESjCXHkilQK0pTE/jZbTCPHPGYhjXGc9N8kMezUmmLeqhfsOKgN1+uzU3TI r0Q= Received: from orw-gwy-01-in.mentorg.com ([192.94.38.165]) by esa4.mentor.iphmx.com with ESMTP; 11 Nov 2019 01:12:59 -0800 IronPort-SDR: 7ORHhFR114Av/7Yizs89J8AIf85jOYq+IB7DPeQHwDQrsQAEE4jA1G7SI7mhsiGtFy6LiNko/D Dkdd8r/X90VhL+/DoemmdOTZtjArBzABGFPsAnw9P6ZCA+2WgT7NC6e5/9Zoej0rQRw7f/Ikt1 dKXVnDwNF/ICJT/X9Z0Fk2IOFLSeNA7aDaEiuCqUwShwlE7M7nFPazEh12Jb3HYE/fXDXUDnkM ZuZxDz0gfVLcrVCed80SSB/rOJk7qm07SKxhAhUTlfQJD9b1yYHviQBzcnDrX6IInTllxtyQNi v+A= From: Thomas Schwinge To: , , Jeff Law CC: Hongtao Liu , "H.J. Lu" , Ilya Verbin Subject: [8/9/10 Regression] [PR87833] Intel MIC (emulated) offloading still broken In-Reply-To: <5e89cbb5-7391-1023-b769-c43648f74794@redhat.com> References: <20190425183821.GB2706@tucnak> <87r29jg4o2.fsf@euler.schwinge.homeip.net> <87h8afixb9.fsf@euler.schwinge.homeip.net> <20190430105652.GD2706@tucnak> <20190430113113.GE2706@tucnak> <87pno1ib5s.fsf@euler.schwinge.homeip.net> <20190502213457.20953-1-hjl.tools@gmail.com> <5e89cbb5-7391-1023-b769-c43648f74794@redhat.com> User-Agent: Notmuch/0.29.1+93~g67ed7df (https://notmuchmail.org) Emacs/26.1 (x86_64-pc-linux-gnu) Date: Mon, 11 Nov 2019 10:12:45 +0100 Message-ID: <87y2wmojxu.fsf@euler.schwinge.homeip.net> MIME-Version: 1.0 Hi! On 2019-05-29T09:50:42-0600, Jeff Law wrote: > On 5/29/19 8:32 AM, Thomas Schwinge wrote: >> On Thu, 9 May 2019 15:46:06 +0300, Ilya Verbin 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 >> , and review the proposed patch, >> . > 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 ;-) Grüße Thomas From 38b44bd6947089744a525e61e499fda7975a7c7e Mon Sep 17 00:00:00 2001 From: tschwinge 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 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 + + 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 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); -- 2.17.1