From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id A398241E9F; Wed, 15 Mar 2023 15:18:49 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7BE7340EE4; Wed, 15 Mar 2023 15:18:49 +0100 (CET) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by mails.dpdk.org (Postfix) with ESMTP id 915A440141 for ; Wed, 15 Mar 2023 15:18:47 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1678889927; x=1710425927; h=date:from:to:cc:subject:message-id:references: content-transfer-encoding:in-reply-to:mime-version; bh=ssvELQyFOhaH60NUBqCn37De481lcd/t6IDXL+Ul1v0=; b=Osx2qQGjW0iRHyNgxYXZMxFHYP5y8KCmB3TLSDN8MlmTKYQ/+NbCQLUh sKeT0Pbg+tsr1DMTA/3yHUHxze3CCCCQTRUF+n0UWloT/2TFSX1UTNf42 91ful207SYOt2kgqYCcg1NauB9S3G3zauG1U8SAXApUf0BAAjhXyb590h G23CuFuGTtBceBV4lC9NHTxAyyOSGnrDcUh32qe2MkL96PC3D49M52jNh rVWtfE9AdNIl8OKMDvn8lYcLVYrmythkOhFMkjmNXcurQTtn0LYVQ2IQh v9yOZQihTZmDHGQ6W/PG1KbNd5dPZfsQht/V9lCWsTEr0/QAk4/bXRdLp A==; X-IronPort-AV: E=McAfee;i="6500,9779,10649"; a="365397125" X-IronPort-AV: E=Sophos;i="5.98,262,1673942400"; d="scan'208";a="365397125" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Mar 2023 07:18:26 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10649"; a="672764387" X-IronPort-AV: E=Sophos;i="5.98,262,1673942400"; d="scan'208";a="672764387" Received: from fmsmsx602.amr.corp.intel.com ([10.18.126.82]) by orsmga007.jf.intel.com with ESMTP; 15 Mar 2023 07:18:26 -0700 Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) by fmsmsx602.amr.corp.intel.com (10.18.126.82) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.21; Wed, 15 Mar 2023 07:18:25 -0700 Received: from fmsedg602.ED.cps.intel.com (10.1.192.136) by fmsmsx610.amr.corp.intel.com (10.18.126.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.21 via Frontend Transport; Wed, 15 Mar 2023 07:18:25 -0700 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (104.47.55.109) by edgegateway.intel.com (192.55.55.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.21; Wed, 15 Mar 2023 07:18:25 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LSWF29DoQUOxzkYvnNvG06FnIR5riNfhHx77H1gTINVfkbCJLjfv5v3NljF0P8FrlJpJZvGVeIIjdNc5/pb4JmvGApit0FW0b2QQLGOgzNeCE38KRZ9Nd/BFERFB37JPVqZ/+W+egKtiBdUPSR6JHczNHYe1uZqhy73vqb4kzxxAjUAF9J8K8+dhNlgDEuWrDa6hRo6lGuvRhpzkYUx7AmZOIJmv0sYdRETrUitW7+X8AMBtjHZUbJjRr4JonpK5h1g47wEVRRjPdqA5LonlRo9+BreoyEToLdus9MVmj80V//u222Y3ZsC+b95saKTCf0cYVcMHHpO4G3/4+HqbHg== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=CDKJmrS3tMv4s3m6mrvFugzqkDBOOz3iYKxtmFkVKcY=; b=gTK8rGb8EXvEylrwafl+ZKmWLNHC+wXAdhdxX/CMp/HB4b4hjCFJDWKCwsfYZLA/T3MTMyRZaPpmsPySKdgYshu/hAU4c713oXHCE2sAUObw9drzbmJn5r/HvfWX1rq4wwN2hP7YQ1VRUIRa6HCls3/X0AId+qwS6Z/hoGs9nxAYf/x2GKXQL4qbK2MelPKpqP7TI2k9DmFC4zkbLzHXIlwj6zKsupbGlV9JZt+pWL7r/qbzJDEJznEn1/qJPOrnxWf7vIEwnbL37Op3hbfpZxUT7SgzTcXvU8Pl6jl089CTcT+tcrRS7Xh0oH5c4NsYgurKLfR2d5/Y7SvDmKbNZg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; Received: from DS0PR11MB7309.namprd11.prod.outlook.com (2603:10b6:8:13e::17) by SN7PR11MB6601.namprd11.prod.outlook.com (2603:10b6:806:273::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.24; Wed, 15 Mar 2023 14:18:22 +0000 Received: from DS0PR11MB7309.namprd11.prod.outlook.com ([fe80::18d0:ac53:aa1d:d19c]) by DS0PR11MB7309.namprd11.prod.outlook.com ([fe80::18d0:ac53:aa1d:d19c%5]) with mapi id 15.20.6178.024; Wed, 15 Mar 2023 14:18:22 +0000 Date: Wed, 15 Mar 2023 14:18:16 +0000 From: Bruce Richardson To: Mattias =?iso-8859-1?Q?R=F6nnblom?= CC: "dev@dpdk.org" , Mattias =?iso-8859-1?Q?R=F6nnblom?= Subject: Re: PIE static library builds Message-ID: References: <075645fc-f40d-82c6-52d5-ce8b23f3cdeb@lysator.liu.se> Content-Type: text/plain; charset="iso-8859-1" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-ClientProxiedBy: LO4P123CA0363.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:18e::8) To DS0PR11MB7309.namprd11.prod.outlook.com (2603:10b6:8:13e::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS0PR11MB7309:EE_|SN7PR11MB6601:EE_ X-MS-Office365-Filtering-Correlation-Id: bf830aae-357c-44b5-04f7-08db25602251 X-LD-Processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: PbZOI+4gVSUncbMMUE316BMLbQyafkTsiKoIHFQVJFVQTfPYJ1qJsgTPMnMTL/vEj/e10PaGIjt5mDNS4gUZLb5UcGcyIj0J8UXFxXJ0jUKodiCxFJXXHA9DlFUCbHxgdi3yw7htv1ufeHHeZXNBuowC8maF5V4G5YVMtvP+osDta8g/Ve056a574MvsAyH/RnC+4f4V8qNUX06A6Gw3hzbam2ZyRdacbRkrTuBlTY9pxP+zTMqPbI3eKPs7HZZNuwqEGQ6yWp9WTkEdFEkORNOcxB8QfSrFrf4sJtcGUHoRgdpOP8KjuwZ4o6rmgTzbu2OJ7Mqnt9PUV7Poa0sXLOeCR7KPsm2NIma3ZxCQEHdUMT8wysYhBn9VTbH2P7GZUkkn1vH870bB5UZGZthgBdOmsyDdfqdOSKBHhc1Wgng48R7yTiPVy3MblL4qcEMqd0Doxh0NTV5mmPIUpjk8iah8UEFK90q4eCzKoKuk1KIkwr86NYqfj7bpU+Qz6sNSv2c5fedUnwV8cowW8DPRXzke4N1v0Z29znyGW0UVJdlcLK3FZhyybw5+sc6AAqGMatiRaMlW8NWmDuy2eQc0L7hpWc/IkmW3Hgj+m5+KqaxALPh+rBV1XQiI4mIkmDOqCTLNmSZlLCRx8me1ue61kw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DS0PR11MB7309.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230025)(136003)(376002)(396003)(366004)(346002)(39860400002)(451199018)(2906002)(82960400001)(83380400001)(44832011)(5660300002)(66556008)(8676002)(3480700007)(86362001)(296002)(66946007)(8936002)(66476007)(41300700001)(4326008)(38100700002)(54906003)(478600001)(26005)(66574015)(186003)(6916009)(53546011)(6506007)(6486002)(6666004)(6512007)(316002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?iso-8859-1?Q?piIQbolhotdm4S3A2WPpQvvOXsX0YlvTBISvuEAXlrKQD4QIvW0nJ4s1GR?= =?iso-8859-1?Q?aVz26hHjvg+LyTywH0wOdOnxuMNHCNdxRtOVXmBYZPT8PSg2rsk3/Zc39A?= =?iso-8859-1?Q?MFstaXh5jY6KJYqj2T2dI+xv5pnWJd4YN/PT0ZTnbLjtze8ALCjlqJECYC?= =?iso-8859-1?Q?lUqKKg8z6QmIgjfdT2jv/gviZhrmtHC9mb5JbsfTu3OqG4tahVtiajlDat?= =?iso-8859-1?Q?smiMnrWiUKogfZEzu3FWVuoLzB7Xz+sh26h4QfpEYlev8OEQypDJNuxzU5?= =?iso-8859-1?Q?PuwXZMdo9xOEpi+e9ZYwJgnFT1s4V6szj/3V3n9b3ENvLAPVHqzFquxEwq?= =?iso-8859-1?Q?/ZrmfIbE4lV9wLqoS/4bA53b9p4+P4N3KfyYQoC0/PcrKQhlyIM7EMRJnH?= =?iso-8859-1?Q?nsoCll630xiKL7oeSFTbd5cPWF6TaFkeM52uaWX/UTc9b6l3sVoFbIiCUi?= =?iso-8859-1?Q?fndkUkIHhiS6Jd36csVXb0jaVz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GiCIwQSdHpZiFszD6c1twWslvUK8OBRRsFXA5tGbjoUE5iucBv8?= =?iso-8859-1?Q?EUzhP7nfvviNLJakXtvunIdlHt8oplDe8VbRuHbJotDGv6WCWbmCPFtodV?= =?iso-8859-1?Q?Nvt0VYBL4maEiBK9oHDooKUl56H5z2MNwOQnV2XyqgNEQJKJ03RU0kvjjT?= =?iso-8859-1?Q?TP0uqX6A2hHYrZafZqorI+IN9E0KGJa2hAbwztUrztX/AExy/N+No2l2ak?= =?iso-8859-1?Q?xrOZVTdabJaiL2N0sfgJr3S2AEL0ljSu3yBSk5abL5ROFuFTEJvCUt9g?= =?iso-8859-1?Q?=3D=3D?= X-MS-Exchange-CrossTenant-Network-Message-Id: bf830aae-357c-44b5-04f7-08db25602251 X-MS-Exchange-CrossTenant-AuthSource: DS0PR11MB7309.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Mar 2023 14:18:22.8536 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: KCG3EJZmC68BubgY0WH9vcagQGGEuRsWvpQCl38J/t4SsXcPproZBsGeW3HW8zQn2E3Vfl9dJkfZLvT+ibkDt2widnZxMwkbeg6vXPF5LQ0= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR11MB6601 X-OriginatorOrg: intel.com X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org On Tue, Mar 14, 2023 at 06:31:41PM +0000, Bruce Richardson wrote: > On Tue, Mar 14, 2023 at 07:04:19PM +0100, Mattias Rönnblom wrote: > > On 2023-03-14 17:29, Bruce Richardson wrote: > > > On Tue, Mar 14, 2023 at 05:22:02PM +0100, Mattias Rönnblom wrote: > > > > Hi. > > > > > > > > Is the "b_staticpic" meson build option supposed to work with DPDK? > > > > > > > > Setting it to "false" (default is "true") causes link failures on > > > > Ubuntu 22.04, with GCC 9 and 11, on v23.03rc1 and v22.11: > > > > > > > > /usr/bin/ld: lib/librte_eal.a.p/eal_common_eal_common_errno.c.o: > > > > relocation R_X86_64_TPOFF32 against `per_lcore_retval.1' can not be > > > > used when making a shared object; recompile with -fPIC /usr/bin/ld: > > > > failed to set dynamic section sizes: bad value collect2: error: ld > > > > returned 1 exit status > > > > > > > > Does something per-lcore/TLS-related require PIC builds, even for > > > > static libraries? > > > > > > > I don't think that is the issue. The "issue" is that DPDK always does > > > both static and shared builds from the same object files, so without > > > -fPIC the shared library parts of the build fails. To support not > > > using staticpic, we'd have to disable building the .so's in those > > > cases, or each C file built twice. > > > > > > > With "default_library" set to "static", shouldn't the shared objects be > > skipped? I can see now, they are not. > > > > Yep, they aren't skipped. The reasons for this are partially historical, > and partially due to meson limitations around linking (which may now also > be historical). > > When we originally switched over to meson, IIRC there was no > "both_libraries" option, but we still had a situation where: * we wanted > to use and link staticly by default * we had *lots* of issues with > patches breaking builds as submitters had forgotten about shared libs > e.g. updating the version map Therefore, from the earliest versions of > the meson builds we had DPDK always build both libraries - using our own > logic. [This did have the desired effect of mostly eliminating version > map issues once everyone whiched over, which was nice!] > > As things moved on, meson did add support for "both_libraries", and I did > investigate using it in DPDK to have proper static-only, shared-only and > both-library builds. Unfortunately, the assumption in meson was that if > both libraries were built, the apps would link against the shared > versions. Therefore, any change to use "both_library" support in DPDK > would unfortunately lead to a change in default behaviour as our builds > would all be shared, rather than static. [I have not checked recently to > see if this can be overcome.] > > This is why things as where they are right now. :-) > For the sake of completeness: one other complication I forgot to mention - using function versioning. When we have a library containing versioned functions the build needs to be performed slightly differently depending on whether we are building it as a static or a shared library. This is because the verisoning macro need to expand slightly differently depending on the build type. This prevents us from using "both_libraries" in these cases. [And why, right now, we need to explicitly tag any libs with versioned functions, so we can compile all the source files twice, with different flags]. /Bruce