[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] x86: avoid SORT_BY_INIT_PRIORITY with old GNU ld


  • To: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Mon, 7 Mar 2022 17:15:57 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • 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=sBGHdI3enb7inDsl/3vmPPVxzYsTe6TEN595EWw/u2o=; b=kahwW6MbO1+7T1+bdeTMHEDC21xlCQ81QpnMLQIf86OadEjaAE9rFYYPziUKsU/y7xg5QKQjp7d9KKI1HH5fPn6c/f2ya0uGo9juWgaT5r9TOks0sDa3vfey6pftpOfdFeaKFWWzdnBIa4YgdH3Xv71B3KO9ZNFfO3bKwzh44hdXcr61IlNir3pJ0Mqiq+bUDGm4Uc8deUwX5DJOIZ0bauUS/cl5NHKBOQOXzsutMhVSMhKJrR7DfA56FOHI3NeVn8ihr5F6XHD/CWlztpBAfX8eqZI0Hpleq7uCwvOUEMfq+QhYJ+aHJeMsQjd3R7vKNTm1GWfH8NQCtpSroyNbCg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iLhnta1FwQmemKYv8mKXC5ygkqFmTgEZ/avjONdxBuPxHlFM50sMRLfrM672Pxk3J+L5iHKRdAERQbx2eOxckbSqun7MlcKJZ4IYMjVsEKJoX3CRJ7ZKT6KCI64zmLJtdsToBKH2Gf9++aODguqynW+LSK5PO3yNdz1C8KHIasX1CDat3b4ubpgLghEYCg0MiWcCzIEJfwi1aV3yJz9veuc4mcTJXKj1wCHZ601V7ldvl7J6c4WpphiN0joNgndj6CGJBBskrh6rGuKJPtR/NsD6rm/b8ekOGvVP88FOJnzmCdeakdgQu4aeiwl3dAp2zuxd1buJdVGDTHqp/8yB8g==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>
  • Delivery-date: Mon, 07 Mar 2022 16:16:02 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 07.03.2022 16:52, Roger Pau Monné wrote:
> On Mon, Mar 07, 2022 at 04:29:22PM +0100, Jan Beulich wrote:
>> On 07.03.2022 16:05, Roger Pau Monné wrote:
>>> On Mon, Mar 07, 2022 at 02:49:32PM +0100, Jan Beulich wrote:
>>>> Support for this construct was added in 2.22 only. Avoid the need to
>>>> introduce logic to probe for linker script capabilities by (ab)using the
>>>> probe for a command line option having appeared at about the same time.
>>>>
>>>> Fixes: 4b7fd8153ddf ("x86: fold sections in final binaries")
>>>> Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
>>>> ---
>>>> Obviously this doesn't take care of old LLVM ld yet, if any care is
>>>> needed there in the first place.
>>>>
>>>> --- a/xen/arch/x86/arch.mk
>>>> +++ b/xen/arch/x86/arch.mk
>>>> @@ -70,6 +70,11 @@ ifeq ($(CONFIG_UBSAN),y)
>>>>  $(call cc-option-add,CFLAGS_UBSAN,CC,-fno-sanitize=alignment)
>>>>  endif
>>>>  
>>>> +# While not much better than going by raw GNU ld version, utilize that the
>>>> +# feature we're after has appeared in the same release as the
>>>> +# --print-output-format command line option.
>>>> +AFLAGS-$(call ld-option,--print-output-format) += 
>>>> -DHAVE_LD_SORT_BY_INIT_PRIORITY
>>>
>>> LLVM ld doesn't have --print-output-format:
>>>
>>> % ld --print-output-format
>>> ld: error: unknown argument '--print-output-format'
>>>
>>> So it would be always defaulting to SORT. I'm not sure what to
>>> recommend.
>>
>> Do you know if all versions we support know of SORT_BY_INIT_PRIORITY?
> 
> Hm, I don't think we can assume that we support LLVM LD in 3.5. I'm
> not even sure if LLVM 3.5 had LLD in the first place.
> 
> The first version that we care about and that we test is LLVM LD 6,
> anything below that version is of unknown state.
> 
> I've tested you change with SORT_BY_INIT_PRIORITY on it and it seems
> to be fine. This was on FreeBSD 12.3 version of LLD, not sure how
> many changes have been backported from newer versions there.

I'm inclined to suggest then that we unconditionally enable use of
this, in the hope that we'll never see a bug report. But of course
this then again gets me into the business of needing to determine
the which ld variant we're working with. Looks like I won't be able
to escape this anymore ...

Jan




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.