* [PATCH v3 0/2] EFI build improvements @ 2018-07-18 10:27 Roger Pau Monne 2018-07-18 10:27 ` [PATCH v3 1/2] x86/efi: move the logic to detect PE build support Roger Pau Monne 2018-07-18 10:27 ` [PATCH v3 2/2] x86/efi: split compiler vs linker support Roger Pau Monne 0 siblings, 2 replies; 11+ messages in thread From: Roger Pau Monne @ 2018-07-18 10:27 UTC (permalink / raw) To: xen-devel; +Cc: Roger Pau Monne Hello, The following patches started as a workaround to build Xen using lld (the LLVM linker), but now patch #2 is an improvement of the build system, thus allowing to create a multiboot2 capable ELF binary requiring just a compiler that supports the MS ABI. Previously in order to build a multiboot2 capable ELF binary linker PE support was also required. The series can be found at: git://xenbits.xen.org/people/royger/xen.git efi.v3 Thanks, Roger. Roger Pau Monne (2): x86/efi: move the logic to detect PE build support x86/efi: split compiler vs linker support .gitignore | 1 - xen/arch/x86/Makefile | 10 ++++++++-- xen/arch/x86/efi/Makefile | 11 +++-------- xen/arch/x86/xen.lds.S | 4 +++- 4 files changed, 14 insertions(+), 12 deletions(-) -- 2.18.0 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel ^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH v3 1/2] x86/efi: move the logic to detect PE build support 2018-07-18 10:27 [PATCH v3 0/2] EFI build improvements Roger Pau Monne @ 2018-07-18 10:27 ` Roger Pau Monne 2018-07-25 12:48 ` Daniel Kiper 2018-07-18 10:27 ` [PATCH v3 2/2] x86/efi: split compiler vs linker support Roger Pau Monne 1 sibling, 1 reply; 11+ messages in thread From: Roger Pau Monne @ 2018-07-18 10:27 UTC (permalink / raw) To: xen-devel; +Cc: Andrew Cooper, Daniel Kiper, Jan Beulich, Roger Pau Monne So that it can be used by other components apart from the efi specific code. By moving the detection code creating a dummy efi/disabled file can be avoided. This is required so that the conditional used to define the efi symbol in the linker script can be removed and instead the definition of the efi symbol can be guarded using the preprocessor. The motivation behind this change is to be able to build Xen using lld (the LLVM linker), that at least on version 6.0.0 doesn't work properly with a DEFINED being used in a conditional expression: ld -melf_x86_64_fbsd -T xen.lds -N prelink.o --build-id=sha1 \ /root/src/xen/xen/common/symbols-dummy.o -o /root/src/xen/xen/.xen-syms.0 ld: error: xen.lds:233: symbol not found: efi Signed-off-by: Roger Pau Monné <roger.pau@citrix.com> Reviewed-by: Jan Beulich <jbeulich@suse.com> --- Cc: Jan Beulich <jbeulich@suse.com> Cc: Andrew Cooper <andrew.cooper3@citrix.com> Cc: Daniel Kiper <daniel.kiper@oracle.com> --- Changes since v2: - Use CFLAGS-y to append the XEN_BUILD_PE define. - Check that XEN_BUILD_PE is set to 'y' in order to build the PE binary. Changes since v1: - Rename variable. - Remove usage of the efi/disabled file. --- .gitignore | 1 - xen/arch/x86/Makefile | 9 +++++++-- xen/arch/x86/efi/Makefile | 11 +++-------- xen/arch/x86/xen.lds.S | 4 +++- 4 files changed, 13 insertions(+), 12 deletions(-) diff --git a/.gitignore b/.gitignore index 5b8448d8f7..aa6856c2b9 100644 --- a/.gitignore +++ b/.gitignore @@ -302,7 +302,6 @@ xen/arch/x86/boot/*.bin xen/arch/x86/boot/*.lnk xen/arch/x86/efi.lds xen/arch/x86/efi/check.efi -xen/arch/x86/efi/disabled xen/arch/x86/efi/mkreloc xen/arch/*/efi/boot.c xen/arch/*/efi/compat.c diff --git a/xen/arch/x86/Makefile b/xen/arch/x86/Makefile index 5563c813dd..172685fb41 100644 --- a/xen/arch/x86/Makefile +++ b/xen/arch/x86/Makefile @@ -163,10 +163,15 @@ EFI_LDFLAGS += --minor-image-version=$(XEN_SUBVERSION) EFI_LDFLAGS += --major-os-version=2 --minor-os-version=0 EFI_LDFLAGS += --major-subsystem-version=2 --minor-subsystem-version=0 +# Check if the build system supports PE. +XEN_BUILD_PE := $(shell $(CC) $(filter-out $(CFLAGS-y) .%.d,$(CFLAGS)) -c efi/check.c -o efi/check.o 2>/dev/null && echo y) +export XEN_BUILD_PE := $(if $(XEN_BUILD_PE),$(shell $(LD) -mi386pep --subsystem=10 -o efi/check.efi efi/check.o 2>/dev/null && echo y)) +CFLAGS-$(XEN_BUILD_PE) += -DXEN_BUILD_PE + $(TARGET).efi: VIRT_BASE = 0x$(shell $(NM) efi/relocs-dummy.o | sed -n 's, A VIRT_START$$,,p') $(TARGET).efi: ALT_BASE = 0x$(shell $(NM) efi/relocs-dummy.o | sed -n 's, A ALT_START$$,,p') # Don't use $(wildcard ...) here - at least make 3.80 expands this too early! -$(TARGET).efi: guard = $(if $(shell echo efi/dis* | grep disabled),:) +$(TARGET).efi: guard = $(if $(filter y,$(XEN_BUILD_PE)),,:) ifneq ($(build_id_linker),) ifeq ($(call ld-ver-build-id,$(LD) $(filter -m%,$(EFI_LDFLAGS))),y) @@ -232,6 +237,6 @@ efi/mkreloc: efi/mkreloc.c clean:: rm -f asm-offsets.s *.lds boot/*.o boot/*~ boot/core boot/mkelf32 rm -f $(BASEDIR)/.xen-syms.[0-9]* boot/.*.d - rm -f $(BASEDIR)/.xen.efi.[0-9]* efi/*.efi efi/disabled efi/mkreloc + rm -f $(BASEDIR)/.xen.efi.[0-9]* efi/*.efi efi/mkreloc rm -f boot/cmdline.S boot/reloc.S boot/*.lnk boot/*.bin rm -f note.o diff --git a/xen/arch/x86/efi/Makefile b/xen/arch/x86/efi/Makefile index 3be9661108..918383b325 100644 --- a/xen/arch/x86/efi/Makefile +++ b/xen/arch/x86/efi/Makefile @@ -1,16 +1,11 @@ CFLAGS += -fshort-wchar -efi := y$(shell rm -f disabled) -efi := $(if $(efi),$(shell $(CC) $(filter-out $(CFLAGS-y) .%.d,$(CFLAGS)) -c check.c 2>disabled && echo y)) -efi := $(if $(efi),$(shell $(LD) -mi386pep --subsystem=10 -o check.efi check.o 2>disabled && echo y)) -efi := $(if $(efi),$(shell rm disabled)y) - %.o: %.ihex $(OBJCOPY) -I ihex -O binary $< $@ boot.init.o: buildid.o obj-y := stub.o -obj-$(efi) := boot.init.o compat.o relocs-dummy.o runtime.o -extra-$(efi) += buildid.o -nocov-$(efi) += stub.o +obj-$(XEN_BUILD_PE) := boot.init.o compat.o relocs-dummy.o runtime.o +extra-$(XEN_BUILD_PE) += buildid.o +nocov-$(XEN_BUILD_PE) += stub.o diff --git a/xen/arch/x86/xen.lds.S b/xen/arch/x86/xen.lds.S index 326e885402..4a59467986 100644 --- a/xen/arch/x86/xen.lds.S +++ b/xen/arch/x86/xen.lds.S @@ -304,7 +304,9 @@ SECTIONS } :text #endif - efi = DEFINED(efi) ? efi : .; +#ifndef XEN_BUILD_PE + efi = .; +#endif /* Sections to be discarded */ /DISCARD/ : { -- 2.18.0 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel ^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH v3 1/2] x86/efi: move the logic to detect PE build support 2018-07-18 10:27 ` [PATCH v3 1/2] x86/efi: move the logic to detect PE build support Roger Pau Monne @ 2018-07-25 12:48 ` Daniel Kiper 2018-07-25 13:38 ` Roger Pau Monné 0 siblings, 1 reply; 11+ messages in thread From: Daniel Kiper @ 2018-07-25 12:48 UTC (permalink / raw) To: Roger Pau Monne; +Cc: xen-devel, Jan Beulich, Andrew Cooper On Wed, Jul 18, 2018 at 12:27:32PM +0200, Roger Pau Monne wrote: > So that it can be used by other components apart from the efi specific > code. By moving the detection code creating a dummy efi/disabled file > can be avoided. > > This is required so that the conditional used to define the efi symbol > in the linker script can be removed and instead the definition of the > efi symbol can be guarded using the preprocessor. > > The motivation behind this change is to be able to build Xen using lld > (the LLVM linker), that at least on version 6.0.0 doesn't work > properly with a DEFINED being used in a conditional expression: > > ld -melf_x86_64_fbsd -T xen.lds -N prelink.o --build-id=sha1 \ > /root/src/xen/xen/common/symbols-dummy.o -o /root/src/xen/xen/.xen-syms.0 > ld: error: xen.lds:233: symbol not found: efi > > Signed-off-by: Roger Pau Monné <roger.pau@citrix.com> > Reviewed-by: Jan Beulich <jbeulich@suse.com> This patch does more than subject says. So, please split this patch into 2 parts. One which really moves the detection logic and the second which replaces DEFINED() with #ifdef. Daniel _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v3 1/2] x86/efi: move the logic to detect PE build support 2018-07-25 12:48 ` Daniel Kiper @ 2018-07-25 13:38 ` Roger Pau Monné 2018-07-25 14:08 ` Daniel Kiper 2018-07-25 14:38 ` Jan Beulich 0 siblings, 2 replies; 11+ messages in thread From: Roger Pau Monné @ 2018-07-25 13:38 UTC (permalink / raw) To: Daniel Kiper; +Cc: xen-devel, Jan Beulich, Andrew Cooper On Wed, Jul 25, 2018 at 02:48:28PM +0200, Daniel Kiper wrote: > On Wed, Jul 18, 2018 at 12:27:32PM +0200, Roger Pau Monne wrote: > > So that it can be used by other components apart from the efi specific > > code. By moving the detection code creating a dummy efi/disabled file > > can be avoided. > > > > This is required so that the conditional used to define the efi symbol > > in the linker script can be removed and instead the definition of the > > efi symbol can be guarded using the preprocessor. > > > > The motivation behind this change is to be able to build Xen using lld > > (the LLVM linker), that at least on version 6.0.0 doesn't work > > properly with a DEFINED being used in a conditional expression: > > > > ld -melf_x86_64_fbsd -T xen.lds -N prelink.o --build-id=sha1 \ > > /root/src/xen/xen/common/symbols-dummy.o -o /root/src/xen/xen/.xen-syms.0 > > ld: error: xen.lds:233: symbol not found: efi > > > > Signed-off-by: Roger Pau Monné <roger.pau@citrix.com> > > Reviewed-by: Jan Beulich <jbeulich@suse.com> > > This patch does more than subject says. So, please split this patch into > 2 parts. One which really moves the detection logic and the second which > replaces DEFINED() with #ifdef. It's not possible to place the whole contents of the patch in a subject line, that's why there's also a commit message that I think correctly explains everything done in the patch. IMO just having a patch to change the DEFINED to an ifdef is quite pointless, it's better to switch it here together with the change that actually introduces the define itself. Thanks, Roger. _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v3 1/2] x86/efi: move the logic to detect PE build support 2018-07-25 13:38 ` Roger Pau Monné @ 2018-07-25 14:08 ` Daniel Kiper 2018-07-25 14:38 ` Jan Beulich 1 sibling, 0 replies; 11+ messages in thread From: Daniel Kiper @ 2018-07-25 14:08 UTC (permalink / raw) To: Roger Pau Monné; +Cc: xen-devel, Jan Beulich, Andrew Cooper On Wed, Jul 25, 2018 at 03:38:43PM +0200, Roger Pau Monné wrote: > On Wed, Jul 25, 2018 at 02:48:28PM +0200, Daniel Kiper wrote: > > On Wed, Jul 18, 2018 at 12:27:32PM +0200, Roger Pau Monne wrote: > > > So that it can be used by other components apart from the efi specific > > > code. By moving the detection code creating a dummy efi/disabled file > > > can be avoided. > > > > > > This is required so that the conditional used to define the efi symbol > > > in the linker script can be removed and instead the definition of the > > > efi symbol can be guarded using the preprocessor. > > > > > > The motivation behind this change is to be able to build Xen using lld > > > (the LLVM linker), that at least on version 6.0.0 doesn't work > > > properly with a DEFINED being used in a conditional expression: > > > > > > ld -melf_x86_64_fbsd -T xen.lds -N prelink.o --build-id=sha1 \ > > > /root/src/xen/xen/common/symbols-dummy.o -o /root/src/xen/xen/.xen-syms.0 > > > ld: error: xen.lds:233: symbol not found: efi > > > > > > Signed-off-by: Roger Pau Monné <roger.pau@citrix.com> > > > Reviewed-by: Jan Beulich <jbeulich@suse.com> > > > > This patch does more than subject says. So, please split this patch into > > 2 parts. One which really moves the detection logic and the second which > > replaces DEFINED() with #ifdef. > > It's not possible to place the whole contents of the patch in a > subject line, that's why there's also a commit message that I think > correctly explains everything done in the patch. OK, but the subject suggests that the main goal is the PE build support detection code realignment but AIUI the main goal is DEFINED() drop. So, this should be in subject. And current commit message is confusing too. It discuss realignment first and then mentions DEFINED() drop. I think that it should be done other way around. > IMO just having a patch to change the DEFINED to an ifdef is quite > pointless, it's better to switch it here together with the change that > actually introduces the define itself. I would do this split. If at some point we have to revert DEFINED() change then we have to revert whole patch and the following one. If we do the split we will avoid that problem. And it can be useful for bissect. Daniel _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v3 1/2] x86/efi: move the logic to detect PE build support 2018-07-25 13:38 ` Roger Pau Monné 2018-07-25 14:08 ` Daniel Kiper @ 2018-07-25 14:38 ` Jan Beulich 2018-07-25 14:53 ` Daniel Kiper 1 sibling, 1 reply; 11+ messages in thread From: Jan Beulich @ 2018-07-25 14:38 UTC (permalink / raw) To: Roger Pau Monne, Daniel Kiper; +Cc: Andrew Cooper, xen-devel >>> On 25.07.18 at 15:38, <roger.pau@citrix.com> wrote: > On Wed, Jul 25, 2018 at 02:48:28PM +0200, Daniel Kiper wrote: >> On Wed, Jul 18, 2018 at 12:27:32PM +0200, Roger Pau Monne wrote: >> > So that it can be used by other components apart from the efi specific >> > code. By moving the detection code creating a dummy efi/disabled file >> > can be avoided. >> > >> > This is required so that the conditional used to define the efi symbol >> > in the linker script can be removed and instead the definition of the >> > efi symbol can be guarded using the preprocessor. >> > >> > The motivation behind this change is to be able to build Xen using lld >> > (the LLVM linker), that at least on version 6.0.0 doesn't work >> > properly with a DEFINED being used in a conditional expression: >> > >> > ld -melf_x86_64_fbsd -T xen.lds -N prelink.o --build-id=sha1 \ >> > /root/src/xen/xen/common/symbols-dummy.o -o /root/src/xen/xen/.xen-syms.0 >> > ld: error: xen.lds:233: symbol not found: efi >> > >> > Signed-off-by: Roger Pau Monné <roger.pau@citrix.com> >> > Reviewed-by: Jan Beulich <jbeulich@suse.com> >> >> This patch does more than subject says. So, please split this patch into >> 2 parts. One which really moves the detection logic and the second which >> replaces DEFINED() with #ifdef. > > It's not possible to place the whole contents of the patch in a > subject line, that's why there's also a commit message that I think > correctly explains everything done in the patch. > > IMO just having a patch to change the DEFINED to an ifdef is quite > pointless, it's better to switch it here together with the change that > actually introduces the define itself. FTR I'm fine with the patch as is, as indicated by my R-b. Jan _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v3 1/2] x86/efi: move the logic to detect PE build support 2018-07-25 14:38 ` Jan Beulich @ 2018-07-25 14:53 ` Daniel Kiper 0 siblings, 0 replies; 11+ messages in thread From: Daniel Kiper @ 2018-07-25 14:53 UTC (permalink / raw) To: Jan Beulich; +Cc: Andrew Cooper, xen-devel, Roger Pau Monne On Wed, Jul 25, 2018 at 08:38:16AM -0600, Jan Beulich wrote: > >>> On 25.07.18 at 15:38, <roger.pau@citrix.com> wrote: > > On Wed, Jul 25, 2018 at 02:48:28PM +0200, Daniel Kiper wrote: > >> On Wed, Jul 18, 2018 at 12:27:32PM +0200, Roger Pau Monne wrote: > >> > So that it can be used by other components apart from the efi specific > >> > code. By moving the detection code creating a dummy efi/disabled file > >> > can be avoided. > >> > > >> > This is required so that the conditional used to define the efi symbol > >> > in the linker script can be removed and instead the definition of the > >> > efi symbol can be guarded using the preprocessor. > >> > > >> > The motivation behind this change is to be able to build Xen using lld > >> > (the LLVM linker), that at least on version 6.0.0 doesn't work > >> > properly with a DEFINED being used in a conditional expression: > >> > > >> > ld -melf_x86_64_fbsd -T xen.lds -N prelink.o --build-id=sha1 \ > >> > /root/src/xen/xen/common/symbols-dummy.o -o /root/src/xen/xen/.xen-syms.0 > >> > ld: error: xen.lds:233: symbol not found: efi > >> > > >> > Signed-off-by: Roger Pau Monné <roger.pau@citrix.com> > >> > Reviewed-by: Jan Beulich <jbeulich@suse.com> > >> > >> This patch does more than subject says. So, please split this patch into > >> 2 parts. One which really moves the detection logic and the second which > >> replaces DEFINED() with #ifdef. > > > > It's not possible to place the whole contents of the patch in a > > subject line, that's why there's also a commit message that I think > > correctly explains everything done in the patch. > > > > IMO just having a patch to change the DEFINED to an ifdef is quite > > pointless, it's better to switch it here together with the change that > > actually introduces the define itself. > > FTR I'm fine with the patch as is, as indicated by my R-b. If Roger do not want to change this patch and you are OK with it you can add my Tested-by: Daniel Kiper <daniel.kiper@oracle.com> and go ahead. Daniel _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel ^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH v3 2/2] x86/efi: split compiler vs linker support 2018-07-18 10:27 [PATCH v3 0/2] EFI build improvements Roger Pau Monne 2018-07-18 10:27 ` [PATCH v3 1/2] x86/efi: move the logic to detect PE build support Roger Pau Monne @ 2018-07-18 10:27 ` Roger Pau Monne 2018-07-18 14:41 ` Jan Beulich 1 sibling, 1 reply; 11+ messages in thread From: Roger Pau Monne @ 2018-07-18 10:27 UTC (permalink / raw) To: xen-devel; +Cc: Andrew Cooper, Daniel Kiper, Jan Beulich, Roger Pau Monne So that an ELF binary with support for EFI services will be built when the compiler supports the MS ABI, regardless of the linker support for PE. Signed-off-by: Roger Pau Monné <roger.pau@citrix.com> Reviewed-by: Jan Beulich <jbeulich@suse.com> --- Cc: Jan Beulich <jbeulich@suse.com> Cc: Andrew Cooper <andrew.cooper3@citrix.com> Cc: Daniel Kiper <daniel.kiper@oracle.com> --- Changes since v1: - New in this version. --- xen/arch/x86/Makefile | 7 ++++--- xen/arch/x86/efi/Makefile | 6 +++--- xen/arch/x86/xen.lds.S | 2 +- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/xen/arch/x86/Makefile b/xen/arch/x86/Makefile index 172685fb41..1301f52c3b 100644 --- a/xen/arch/x86/Makefile +++ b/xen/arch/x86/Makefile @@ -163,9 +163,10 @@ EFI_LDFLAGS += --minor-image-version=$(XEN_SUBVERSION) EFI_LDFLAGS += --major-os-version=2 --minor-os-version=0 EFI_LDFLAGS += --major-subsystem-version=2 --minor-subsystem-version=0 -# Check if the build system supports PE. -XEN_BUILD_PE := $(shell $(CC) $(filter-out $(CFLAGS-y) .%.d,$(CFLAGS)) -c efi/check.c -o efi/check.o 2>/dev/null && echo y) -export XEN_BUILD_PE := $(if $(XEN_BUILD_PE),$(shell $(LD) -mi386pep --subsystem=10 -o efi/check.efi efi/check.o 2>/dev/null && echo y)) +# Check if the compiler supports the MS ABI. +export XEN_BUILD_EFI := $(shell $(CC) $(filter-out $(CFLAGS-y) .%.d,$(CFLAGS)) -c efi/check.c -o efi/check.o 2>/dev/null && echo y) +# Check if the linker supports PE. +XEN_BUILD_PE := $(if $(XEN_BUILD_EFI),$(shell $(LD) -mi386pep --subsystem=10 -o efi/check.efi efi/check.o 2>/dev/null && echo y)) CFLAGS-$(XEN_BUILD_PE) += -DXEN_BUILD_PE $(TARGET).efi: VIRT_BASE = 0x$(shell $(NM) efi/relocs-dummy.o | sed -n 's, A VIRT_START$$,,p') diff --git a/xen/arch/x86/efi/Makefile b/xen/arch/x86/efi/Makefile index 918383b325..3816de2738 100644 --- a/xen/arch/x86/efi/Makefile +++ b/xen/arch/x86/efi/Makefile @@ -6,6 +6,6 @@ CFLAGS += -fshort-wchar boot.init.o: buildid.o obj-y := stub.o -obj-$(XEN_BUILD_PE) := boot.init.o compat.o relocs-dummy.o runtime.o -extra-$(XEN_BUILD_PE) += buildid.o -nocov-$(XEN_BUILD_PE) += stub.o +obj-$(XEN_BUILD_EFI) := boot.init.o compat.o relocs-dummy.o runtime.o +extra-$(XEN_BUILD_EFI) += buildid.o +nocov-$(XEN_BUILD_EFI) += stub.o diff --git a/xen/arch/x86/xen.lds.S b/xen/arch/x86/xen.lds.S index 4a59467986..6e9bda5109 100644 --- a/xen/arch/x86/xen.lds.S +++ b/xen/arch/x86/xen.lds.S @@ -304,7 +304,7 @@ SECTIONS } :text #endif -#ifndef XEN_BUILD_PE +#ifndef XEN_BUILD_EFI efi = .; #endif -- 2.18.0 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel ^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH v3 2/2] x86/efi: split compiler vs linker support 2018-07-18 10:27 ` [PATCH v3 2/2] x86/efi: split compiler vs linker support Roger Pau Monne @ 2018-07-18 14:41 ` Jan Beulich 2018-07-18 15:29 ` Roger Pau Monné 0 siblings, 1 reply; 11+ messages in thread From: Jan Beulich @ 2018-07-18 14:41 UTC (permalink / raw) To: Roger Pau Monne; +Cc: Andrew Cooper, Daniel Kiper, xen-devel >>> On 18.07.18 at 12:27, <roger.pau@citrix.com> wrote: > So that an ELF binary with support for EFI services will be built when > the compiler supports the MS ABI, regardless of the linker support for > PE. > > Signed-off-by: Roger Pau Monné <roger.pau@citrix.com> > Reviewed-by: Jan Beulich <jbeulich@suse.com> > --- > Cc: Jan Beulich <jbeulich@suse.com> > Cc: Andrew Cooper <andrew.cooper3@citrix.com> > Cc: Daniel Kiper <daniel.kiper@oracle.com> > --- > Changes since v1: > - New in this version. > --- > xen/arch/x86/Makefile | 7 ++++--- > xen/arch/x86/efi/Makefile | 6 +++--- > xen/arch/x86/xen.lds.S | 2 +- > 3 files changed, 8 insertions(+), 7 deletions(-) > > diff --git a/xen/arch/x86/Makefile b/xen/arch/x86/Makefile > index 172685fb41..1301f52c3b 100644 > --- a/xen/arch/x86/Makefile > +++ b/xen/arch/x86/Makefile > @@ -163,9 +163,10 @@ EFI_LDFLAGS += --minor-image-version=$(XEN_SUBVERSION) > EFI_LDFLAGS += --major-os-version=2 --minor-os-version=0 > EFI_LDFLAGS += --major-subsystem-version=2 --minor-subsystem-version=0 > > -# Check if the build system supports PE. > -XEN_BUILD_PE := $(shell $(CC) $(filter-out $(CFLAGS-y) .%.d,$(CFLAGS)) -c efi/check.c -o efi/check.o 2>/dev/null && echo y) > -export XEN_BUILD_PE := $(if $(XEN_BUILD_PE),$(shell $(LD) -mi386pep --subsystem=10 -o efi/check.efi efi/check.o 2>/dev/null && echo y)) > +# Check if the compiler supports the MS ABI. > +export XEN_BUILD_EFI := $(shell $(CC) $(filter-out $(CFLAGS-y) .%.d,$(CFLAGS)) -c efi/check.c -o efi/check.o 2>/dev/null && echo y) > +# Check if the linker supports PE. > +XEN_BUILD_PE := $(if $(XEN_BUILD_EFI),$(shell $(LD) -mi386pep --subsystem=10 -o efi/check.efi efi/check.o 2>/dev/null && echo y)) > CFLAGS-$(XEN_BUILD_PE) += -DXEN_BUILD_PE Rebasing (over patch 1) mistake? I think this wants to be CFLAGS-$(XEN_BUILD_EFI) += -DXEN_BUILD_EFI for ... > --- a/xen/arch/x86/xen.lds.S > +++ b/xen/arch/x86/xen.lds.S > @@ -304,7 +304,7 @@ SECTIONS > } :text > #endif > > -#ifndef XEN_BUILD_PE > +#ifndef XEN_BUILD_EFI > efi = .; > #endif ... this to work. Jan _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v3 2/2] x86/efi: split compiler vs linker support 2018-07-18 14:41 ` Jan Beulich @ 2018-07-18 15:29 ` Roger Pau Monné 2018-07-25 12:52 ` Daniel Kiper 0 siblings, 1 reply; 11+ messages in thread From: Roger Pau Monné @ 2018-07-18 15:29 UTC (permalink / raw) To: Jan Beulich; +Cc: Andrew Cooper, Daniel Kiper, xen-devel On Wed, Jul 18, 2018 at 08:41:30AM -0600, Jan Beulich wrote: > >>> On 18.07.18 at 12:27, <roger.pau@citrix.com> wrote: > > So that an ELF binary with support for EFI services will be built when > > the compiler supports the MS ABI, regardless of the linker support for > > PE. > > > > Signed-off-by: Roger Pau Monné <roger.pau@citrix.com> > > Reviewed-by: Jan Beulich <jbeulich@suse.com> > > --- > > Cc: Jan Beulich <jbeulich@suse.com> > > Cc: Andrew Cooper <andrew.cooper3@citrix.com> > > Cc: Daniel Kiper <daniel.kiper@oracle.com> > > --- > > Changes since v1: > > - New in this version. > > --- > > xen/arch/x86/Makefile | 7 ++++--- > > xen/arch/x86/efi/Makefile | 6 +++--- > > xen/arch/x86/xen.lds.S | 2 +- > > 3 files changed, 8 insertions(+), 7 deletions(-) > > > > diff --git a/xen/arch/x86/Makefile b/xen/arch/x86/Makefile > > index 172685fb41..1301f52c3b 100644 > > --- a/xen/arch/x86/Makefile > > +++ b/xen/arch/x86/Makefile > > @@ -163,9 +163,10 @@ EFI_LDFLAGS += --minor-image-version=$(XEN_SUBVERSION) > > EFI_LDFLAGS += --major-os-version=2 --minor-os-version=0 > > EFI_LDFLAGS += --major-subsystem-version=2 --minor-subsystem-version=0 > > > > -# Check if the build system supports PE. > > -XEN_BUILD_PE := $(shell $(CC) $(filter-out $(CFLAGS-y) .%.d,$(CFLAGS)) -c efi/check.c -o efi/check.o 2>/dev/null && echo y) > > -export XEN_BUILD_PE := $(if $(XEN_BUILD_PE),$(shell $(LD) -mi386pep --subsystem=10 -o efi/check.efi efi/check.o 2>/dev/null && echo y)) > > +# Check if the compiler supports the MS ABI. > > +export XEN_BUILD_EFI := $(shell $(CC) $(filter-out $(CFLAGS-y) .%.d,$(CFLAGS)) -c efi/check.c -o efi/check.o 2>/dev/null && echo y) > > +# Check if the linker supports PE. > > +XEN_BUILD_PE := $(if $(XEN_BUILD_EFI),$(shell $(LD) -mi386pep --subsystem=10 -o efi/check.efi efi/check.o 2>/dev/null && echo y)) > > CFLAGS-$(XEN_BUILD_PE) += -DXEN_BUILD_PE > > Rebasing (over patch 1) mistake? I think this wants to be > > CFLAGS-$(XEN_BUILD_EFI) += -DXEN_BUILD_EFI Indeed, sorry. I've pushed a new branch: git://xenbits.xen.org/people/royger/xen.git efi.v4 And updated the patch appended below. ---8<--- From 820fc00d1f1c7c691794f88f5b818fab81ac7127 Mon Sep 17 00:00:00 2001 From: Roger Pau Monne <roger.pau@citrix.com> Date: Wed, 18 Jul 2018 11:59:03 +0200 Subject: [PATCH v4 2/2] x86/efi: split compiler vs linker support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit So that an ELF binary with support for EFI services will be built when the compiler supports the MS ABI, regardless of the linker support for PE. Signed-off-by: Roger Pau Monné <roger.pau@citrix.com> Reviewed-by: Jan Beulich <jbeulich@suse.com> --- Cc: Jan Beulich <jbeulich@suse.com> Cc: Andrew Cooper <andrew.cooper3@citrix.com> Cc: Daniel Kiper <daniel.kiper@oracle.com> --- Changes since v1: - New in this version. --- xen/arch/x86/Makefile | 9 +++++---- xen/arch/x86/efi/Makefile | 6 +++--- xen/arch/x86/xen.lds.S | 2 +- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/xen/arch/x86/Makefile b/xen/arch/x86/Makefile index 172685fb41..17e7d3fa34 100644 --- a/xen/arch/x86/Makefile +++ b/xen/arch/x86/Makefile @@ -163,10 +163,11 @@ EFI_LDFLAGS += --minor-image-version=$(XEN_SUBVERSION) EFI_LDFLAGS += --major-os-version=2 --minor-os-version=0 EFI_LDFLAGS += --major-subsystem-version=2 --minor-subsystem-version=0 -# Check if the build system supports PE. -XEN_BUILD_PE := $(shell $(CC) $(filter-out $(CFLAGS-y) .%.d,$(CFLAGS)) -c efi/check.c -o efi/check.o 2>/dev/null && echo y) -export XEN_BUILD_PE := $(if $(XEN_BUILD_PE),$(shell $(LD) -mi386pep --subsystem=10 -o efi/check.efi efi/check.o 2>/dev/null && echo y)) -CFLAGS-$(XEN_BUILD_PE) += -DXEN_BUILD_PE +# Check if the compiler supports the MS ABI. +export XEN_BUILD_EFI := $(shell $(CC) $(filter-out $(CFLAGS-y) .%.d,$(CFLAGS)) -c efi/check.c -o efi/check.o 2>/dev/null && echo y) +# Check if the linker supports PE. +XEN_BUILD_PE := $(if $(XEN_BUILD_EFI),$(shell $(LD) -mi386pep --subsystem=10 -o efi/check.efi efi/check.o 2>/dev/null && echo y)) +CFLAGS-$(XEN_BUILD_EFI) += -DXEN_BUILD_EFI $(TARGET).efi: VIRT_BASE = 0x$(shell $(NM) efi/relocs-dummy.o | sed -n 's, A VIRT_START$$,,p') $(TARGET).efi: ALT_BASE = 0x$(shell $(NM) efi/relocs-dummy.o | sed -n 's, A ALT_START$$,,p') diff --git a/xen/arch/x86/efi/Makefile b/xen/arch/x86/efi/Makefile index 918383b325..3816de2738 100644 --- a/xen/arch/x86/efi/Makefile +++ b/xen/arch/x86/efi/Makefile @@ -6,6 +6,6 @@ CFLAGS += -fshort-wchar boot.init.o: buildid.o obj-y := stub.o -obj-$(XEN_BUILD_PE) := boot.init.o compat.o relocs-dummy.o runtime.o -extra-$(XEN_BUILD_PE) += buildid.o -nocov-$(XEN_BUILD_PE) += stub.o +obj-$(XEN_BUILD_EFI) := boot.init.o compat.o relocs-dummy.o runtime.o +extra-$(XEN_BUILD_EFI) += buildid.o +nocov-$(XEN_BUILD_EFI) += stub.o diff --git a/xen/arch/x86/xen.lds.S b/xen/arch/x86/xen.lds.S index 4a59467986..6e9bda5109 100644 --- a/xen/arch/x86/xen.lds.S +++ b/xen/arch/x86/xen.lds.S @@ -304,7 +304,7 @@ SECTIONS } :text #endif -#ifndef XEN_BUILD_PE +#ifndef XEN_BUILD_EFI efi = .; #endif -- 2.18.0 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel ^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH v3 2/2] x86/efi: split compiler vs linker support 2018-07-18 15:29 ` Roger Pau Monné @ 2018-07-25 12:52 ` Daniel Kiper 0 siblings, 0 replies; 11+ messages in thread From: Daniel Kiper @ 2018-07-25 12:52 UTC (permalink / raw) To: Roger Pau Monné; +Cc: Andrew Cooper, Jan Beulich, xen-devel On Wed, Jul 18, 2018 at 05:29:27PM +0200, Roger Pau Monné wrote: > On Wed, Jul 18, 2018 at 08:41:30AM -0600, Jan Beulich wrote: > > >>> On 18.07.18 at 12:27, <roger.pau@citrix.com> wrote: > > > So that an ELF binary with support for EFI services will be built when > > > the compiler supports the MS ABI, regardless of the linker support for > > > PE. > > > > > > Signed-off-by: Roger Pau Monné <roger.pau@citrix.com> > > > Reviewed-by: Jan Beulich <jbeulich@suse.com> > > > --- > > > Cc: Jan Beulich <jbeulich@suse.com> > > > Cc: Andrew Cooper <andrew.cooper3@citrix.com> > > > Cc: Daniel Kiper <daniel.kiper@oracle.com> > > > --- > > > Changes since v1: > > > - New in this version. > > > --- > > > xen/arch/x86/Makefile | 7 ++++--- > > > xen/arch/x86/efi/Makefile | 6 +++--- > > > xen/arch/x86/xen.lds.S | 2 +- > > > 3 files changed, 8 insertions(+), 7 deletions(-) > > > > > > diff --git a/xen/arch/x86/Makefile b/xen/arch/x86/Makefile > > > index 172685fb41..1301f52c3b 100644 > > > --- a/xen/arch/x86/Makefile > > > +++ b/xen/arch/x86/Makefile > > > @@ -163,9 +163,10 @@ EFI_LDFLAGS += --minor-image-version=$(XEN_SUBVERSION) > > > EFI_LDFLAGS += --major-os-version=2 --minor-os-version=0 > > > EFI_LDFLAGS += --major-subsystem-version=2 --minor-subsystem-version=0 > > > > > > -# Check if the build system supports PE. > > > -XEN_BUILD_PE := $(shell $(CC) $(filter-out $(CFLAGS-y) .%.d,$(CFLAGS)) -c efi/check.c -o efi/check.o 2>/dev/null && echo y) > > > -export XEN_BUILD_PE := $(if $(XEN_BUILD_PE),$(shell $(LD) -mi386pep --subsystem=10 -o efi/check.efi efi/check.o 2>/dev/null && echo y)) > > > +# Check if the compiler supports the MS ABI. > > > +export XEN_BUILD_EFI := $(shell $(CC) $(filter-out $(CFLAGS-y) .%.d,$(CFLAGS)) -c efi/check.c -o efi/check.o 2>/dev/null && echo y) > > > +# Check if the linker supports PE. > > > +XEN_BUILD_PE := $(if $(XEN_BUILD_EFI),$(shell $(LD) -mi386pep --subsystem=10 -o efi/check.efi efi/check.o 2>/dev/null && echo y)) > > > CFLAGS-$(XEN_BUILD_PE) += -DXEN_BUILD_PE > > > > Rebasing (over patch 1) mistake? I think this wants to be > > > > CFLAGS-$(XEN_BUILD_EFI) += -DXEN_BUILD_EFI > > Indeed, sorry. I've pushed a new branch: > > git://xenbits.xen.org/people/royger/xen.git efi.v4 > > And updated the patch appended below. > > ---8<--- > From 820fc00d1f1c7c691794f88f5b818fab81ac7127 Mon Sep 17 00:00:00 2001 > From: Roger Pau Monne <roger.pau@citrix.com> > Date: Wed, 18 Jul 2018 11:59:03 +0200 > Subject: [PATCH v4 2/2] x86/efi: split compiler vs linker support > MIME-Version: 1.0 > Content-Type: text/plain; charset=UTF-8 > Content-Transfer-Encoding: 8bit > > So that an ELF binary with support for EFI services will be built when > the compiler supports the MS ABI, regardless of the linker support for > PE. > > Signed-off-by: Roger Pau Monné <roger.pau@citrix.com> > Reviewed-by: Jan Beulich <jbeulich@suse.com> Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com> Tested-by: Daniel Kiper <daniel.kiper@oracle.com> Daniel _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel ^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2018-07-25 14:54 UTC | newest] Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2018-07-18 10:27 [PATCH v3 0/2] EFI build improvements Roger Pau Monne 2018-07-18 10:27 ` [PATCH v3 1/2] x86/efi: move the logic to detect PE build support Roger Pau Monne 2018-07-25 12:48 ` Daniel Kiper 2018-07-25 13:38 ` Roger Pau Monné 2018-07-25 14:08 ` Daniel Kiper 2018-07-25 14:38 ` Jan Beulich 2018-07-25 14:53 ` Daniel Kiper 2018-07-18 10:27 ` [PATCH v3 2/2] x86/efi: split compiler vs linker support Roger Pau Monne 2018-07-18 14:41 ` Jan Beulich 2018-07-18 15:29 ` Roger Pau Monné 2018-07-25 12:52 ` Daniel Kiper
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.