[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: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Date: Mon, 7 Mar 2022 17:23:57 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.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=bwEf5thNpMC0iOa5SJZ3mnlSn6rIoIeQsgCpsPNQus0=; b=i5aJUPrVQrgYYv0eAxFXIGJrcmQ6Upb9+uGumVaVW7GC8CRyXiM0xbB/gl7GNxb0Q6STA+IOHSi+jgJVMtkK5K/zIa/cwG0m0knzBmDjiQzAXO91Rtm6q36ZjTA0oLPlsHjMvPA7ex6K31tDppXG5fTz5YzGswMxOWdlC+atoEnqWngn8WUokSumvLyfHgoYoRcQBXrkonGdByokhuJTwIzLsmNxPM+BsMh3xJuYj/2jt/Uuy6w0K0JGSYTaoN4QbdzWM9v1Iig8NpGr7Ew+L435tcTm86MilKWntshhwaSoSWWWw/wPbj+u5BeG02e+KDZirqlHSM2sMVN+iOf8FA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nzjdnTy9B3tbxtktFNz8Ov+2NDI2NCV010IgvgKb06aQj4wEuJ0UCwFXTBadppEVE6rSz4pDhVX4dUPzNRcx0L68vpQmBRFTjO26A4q8KqBbDOx3OpGGx9uM0CBTpZR/d6W4NSsAVyyAmT65el+V+msrV5lzrTpp8wSzSvr7nZqqUxOY6qooFhR8kiJkhgjh+Kkm1r79VaGJLJuK5ntuKp6lGHqlkqabW8v2PkIZGTxORN7acaXYlTHBJZKlOwR3niu5dG3V+knVtToZJIaXSzHgHOv8AY0tf/k47rUSkEN78dE1PgfefMRA7GmZIsKhmFuhUJK3g2sNQsWpqgk5Xg==
  • Authentication-results: esa3.hc3370-68.iphmx.com; dkim=pass (signature verified) header.i=@citrix.onmicrosoft.com
  • Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>
  • Delivery-date: Mon, 07 Mar 2022 16:24:14 +0000
  • Ironport-data: A9a23:bYCORKBFXmUjARVW/yDjw5YqxClBgxIJ4kV8jS/XYbTApDgn0mQOz mccCm3XMvfeNGqged9wOty/80hT68TRzoUxQQY4rX1jcSlH+JHPbTi7wuYcHM8wwunrFh8PA xA2M4GYRCwMZiaA4E/raNANlFEkvU2ybuOU5NXsZ2YgHWeIdA970Ug5w7Vh3dYy6TSEK1jlV e3a8pW31GCNg1aYAkpMg05UgEoy1BhakGpwUm0WPZinjneH/5UmJMt3yZWKB2n5WuFp8tuSH I4v+l0bElTxpH/BAvv9+lryn9ZjrrT6ZWBigVIOM0Sub4QrSoXfHc/XOdJFAXq7hQllkPhX0 sVO67OycT0rYLTIx88laDsJHhlhaPguFL/veRBTsOSWxkzCNXDt3+9vHAc9OohwFuRfWD8Us 6ZCcXZUM07F17neLLGTE4GAguw5K8bmJsUHs2xIxjDFF/c2B5vERs0m4PcGgWlq2JkeRJ4yY eJIUGJvfQ7sUiceAWgzLbcDs77yr17gJmgwRFW9+vNsvjm7IBZK+KfpGMrYfJqNX8o9tlaVo CfK8nr0BjkeNceD0nyV/3S0nOjNkCjnHoUIG9WQ9PRnnVmSzWw7EwANWB2wpvzRt6Klc4sBc QpOoHNo9PVsshzwJjXgY/GmiFierh1CdNhoKe9k8QXS4ZLvwVeUPndRG1atd+canMMxQDUr0 HqAkNXoGSFjvdWpdJ6NyluHhWjsYHZIdAfucQdBFFJYuIe7/OnfmzqSFo4LLUKjsjHi9dgcK RiupTN2ubgchNVjO06TrQGe2GLESnQko2cICuTrsoCNs1kRiG2NPdXABb3nARFodtrxc7V5l CJY8/VyFchXZX13qASDQf8WAJai7OufPTvXjDZHRsd9qWn8pSb8JtAAvFmSwXuF1e5eJVfUj LL741sNtPe/wlPwBUOIX25BI5tzlvWxfTgUfvvVcsBPcvBMmPyvp0lTibqr9zm1yiAEyPhnU b/CKJrEJS9DWcxPkWrnL89AgORD7n1vmgvuqWXTkk3PPUy2PyXOF9/o8TKmM4gE0U9ziF6No oYHapDTkE03vS+XSnC/zLP/5GsidBATLZv3t9ZWZqiEJA9nE3smEPjf3fUqfIkNokifvrugE q2VMqOA9GfCuA==
  • Ironport-hdrordr: A9a23:sJ1kTKydEIWFiDKWKQQcKrPxzuskLtp133Aq2lEZdPULSKOlfp GV8MjziyWYtN9wYhAdcdDpAtjmfZr5z+8O3WB3B8beYOCGghrSEGgG1+XfKlLbak/DH4JmpM Jdmu1FeaHN5DtB/LfHCWuDYq8dKbC8mcjC74eurEuFDzsaE52Ihz0JdDpzeXcGIjWua6BJcK Z1saF81kWdkDksH4yGL0hAe9KGi8zAlZrgbxJDLxk76DOWhTftzLLhCRCX0joXTjsKmN4ZgC L4uj28wp/mn+Cwyxfa2WOWx5NKmOH5wt8GIMCXkMAaJhjllw7tToV8XL+puiwzvYiUmR0Xue iJhy1lE9V46nvXcG3wiRzx2zP42DJr0HPmwU/wuwqVneXJABYBT+ZRj4NQdRXUr2A6ustn7a 5N12WF87JKEBLphk3Glpf1fiAvsnDxjWspkOYVgXAae5AZcqVtoYsW+14QOIscHRj99JssHI BVfY3hDc5tABKnhk3izylSKITGZAVxIv7GeDlOhiWt6UkZoJgjpHFohvD2nR87heYAotd/lq H5259T5cJzp/8tHNJA7dg6MLmK40z2MGTx2TGpUB3a/J9uAQO5l3ew2sRw2N2X
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On Mon, Mar 07, 2022 at 05:15:57PM +0100, Jan Beulich wrote:
> 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.

It's unlikely for anyone to try to use LLD < 6, as that wasn't
considered capable of linking the FreeBSD kernel. In fact I should
likely suggest an update to the README file for comments, as with my
FreeBSD hat I only care about LLVM >= 6.

> 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 ...

I assume bumping binutils minimum version to 2.22 is not a viable
option?

Thanks, Roger.



 


Rackspace

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