[PATCH v9 1/2] Do not attempt to workaround older binutils

Frediano Ziglio posted 2 patches 1 week ago
There is a newer version of this series
[PATCH v9 1/2] Do not attempt to workaround older binutils
Posted by Frediano Ziglio 1 week ago
From: Frediano Ziglio <frediano.ziglio@cloud.com>

Older binutils versions do not handle correctly PE files.
It looks like they could work if they don't produce debug information
but they mess the PE file in other way like putting invalid
flags in sections.
Also different tools will complain about the format (like
objdump and strip).

Signed-off-by: Frediano Ziglio <frediano.ziglio@cloud.com>
---
 xen/arch/x86/arch.mk | 7 -------
 1 file changed, 7 deletions(-)

diff --git a/xen/arch/x86/arch.mk b/xen/arch/x86/arch.mk
index 16368a498b..10eb8e4292 100644
--- a/xen/arch/x86/arch.mk
+++ b/xen/arch/x86/arch.mk
@@ -88,13 +88,6 @@ EFI_LDFLAGS := $(patsubst -m%,-mi386pep,$(LDFLAGS)) --subsystem=10 --enable-long
 LD_PE_check_cmd = $(call ld-option,$(EFI_LDFLAGS) --image-base=0x100000000 -o $(efi-check).efi $(efi-check).o)
 XEN_BUILD_PE := $(LD_PE_check_cmd)
 
-# If the above failed, it may be merely because of the linker not dealing well
-# with debug info. Try again with stripping it.
-ifeq ($(CONFIG_DEBUG_INFO)-$(XEN_BUILD_PE),y-n)
-EFI_LDFLAGS += --strip-debug
-XEN_BUILD_PE := $(LD_PE_check_cmd)
-endif
-
 ifeq ($(XEN_BUILD_PE),y)
 
 # Check if the linker produces fixups in PE by default
-- 
2.43.0
Re: [PATCH v9 1/2] Do not attempt to workaround older binutils
Posted by Jan Beulich 4 days, 10 hours ago
On 05.12.2025 17:09, Frediano Ziglio wrote:
> From: Frediano Ziglio <frediano.ziglio@cloud.com>
> 
> Older binutils versions do not handle correctly PE files.
> It looks like they could work if they don't produce debug information
> but they mess the PE file in other way like putting invalid
> flags in sections.
> Also different tools will complain about the format (like
> objdump and strip).

As already alluded to in the reply to Andrew - the above doesn't make
clear whether these binaries were in fact broken badly enough to be unusable.
As indicated there, my experience was that they were nevertheless usable. In
which case I don't think we should take such a measure.

Jan
Re: [PATCH v9 1/2] Do not attempt to workaround older binutils
Posted by Frediano Ziglio 4 days, 5 hours ago
On Mon, 8 Dec 2025 at 08:24, Jan Beulich <jbeulich@suse.com> wrote:
>
> On 05.12.2025 17:09, Frediano Ziglio wrote:
> > From: Frediano Ziglio <frediano.ziglio@cloud.com>
> >
> > Older binutils versions do not handle correctly PE files.
> > It looks like they could work if they don't produce debug information
> > but they mess the PE file in other way like putting invalid
> > flags in sections.
> > Also different tools will complain about the format (like
> > objdump and strip).
>
> As already alluded to in the reply to Andrew - the above doesn't make
> clear whether these binaries were in fact broken badly enough to be unusable.
> As indicated there, my experience was that they were nevertheless usable. In
> which case I don't think we should take such a measure.
>
> Jan

Hi,
  adding some more comments.

