* [PATCH] x86/efi: fix build with linkers that support both coff-x86-64 and pe-x86-64
@ 2018-01-05 16:43 Roger Pau Monne
2018-01-06 2:20 ` Doug Goldstein
2018-01-08 10:11 ` Jan Beulich
0 siblings, 2 replies; 5+ messages in thread
From: Roger Pau Monne @ 2018-01-05 16:43 UTC (permalink / raw)
To: xen-devel; +Cc: Andrew Cooper, Jan Beulich, Roger Pau Monne
When using a linker that supports both formats the following error
will be triggered:
efi/buildid.o: file not recognized: File format is ambiguous
efi/buildid.o: matching formats: coff-x86-64 pe-x86-64
Solve this by specifying the buildid.o format to pe-x86-64.
Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
---
Cc: Jan Beulich <jbeulich@suse.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>
---
xen/arch/x86/Makefile | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/xen/arch/x86/Makefile b/xen/arch/x86/Makefile
index f708323722..fbff9ac3dc 100644
--- a/xen/arch/x86/Makefile
+++ b/xen/arch/x86/Makefile
@@ -188,20 +188,20 @@ endif
$(TARGET).efi: prelink-efi.o $(note_file) efi.lds efi/relocs-dummy.o $(BASEDIR)/common/symbols-dummy.o efi/mkreloc
$(foreach base, $(VIRT_BASE) $(ALT_BASE), \
$(guard) $(LD) $(call EFI_LDFLAGS,$(base)) -T efi.lds -N $< efi/relocs-dummy.o \
- $(BASEDIR)/common/symbols-dummy.o $(note_file) -o $(@D)/.$(@F).$(base).0 &&) :
+ $(BASEDIR)/common/symbols-dummy.o -b pe-x86-64 $(note_file) -o $(@D)/.$(@F).$(base).0 &&) :
$(guard) efi/mkreloc $(foreach base,$(VIRT_BASE) $(ALT_BASE),$(@D)/.$(@F).$(base).0) >$(@D)/.$(@F).0r.S
$(guard) $(NM) -pa --format=sysv $(@D)/.$(@F).$(VIRT_BASE).0 \
| $(guard) $(BASEDIR)/tools/symbols $(all_symbols) --sysv --sort >$(@D)/.$(@F).0s.S
$(guard) $(MAKE) -f $(BASEDIR)/Rules.mk $(@D)/.$(@F).0r.o $(@D)/.$(@F).0s.o
$(foreach base, $(VIRT_BASE) $(ALT_BASE), \
$(guard) $(LD) $(call EFI_LDFLAGS,$(base)) -T efi.lds -N $< \
- $(@D)/.$(@F).0r.o $(@D)/.$(@F).0s.o $(note_file) -o $(@D)/.$(@F).$(base).1 &&) :
+ $(@D)/.$(@F).0r.o $(@D)/.$(@F).0s.o -b pe-x86-64 $(note_file) -o $(@D)/.$(@F).$(base).1 &&) :
$(guard) efi/mkreloc $(foreach base,$(VIRT_BASE) $(ALT_BASE),$(@D)/.$(@F).$(base).1) >$(@D)/.$(@F).1r.S
$(guard) $(NM) -pa --format=sysv $(@D)/.$(@F).$(VIRT_BASE).1 \
| $(guard) $(BASEDIR)/tools/symbols $(all_symbols) --sysv --sort >$(@D)/.$(@F).1s.S
$(guard) $(MAKE) -f $(BASEDIR)/Rules.mk $(@D)/.$(@F).1r.o $(@D)/.$(@F).1s.o
$(guard) $(LD) $(call EFI_LDFLAGS,$(VIRT_BASE)) -T efi.lds -N $< \
- $(@D)/.$(@F).1r.o $(@D)/.$(@F).1s.o $(note_file) -o $@
+ $(@D)/.$(@F).1r.o $(@D)/.$(@F).1s.o -b pe-x86-64 $(note_file) -o $@
if $(guard) false; then rm -f $@; echo 'EFI support disabled'; \
else $(NM) -pa --format=sysv $(@D)/$(@F) \
| $(BASEDIR)/tools/symbols --xensyms --sysv --sort >$(@D)/$(@F).map; fi
--
2.15.1
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] x86/efi: fix build with linkers that support both coff-x86-64 and pe-x86-64
2018-01-05 16:43 [PATCH] x86/efi: fix build with linkers that support both coff-x86-64 and pe-x86-64 Roger Pau Monne
@ 2018-01-06 2:20 ` Doug Goldstein
2018-01-08 10:11 ` Jan Beulich
1 sibling, 0 replies; 5+ messages in thread
From: Doug Goldstein @ 2018-01-06 2:20 UTC (permalink / raw)
To: Roger Pau Monne, xen-devel; +Cc: Andrew Cooper, Jan Beulich
[-- Attachment #1.1.1: Type: text/plain, Size: 544 bytes --]
On 1/5/18 10:43 AM, Roger Pau Monne wrote:
> When using a linker that supports both formats the following error
> will be triggered:
>
> efi/buildid.o: file not recognized: File format is ambiguous
> efi/buildid.o: matching formats: coff-x86-64 pe-x86-64
>
> Solve this by specifying the buildid.o format to pe-x86-64.
>
> Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Yes. Please let's do this.
Reviewed-by: Doug Goldstein <cardoe@cardoe.com>
Tested-by: Doug Goldstein <cardoe@cardoe.com>
--
Doug Goldstein
[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 981 bytes --]
[-- Attachment #2: Type: text/plain, Size: 157 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] x86/efi: fix build with linkers that support both coff-x86-64 and pe-x86-64
2018-01-05 16:43 [PATCH] x86/efi: fix build with linkers that support both coff-x86-64 and pe-x86-64 Roger Pau Monne
2018-01-06 2:20 ` Doug Goldstein
@ 2018-01-08 10:11 ` Jan Beulich
2018-01-17 11:21 ` Roger Pau Monné
1 sibling, 1 reply; 5+ messages in thread
From: Jan Beulich @ 2018-01-08 10:11 UTC (permalink / raw)
To: Roger Pau Monne; +Cc: Andrew Cooper, xen-devel
>>> On 05.01.18 at 17:43, <roger.pau@citrix.com> wrote:
> When using a linker that supports both formats the following error
> will be triggered:
>
> efi/buildid.o: file not recognized: File format is ambiguous
> efi/buildid.o: matching formats: coff-x86-64 pe-x86-64
>
> Solve this by specifying the buildid.o format to pe-x86-64.
Nice idea. I don't suppose this works with a linker only
supporting coff-x86-64 though, but I assume such a linker
wouldn't be usable for building xen.efi anyway.
> --- a/xen/arch/x86/Makefile
> +++ b/xen/arch/x86/Makefile
> @@ -188,20 +188,20 @@ endif
> $(TARGET).efi: prelink-efi.o $(note_file) efi.lds efi/relocs-dummy.o $(BASEDIR)/common/symbols-dummy.o efi/mkreloc
> $(foreach base, $(VIRT_BASE) $(ALT_BASE), \
> $(guard) $(LD) $(call EFI_LDFLAGS,$(base)) -T efi.lds -N $< efi/relocs-dummy.o \
> - $(BASEDIR)/common/symbols-dummy.o $(note_file) -o $(@D)/.$(@F).$(base).0 &&) :
> + $(BASEDIR)/common/symbols-dummy.o -b pe-x86-64 $(note_file) -o $(@D)/.$(@F).$(base).0 &&) :
I wonder whether introducing e.g
note_file_options := -b pe-x86-64 $(note_file)
wouldn't be better than repeating the same thing three times.
Of course it would need to be clearly spelled out that this
needs to come last (or another -b would need to follow). This
would additionally deal with the case where note.o instead of
efi/buildid.o is being linked in (you don't want -b pe-x86-64
with that one, I suppose), or when build ID support isn't
available at all (the new option would then be stray and might
be warned about).
Jan
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] x86/efi: fix build with linkers that support both coff-x86-64 and pe-x86-64
2018-01-08 10:11 ` Jan Beulich
@ 2018-01-17 11:21 ` Roger Pau Monné
2018-01-17 12:24 ` Jan Beulich
0 siblings, 1 reply; 5+ messages in thread
From: Roger Pau Monné @ 2018-01-17 11:21 UTC (permalink / raw)
To: Jan Beulich; +Cc: Andrew Cooper, xen-devel
On Mon, Jan 08, 2018 at 03:11:21AM -0700, Jan Beulich wrote:
> >>> On 05.01.18 at 17:43, <roger.pau@citrix.com> wrote:
> > When using a linker that supports both formats the following error
> > will be triggered:
> >
> > efi/buildid.o: file not recognized: File format is ambiguous
> > efi/buildid.o: matching formats: coff-x86-64 pe-x86-64
> >
> > Solve this by specifying the buildid.o format to pe-x86-64.
>
> Nice idea. I don't suppose this works with a linker only
> supporting coff-x86-64 though, but I assume such a linker
> wouldn't be usable for building xen.efi anyway.
I guess you could have in theory a linker that supports i386pep and
coff-x86-64 and doesn't support pe-x86-64 and try to build a Xen efi
binary with it. I'm not sure whether that would work or not, because
AFAICT no distro ships such a linker.
IMHO making sure it works fine as long as the linker has support for
pe-x86-64 is the best option, regardless of whether coff support is
enabled or not.
> > --- a/xen/arch/x86/Makefile
> > +++ b/xen/arch/x86/Makefile
> > @@ -188,20 +188,20 @@ endif
> > $(TARGET).efi: prelink-efi.o $(note_file) efi.lds efi/relocs-dummy.o $(BASEDIR)/common/symbols-dummy.o efi/mkreloc
> > $(foreach base, $(VIRT_BASE) $(ALT_BASE), \
> > $(guard) $(LD) $(call EFI_LDFLAGS,$(base)) -T efi.lds -N $< efi/relocs-dummy.o \
> > - $(BASEDIR)/common/symbols-dummy.o $(note_file) -o $(@D)/.$(@F).$(base).0 &&) :
> > + $(BASEDIR)/common/symbols-dummy.o -b pe-x86-64 $(note_file) -o $(@D)/.$(@F).$(base).0 &&) :
>
> I wonder whether introducing e.g
>
> note_file_options := -b pe-x86-64 $(note_file)
>
> wouldn't be better than repeating the same thing three times.
> Of course it would need to be clearly spelled out that this
> needs to come last (or another -b would need to follow). This
> would additionally deal with the case where note.o instead of
> efi/buildid.o is being linked in (you don't want -b pe-x86-64
> with that one, I suppose), or when build ID support isn't
> available at all (the new option would then be stray and might
> be warned about).
What about doing something like:
ifneq ($(build_id_linker),)
ifeq ($(call ld-ver-build-id,$(LD) $(filter -m%,$(EFI_LDFLAGS))),y)
CFLAGS += -DBUILD_ID_EFI
EFI_LDFLAGS += $(build_id_linker)
# Note that this must be the last input in the ld call, because
# inputs following the -b option will all be treated as being in the
# specified format.
note_file := -b pe-x86-64 efi/buildid.o
else
note_file := note.o
endif
else
note_file :=
endif
Thanks, Roger.
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] x86/efi: fix build with linkers that support both coff-x86-64 and pe-x86-64
2018-01-17 11:21 ` Roger Pau Monné
@ 2018-01-17 12:24 ` Jan Beulich
0 siblings, 0 replies; 5+ messages in thread
From: Jan Beulich @ 2018-01-17 12:24 UTC (permalink / raw)
To: Roger Pau Monné; +Cc: Andrew Cooper, xen-devel
>>> On 17.01.18 at 12:21, <roger.pau@citrix.com> wrote:
> On Mon, Jan 08, 2018 at 03:11:21AM -0700, Jan Beulich wrote:
>> >>> On 05.01.18 at 17:43, <roger.pau@citrix.com> wrote:
>> > --- a/xen/arch/x86/Makefile
>> > +++ b/xen/arch/x86/Makefile
>> > @@ -188,20 +188,20 @@ endif
>> > $(TARGET).efi: prelink-efi.o $(note_file) efi.lds efi/relocs-dummy.o $(BASEDIR)/common/symbols-dummy.o efi/mkreloc
>> > $(foreach base, $(VIRT_BASE) $(ALT_BASE), \
>> > $(guard) $(LD) $(call EFI_LDFLAGS,$(base)) -T efi.lds -N $< efi/relocs-dummy.o \
>> > - $(BASEDIR)/common/symbols-dummy.o $(note_file) -o $(@D)/.$(@F).$(base).0 &&) :
>> > + $(BASEDIR)/common/symbols-dummy.o -b pe-x86-64 $(note_file) -o $(@D)/.$(@F).$(base).0 &&) :
>>
>> I wonder whether introducing e.g
>>
>> note_file_options := -b pe-x86-64 $(note_file)
>>
>> wouldn't be better than repeating the same thing three times.
>> Of course it would need to be clearly spelled out that this
>> needs to come last (or another -b would need to follow). This
>> would additionally deal with the case where note.o instead of
>> efi/buildid.o is being linked in (you don't want -b pe-x86-64
>> with that one, I suppose), or when build ID support isn't
>> available at all (the new option would then be stray and might
>> be warned about).
>
> What about doing something like:
>
> ifneq ($(build_id_linker),)
> ifeq ($(call ld-ver-build-id,$(LD) $(filter -m%,$(EFI_LDFLAGS))),y)
> CFLAGS += -DBUILD_ID_EFI
> EFI_LDFLAGS += $(build_id_linker)
> # Note that this must be the last input in the ld call, because
> # inputs following the -b option will all be treated as being in the
> # specified format.
> note_file := -b pe-x86-64 efi/buildid.o
I'm afraid this will not work with the use of $(note_file) as a
dependency of xen.efi (indeed I first too had been considering
simply extending this variable).
Jan
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2018-01-17 12:24 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-05 16:43 [PATCH] x86/efi: fix build with linkers that support both coff-x86-64 and pe-x86-64 Roger Pau Monne
2018-01-06 2:20 ` Doug Goldstein
2018-01-08 10:11 ` Jan Beulich
2018-01-17 11:21 ` Roger Pau Monné
2018-01-17 12:24 ` Jan Beulich
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.