From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by sourceware.org (Postfix) with ESMTPS id 13A23396D831 for ; Tue, 10 Aug 2021 15:45:26 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 13A23396D831 Received: from pps.filterd (m0246630.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 17AFf9EM021789; Tue, 10 Aug 2021 15:45:25 GMT Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by mx0b-00069f02.pphosted.com with ESMTP id 3aaqmuvg6s-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 10 Aug 2021 15:45:25 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 17AFe9cC140558; Tue, 10 Aug 2021 15:45:24 GMT Received: from nam12-dm6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2176.outbound.protection.outlook.com [104.47.59.176]) by userp3030.oracle.com with ESMTP id 3abjw4mpup-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 10 Aug 2021 15:45:24 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lmGyW1ywK+CYbGwzyXZxgCsg7yfmT8aHGcW0FgGeaw8Q8+YonuiHmK0zqgTVBgmw/2rg7bCLdj7T13FmeOnsjFubbN8bAwywZka0DHwYTEGy1udi2jwHjsuUr/fgxicmnov7NF6f9SzWbY+2OhhDFeN/HpVJFZG/ba1r1C2cqm7I8gBU0rBUtmvOBg0iqwLmxe1jx8y+zsxaRXehfmoiqgFb2fzy0xxl4WOvYAGZbCSdqO+t4Vc/dj6+dmtcOsCQABZTkyXI/j2WHPbVAZeimPKubEF6BlPismA0xcXkxpJzDsif416v9kDi9EHki8w3kXfAnxY4JXRSel4HHcMy3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=BD308N8uup1X7+aoL1DGX0tXgFdHg8qIgLdhdfFADUk=; b=j5O9sJ+i11spLXfv4DOti+9Vw+UKTdGaw72+AjP8ibyE/8+QCGC4KBfXaJteGjWawBnOwcqZHcRkuNc0nJpnLyg0Cpz40yLHUdsHQ2o0bXOehTP0uUuSNMj/8DI3lZXvrE3uwpR74lhzihosMDi3FAPI52Z5S2vud3ZIfM6gTS+js/Gzq8jowAxvQ5jza4whVpRu28tp5k3DEvJyVh1FRzfbWsbFmQ85wSMYgYdJK1A58zQdul1zRegeLmn5BSiWvvvzi284778z5SN4c3e3RH21Pz/EypmYG1iGXgri//K44Z5T2mXFjoIWIGC9TgrZP/ZYQcgcuGH9HMnwiKeRTA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none Received: from BYAPR10MB2888.namprd10.prod.outlook.com (2603:10b6:a03:88::32) by BY5PR10MB4274.namprd10.prod.outlook.com (2603:10b6:a03:206::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4415.13; Tue, 10 Aug 2021 15:45:21 +0000 Received: from BYAPR10MB2888.namprd10.prod.outlook.com ([fe80::5d49:ec20:468e:1b77]) by BYAPR10MB2888.namprd10.prod.outlook.com ([fe80::5d49:ec20:468e:1b77%7]) with mapi id 15.20.4394.023; Tue, 10 Aug 2021 15:45:21 +0000 From: "Jose E. Marchesi" To: Richard Biener via Gcc-patches Cc: Indu Bhagat , Richard Biener Subject: Re: [PATCH,V2 1/3] bpf: Add new -mcore option for BPF CO-RE References: <1628124628-28706-1-git-send-email-indu.bhagat@oracle.com> <1628124628-28706-2-git-send-email-indu.bhagat@oracle.com> Date: Tue, 10 Aug 2021 17:45:13 +0200 In-Reply-To: (Richard Biener via Gcc-patches's message of "Tue, 10 Aug 2021 13:51:32 +0200") Message-ID: <87sfzhnw1i.fsf@oracle.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Content-Type: text/plain X-ClientProxiedBy: LO2P265CA0075.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:8::15) To BYAPR10MB2888.namprd10.prod.outlook.com (2603:10b6:a03:88::32) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from termi.oracle.com (141.143.193.68) by LO2P265CA0075.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:8::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4394.15 via Frontend Transport; Tue, 10 Aug 2021 15:45:20 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 69371a72-117d-456f-b7c1-08d95c15dca2 X-MS-TrafficTypeDiagnostic: BY5PR10MB4274: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6790; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: sf//KJWJq10t4MqvakKDkwvqfBUjJYhOCYxoKXoNy8Q35zDcbU9MVHFi2k1ciLeZauGQIFRyUSiFpZPMr0S78eGAZHLmMbIHNNbGPWCqMy+azHg3FcJxN+aKpW2evqJoCGR0AIBtnpBYY6sQyhGZZo5+VGiDJawZNmfWGZzwvon3QiRgFKtvh7HEOx8zyuKTQ19CsTsaTx60/j0t5lUUea97FH1w9SuHFYWtveUBr4yS5ZjqczcoESuqiCGOXrJ/91FAVJlsKe894SGFyB6tUOSiyGZrg27abBpZL09Qi3IOMLvUxxerF/G2fE+Wq0ge5cRkpaPisog4XMy+HPhpaHZQrBqINHbTJAlIYXio3GDwL1I8TfR/53CKLN9BrK0E45CWyj3k5gM2H0V5N8EasaeviZbFWOHT27jCn1GcLTOqRoUVCCNhYJuDDnlsxFaWQ6vnjA/MmJTnoraLFahBNHDHiEXGWV2WB0ezAQpp3N5Tq5p2PcRk2ajrqaU2EMWnk1LxlHKe8bof63URcWWrN3mEm3mTgfLnDvfVmPRLT4ANodk521bk5Lg+jqSlmZihXs6box5y5Y+wve8rviB+hClay8hhRAW2TIF6OEZV7hIXg4CtRvpkI/MH7JDaZhIBKEKdjPxyPUGNy2nsIwBSQPEQw0ViFug/2my5D6uAE6VaCRBNRRIg32BEL2Q/FODyJgyLLEKIEtdBlS1Hvu1h522GIP87EMsQlyElvdlmTuuTO7UPgTCzK0ELEHYVnr+OzRRahQqQEi2qUA/QKGHOtA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BYAPR10MB2888.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(396003)(346002)(39860400002)(376002)(366004)(136003)(26005)(186003)(8936002)(7696005)(52116002)(2906002)(53546011)(38350700002)(5660300002)(8676002)(38100700002)(66556008)(66476007)(66946007)(83380400001)(6486002)(6666004)(86362001)(54906003)(4326008)(956004)(6916009)(316002)(478600001)(2616005)(36756003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?H/RetDNKq98Zy1r8ajsVaIacNtJxEr7LMP5P0jku2NnhxAMfM9tUEDYu/Brz?= =?us-ascii?Q?LtelhvdnxJ7oOZ3hoG65V4psQFzIJMa842JZyd3yPEyqm6Lgzl02D5cLVDYp?= =?us-ascii?Q?Pn1/VYDTKeZL179mjq9M00jP0ddkxnIHMGV9w42YwAzrzZAcWP3sn5/A44zx?=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03ktjWT47FLtnL42f6wuKXE+H?= =?us-ascii?Q?BJmNpYH88g+EuStwbXj+F+UhXIzKYxAkklD/cVSsduRATUVM6SepNfrLgzGu?= =?us-ascii?Q?bzaKbQmDc70cfqeTsSu25Qx2o7Vb/Zq/9jh56HqtfkmhP3/PAE8UfClzn/Wa?= =?us-ascii?Q?X3GsKEFDRp1hqltzmTMZxMMnuaJ6PnpcHl5k6qxZG1sSezOh+Cyd4rD7EfIc?= =?us-ascii?Q?4xFuPmtZoTtQG/rTX+UxfUGrPyMFR4uS16Ri7p4neJUhSP3eQXkgUHskihMN?= =?us-ascii?Q?hdEHSC31ANqr9QeUcq7EGo/7?= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 69371a72-117d-456f-b7c1-08d95c15dca2 X-MS-Exchange-CrossTenant-AuthSource: BYAPR10MB2888.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Aug 2021 15:45:21.8000 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: BQgL/+8sLQGvB/vPj8iFtYCpSoDIQHE4bfkTfJP5n0gAT6LF0J0AawZbdo4iR03KVRJO3fnlkdaZ6PRATH5D9gcUqEooj1vriE2G8khIces= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR10MB4274 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=10072 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 mlxlogscore=999 malwarescore=0 phishscore=0 bulkscore=0 suspectscore=0 mlxscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2107140000 definitions=main-2108100100 X-Proofpoint-GUID: DSXHKBV9OYOCnsdN6lxRBWAcVPv1Jy1V X-Proofpoint-ORIG-GUID: DSXHKBV9OYOCnsdN6lxRBWAcVPv1Jy1V X-Spam-Status: No, score=-12.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, MSGID_FROM_MTA_HEADER, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_BL, RCVD_IN_MSPIKE_L3, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Aug 2021 15:45:36 -0000 > On Thu, Aug 5, 2021 at 2:54 AM Indu Bhagat via Gcc-patches > wrote: >> >> -mcore in the BPF backend enables code generation for the CO-RE usecase. LTO is >> disabled for CO-RE compilations. > > -mcore reads like "core", why not -mco-re? Anyway, ... > >> gcc/ChangeLog: >> >> * config/bpf/bpf.c (bpf_option_override): For BPF backend, disable LTO >> support when compiling for CO-RE. >> * config/bpf/bpf.opt: Add new command line option -mcore. >> >> gcc/testsuite/ChangeLog: >> >> * gcc.target/bpf/core-lto-1.c: New test. >> --- >> gcc/config/bpf/bpf.c | 15 +++++++++++++++ >> gcc/config/bpf/bpf.opt | 4 ++++ >> gcc/testsuite/gcc.target/bpf/core-lto-1.c | 9 +++++++++ >> 3 files changed, 28 insertions(+) >> create mode 100644 gcc/testsuite/gcc.target/bpf/core-lto-1.c >> >> diff --git a/gcc/config/bpf/bpf.c b/gcc/config/bpf/bpf.c >> index e635f9e..028013e 100644 >> --- a/gcc/config/bpf/bpf.c >> +++ b/gcc/config/bpf/bpf.c >> @@ -158,6 +158,21 @@ bpf_option_override (void) >> { >> /* Set the initializer for the per-function status structure. */ >> init_machine_status = bpf_init_machine_status; >> + >> + /* To support the portability needs of BPF CO-RE approach, BTF debug >> + information includes the BPF CO-RE relocations. The information >> + necessary for these relocations is added to the CTF container by the >> + BPF backend. Enabling LTO poses challenges in the generation of the BPF >> + CO-RE relocations because if LTO is in effect, they need to be >> + generated late in the LTO link phase. This in turn means the compiler >> + needs to provide means to combine the early and late BTF debug info, >> + similar to DWARF debug info. >> + >> + In any case, in absence of linker support for BTF sections at this time, >> + it is acceptable to simply disallow LTO for BPF CO-RE compilations. */ >> + >> + if (flag_lto && TARGET_BPF_CORE) >> + error ("BPF CO-RE does not support LTO"); > > ... these "errors" should use sorry ("...") which annotate places where the > compiler has to give up because sth is not implemented. > > otherwise this patch needs BPF maintainer review of course. I agree -mco-re is more clear than -mcore. Other than that this looks OK BPF-wise. >> } >> >> #undef TARGET_OPTION_OVERRIDE >> diff --git a/gcc/config/bpf/bpf.opt b/gcc/config/bpf/bpf.opt >> index 916b53c..e8926f5 100644 >> --- a/gcc/config/bpf/bpf.opt >> +++ b/gcc/config/bpf/bpf.opt >> @@ -127,3 +127,7 @@ Generate little-endian eBPF. >> mframe-limit= >> Target Joined RejectNegative UInteger IntegerRange(0, 32767) Var(bpf_frame_limit) Init(512) >> Set a hard limit for the size of each stack frame, in bytes. >> + >> +mcore >> +Target Mask(BPF_CORE) >> +Generate all necessary information for BPF Compile Once - Run Everywhere. >> diff --git a/gcc/testsuite/gcc.target/bpf/core-lto-1.c >> b/gcc/testsuite/gcc.target/bpf/core-lto-1.c >> new file mode 100644 >> index 0000000..a90dc5b >> --- /dev/null >> +++ b/gcc/testsuite/gcc.target/bpf/core-lto-1.c >> @@ -0,0 +1,9 @@ >> +/* Test -mcore with -flto. >> + >> + -mcore is used to generate information for BPF CO-RE usecase. To support >> + the generataion of the .BTF and .BTF.ext sections in GCC, -flto is disabled >> + with -mcore. */ >> + >> +/* { dg-do compile } */ >> +/* { dg-error "BPF CO-RE does not support LTO" "" { target bpf-*-* } 0 } */ >> +/* { dg-options "-gbtf -mcore -flto" } */ >> -- >> 1.8.3.1 >>