Frediano
Re: [PATCH v9 1/2] Do not attempt to workaround older binutils
Posted by Andrew Cooper 1 week ago
On 05/12/2025 4:09 pm, Frediano Ziglio wrote:
> From: Frediano Ziglio <frediano.ziglio@cloud.com>
>
> Older binutils versions do not handle correctly PE files.
> It looks like they could work if they don't produce debug information
> but they mess the PE file in other way like putting invalid
> flags in sections.
> Also different tools will complain about the format (like
> objdump and strip).
>
> Signed-off-by: Frediano Ziglio <frediano.ziglio@cloud.com>
> ---
>  xen/arch/x86/arch.mk | 7 -------
>  1 file changed, 7 deletions(-)
>
> diff --git a/xen/arch/x86/arch.mk b/xen/arch/x86/arch.mk
> index 16368a498b..10eb8e4292 100644
> --- a/xen/arch/x86/arch.mk
> +++ b/xen/arch/x86/arch.mk
> @@ -88,13 +88,6 @@ EFI_LDFLAGS := $(patsubst -m%,-mi386pep,$(LDFLAGS)) --subsystem=10 --enable-long
>  LD_PE_check_cmd = $(call ld-option,$(EFI_LDFLAGS) --image-base=0x100000000 -o $(efi-check).efi $(efi-check).o)
>  XEN_BUILD_PE := $(LD_PE_check_cmd)
>  
> -# If the above failed, it may be merely because of the linker not dealing well
> -# with debug info. Try again with stripping it.
> -ifeq ($(CONFIG_DEBUG_INFO)-$(XEN_BUILD_PE),y-n)
> -EFI_LDFLAGS += --strip-debug
> -XEN_BUILD_PE := $(LD_PE_check_cmd)
> -endif
> -
>  ifeq ($(XEN_BUILD_PE),y)
>  
>  # Check if the linker produces fixups in PE by default

Given the practical breakage, it's clear that noone's using xen.efi
generated from toolchains these old.

So, while it's not completely ideal to be "dropping" xen.efi on such
systems, it firmly seems like the right thing to do overall.

EFI support is still available on such systems via xen.gz + MB2.

Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
Re: [PATCH v9 1/2] Do not attempt to workaround older binutils
Posted by Jan Beulich 4 days, 11 hours ago
On 05.12.2025 18:44, Andrew Cooper wrote:
> On 05/12/2025 4:09 pm, Frediano Ziglio wrote:
>> From: Frediano Ziglio <frediano.ziglio@cloud.com>
>>
>> Older binutils versions do not handle correctly PE files.
>> It looks like they could work if they don't produce debug information
>> but they mess the PE file in other way like putting invalid
>> flags in sections.
>> Also different tools will complain about the format (like
>> objdump and strip).
>>
>> Signed-off-by: Frediano Ziglio <frediano.ziglio@cloud.com>
>> ---
>>  xen/arch/x86/arch.mk | 7 -------
>>  1 file changed, 7 deletions(-)
>>
>> diff --git a/xen/arch/x86/arch.mk b/xen/arch/x86/arch.mk
>> index 16368a498b..10eb8e4292 100644
>> --- a/xen/arch/x86/arch.mk
>> +++ b/xen/arch/x86/arch.mk
>> @@ -88,13 +88,6 @@ EFI_LDFLAGS := $(patsubst -m%,-mi386pep,$(LDFLAGS)) --subsystem=10 --enable-long
>>  LD_PE_check_cmd = $(call ld-option,$(EFI_LDFLAGS) --image-base=0x100000000 -o $(efi-check).efi $(efi-check).o)
>>  XEN_BUILD_PE := $(LD_PE_check_cmd)
>>  
>> -# If the above failed, it may be merely because of the linker not dealing well
>> -# with debug info. Try again with stripping it.
>> -ifeq ($(CONFIG_DEBUG_INFO)-$(XEN_BUILD_PE),y-n)
>> -EFI_LDFLAGS += --strip-debug
>> -XEN_BUILD_PE := $(LD_PE_check_cmd)
>> -endif
>> -
>>  ifeq ($(XEN_BUILD_PE),y)
>>  
>>  # Check if the linker produces fixups in PE by default
> 
> Given the practical breakage, it's clear that noone's using xen.efi
> generated from toolchains these old.

Where are you taking this conclusion from? The description saying "putting
invalid flags in sections" is pretty vague, and doesn't clarify whether the
result is actually unusable. I've been using xen.efi from various pretty
old tool chains without any issue. I may not have done so recently, but if
there was breakage there this would be a regression on our part then.

Jan

> So, while it's not completely ideal to be "dropping" xen.efi on such
> systems, it firmly seems like the right thing to do overall.
> 
> EFI support is still available on such systems via xen.gz + MB2.
> 
> Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
> 
> 
>