Skip to contentSkip to conversation

build-id adjustments

PATCH In review Jan Beulich 3 participants 9 messages Aug 12, 2016 – Aug 22, 2016

lore
Share & tools
lore
#1 lore raw

PATCH 1/2 build-id: fix minor quirks

The initial size check in xen_build_id_check() came too late (after the first access to the structure), but was mostly redundant with checks done in all callers; convert it to a properly placed ASSERT(). The "mostly" part being addressed too: xen_build_init() was off by one.

And then there was a stray semicolon.

xen/common/version.c +5 -5
@@ -1,6 +1,7 @@
 #include <xen/compile.h>
 #include <xen/init.h>
 #include <xen/errno.h>
+#include <xen/lib.h>
 #include <xen/string.h>
 #include <xen/types.h>
 #include <xen/elf.h>
@@ -90,12 +91,11 @@ int xen_build_id_check(const Elf_Note *n
                        const void **p, unsigned int *len)
 {
     /* Check if we really have a build-id. */
+    ASSERT(n_sz > sizeof(*n));
+
     if ( NT_GNU_BUILD_ID != n->type )
         return -ENODATA;
 
-    if ( n_sz <= sizeof(*n) )
-        return -EINVAL;
-
     if ( n->namesz + n->descsz < n->namesz )
         return -EINVAL;
 
@@ -127,8 +127,8 @@ static int __init xen_build_init(void)
         return -ENODATA;
 
     /* Check for full Note header. */
-    if ( &n[1] > __note_gnu_build_id_end )
-        return -ENODATA;;
+    if ( &n[1] >= __note_gnu_build_id_end )
+        return -ENODATA;
 
     sz = (void *)__note_gnu_build_id_end - (void *)n;
 

build-id: fix minor quirks

The initial size check in xen_build_id_check() came too late (after the first access to the structure), but was mostly redundant with checks done in all callers; convert it to a properly placed ASSERT(). The "mostly" part being addressed too: xen_build_init() was off by one.

And then there was a stray semicolon.

xen/common/version.c +5 -5
@@ -1,6 +1,7 @@
 #include <xen/compile.h>
 #include <xen/init.h>
 #include <xen/errno.h>
+#include <xen/lib.h>
 #include <xen/string.h>
 #include <xen/types.h>
 #include <xen/elf.h>
@@ -90,12 +91,11 @@ int xen_build_id_check(const Elf_Note *n
                        const void **p, unsigned int *len)
 {
     /* Check if we really have a build-id. */
+    ASSERT(n_sz > sizeof(*n));
+
     if ( NT_GNU_BUILD_ID != n->type )
         return -ENODATA;
 
-    if ( n_sz <= sizeof(*n) )
-        return -EINVAL;
-
     if ( n->namesz + n->descsz < n->namesz )
         return -EINVAL;
 
@@ -127,8 +127,8 @@ static int __init xen_build_init(void)
         return -ENODATA;
 
     /* Check for full Note header. */
-    if ( &n[1] > __note_gnu_build_id_end )
-        return -ENODATA;;
+    if ( &n[1] >= __note_gnu_build_id_end )
+        return -ENODATA;
 
     sz = (void *)__note_gnu_build_id_end - (void *)n;
 

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

Reviewed-by on v1 1/2
#2 lore raw

Re: [PATCH 1/2] build-id: fix minor quirks

Quoted 8 lines · Jan Beulich

The initial size check in xen_build_id_check() came too late (after the first access to the structure), but was mostly redundant with checks done in all callers; convert it to a properly placed ASSERT(). The "mostly" part being addressed too: xen_build_init() was off by one.

And then there was a stray semicolon.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#3 lore raw

PATCH 2/2 x86/EFI: use less crude way of generating the build ID

In reply to Jan Beulich

Recent enough binutils support --build-id also for COFF/PE output, and hence we should use that in favor of the original hack when possible.

This gets complicated by the linker requiring at least one COFF object file to attach the .buildid section to. Hence the patch introduces a buildid.ihex (in order to avoid introducing binary files into the repo) which then gets converted to a binary minimal COFF object (no sections, no symbols).

Also (to avoid both code fragment going out of sync) remove an unneeded ALIGN() from xen.lds.S: Adding an equivalent of it to the .buildid section would cause the _erodata symbol to become associated with the wrong section again (see commit 0970299de5 ["x86/EFI + Live Patch:
avoid symbol address truncation"]). And it's pointless because the alignment already gets properly set by the input section(s).

---
Question of course is whether consumers of the build ID other than Xen itself need to be taught how to find it in an EFI binary.

xen/arch/x86/Makefile +12 -6
@@ -158,24 +158,30 @@ $(TARGET).efi: VIRT_BASE = 0x$(shell $(N
 $(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),:)
+
 ifneq ($(build_id_linker),)
-$(TARGET).efi: note.o
+ifeq ($(call ld-ver-build-id,$(LD) $(EFI_LDFLAGS)),y)
+CFLAGS += -DBUILD_ID_EFI
+EFI_LDFLAGS += $(build_id_linker)
+note_file := efi/buildid.o
+else
 note_file := note.o
+endif
 else
 note_file :=
 endif
 
-$(TARGET).efi: prelink-efi.o efi.lds efi/relocs-dummy.o $(BASEDIR)/common/symbols-dummy.o efi/mkreloc
+$(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 -o $(@D)/.$(@F).$(base).0 &&) :
+	                $(BASEDIR)/common/symbols-dummy.o $(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 -o $(@D)/.$(@F).$(base).1 &&) :
+	                $(@D)/.$(@F).0r.o $(@D)/.$(@F).0s.o $(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
@@ -185,8 +191,8 @@ $(TARGET).efi: prelink-efi.o efi.lds efi
 	if $(guard) false; then rm -f $@; echo 'EFI support disabled'; fi
 	rm -f $(@D)/.$(@F).[0-9]*
 
-efi/boot.init.o efi/runtime.o efi/compat.o: $(BASEDIR)/arch/x86/efi/built_in.o
-efi/boot.init.o efi/runtime.o efi/compat.o: ;
+efi/boot.init.o efi/runtime.o efi/compat.o efi/buildid.o: $(BASEDIR)/arch/x86/efi/built_in.o
+efi/boot.init.o efi/runtime.o efi/compat.o efi/buildid.o: ;
 
 asm-offsets.s: $(TARGET_SUBARCH)/asm-offsets.c
 	$(CC) $(filter-out -flto,$(CFLAGS)) -S -o $@ $<
xen/arch/x86/efi/Makefile +4 -1
@@ -9,6 +9,9 @@ efi := $(if $(efi),$(shell $(CC) $(filte
 efi := $(if $(efi),$(shell $(LD) -mi386pep --subsystem=10 -o check.efi check.o 2>disabled && echo y))
 efi := $(if $(efi),$(shell rm disabled)y,$(shell $(call create,boot.init.o); $(call create,runtime.o)))
 
-extra-$(efi) += boot.init.o relocs-dummy.o runtime.o compat.o
+extra-$(efi) += boot.init.o relocs-dummy.o runtime.o compat.o buildid.o
+
+%.o: %.ihex
+	$(OBJCOPY) -I ihex -O binary $< $@
 
 stub.o: $(extra-y)
xen/arch/x86/efi/buildid.ihex new file +3 -0
@@ -0,0 +1,3 @@
+:10000000648600004D8DAD57140000000000000014
+:0400100000000000EC
+:00000001FF
xen/arch/x86/efi/mkreloc.c +1 -0
@@ -342,6 +342,7 @@ int main(int argc, char *argv[])
          */
         if ( memcmp(sec1[i].name, ".initcal", sizeof(sec1[i].name)) == 0 ||
              memcmp(sec1[i].name, ".init.se", sizeof(sec1[i].name)) == 0 ||
+             memcmp(sec1[i].name, ".buildid", sizeof(sec1[i].name)) == 0 ||
              memcmp(sec1[i].name, ".lockpro", sizeof(sec1[i].name)) == 0 )
             continue;
 
xen/arch/x86/xen.lds.S +10 -3
@@ -91,7 +91,7 @@ SECTIONS
        *(.rodata)
        *(.rodata.*)
 
-#if defined(BUILD_ID) && defined(EFI)
+#if defined(BUILD_ID) && defined(EFI) && !defined(BUILD_ID_EFI)
 /*
  * No mechanism to put an PT_NOTE in the EFI file - so put
  * it in .rodata section. (notes.o supplies us with .note.gnu.build-id).
@@ -120,19 +120,26 @@ SECTIONS
 #endif
   } :text
 
-#if defined(BUILD_ID) && !defined(EFI)
+#if defined(BUILD_ID)
+#if !defined(EFI)
 /*
  * What a strange section name. The reason is that on ELF builds this section
  * is extracted to notes.o (which then is ingested in the EFI file). But the
  * compiler may want to inject other things in the .note which we don't care
  * about - hence this unique name.
  */
-  . = ALIGN(4);
   .note.gnu.build-id : {
        __note_gnu_build_id_start = .;
        *(.note.gnu.build-id)
        __note_gnu_build_id_end = .;
   } :note :text
+#elif defined(BUILD_ID_EFI)
+  .buildid : {
+       __note_gnu_build_id_start = .;
+       *(.buildid)
+       __note_gnu_build_id_end = .;
+  } :text
+#endif
 #endif
   _erodata = .;
 
xen/common/version.c +56 -1

79 lines not on this page · raw message

x86/EFI: use less crude way of generating the build ID

Recent enough binutils support --build-id also for COFF/PE output, and hence we should use that in favor of the original hack when possible.

This gets complicated by the linker requiring at least one COFF object file to attach the .buildid section to. Hence the patch introduces a buildid.ihex (in order to avoid introducing binary files into the repo) which then gets converted to a binary minimal COFF object (no sections, no symbols).

Also (to avoid both code fragment going out of sync) remove an unneeded ALIGN() from xen.lds.S: Adding an equivalent of it to the .buildid section would cause the _erodata symbol to become associated with the wrong section again (see commit 0970299de5 ["x86/EFI + Live Patch:
avoid symbol address truncation"]). And it's pointless because the alignment already gets properly set by the input section(s).

---
Question of course is whether consumers of the build ID other than Xen itself need to be taught how to find it in an EFI binary.

xen/arch/x86/Makefile +12 -6
@@ -158,24 +158,30 @@ $(TARGET).efi: VIRT_BASE = 0x$(shell $(N
 $(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),:)
+
 ifneq ($(build_id_linker),)
-$(TARGET).efi: note.o
+ifeq ($(call ld-ver-build-id,$(LD) $(EFI_LDFLAGS)),y)
+CFLAGS += -DBUILD_ID_EFI
+EFI_LDFLAGS += $(build_id_linker)
+note_file := efi/buildid.o
+else
 note_file := note.o
+endif
 else
 note_file :=
 endif
 
-$(TARGET).efi: prelink-efi.o efi.lds efi/relocs-dummy.o $(BASEDIR)/common/symbols-dummy.o efi/mkreloc
+$(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 -o $(@D)/.$(@F).$(base).0 &&) :
+	                $(BASEDIR)/common/symbols-dummy.o $(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 -o $(@D)/.$(@F).$(base).1 &&) :
+	                $(@D)/.$(@F).0r.o $(@D)/.$(@F).0s.o $(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
@@ -185,8 +191,8 @@ $(TARGET).efi: prelink-efi.o efi.lds efi
 	if $(guard) false; then rm -f $@; echo 'EFI support disabled'; fi
 	rm -f $(@D)/.$(@F).[0-9]*
 
-efi/boot.init.o efi/runtime.o efi/compat.o: $(BASEDIR)/arch/x86/efi/built_in.o
-efi/boot.init.o efi/runtime.o efi/compat.o: ;
+efi/boot.init.o efi/runtime.o efi/compat.o efi/buildid.o: $(BASEDIR)/arch/x86/efi/built_in.o
+efi/boot.init.o efi/runtime.o efi/compat.o efi/buildid.o: ;
 
 asm-offsets.s: $(TARGET_SUBARCH)/asm-offsets.c
 	$(CC) $(filter-out -flto,$(CFLAGS)) -S -o $@ $<
xen/arch/x86/efi/Makefile +4 -1
@@ -9,6 +9,9 @@ efi := $(if $(efi),$(shell $(CC) $(filte
 efi := $(if $(efi),$(shell $(LD) -mi386pep --subsystem=10 -o check.efi check.o 2>disabled && echo y))
 efi := $(if $(efi),$(shell rm disabled)y,$(shell $(call create,boot.init.o); $(call create,runtime.o)))
 
-extra-$(efi) += boot.init.o relocs-dummy.o runtime.o compat.o
+extra-$(efi) += boot.init.o relocs-dummy.o runtime.o compat.o buildid.o
+
+%.o: %.ihex
+	$(OBJCOPY) -I ihex -O binary $< $@
 
 stub.o: $(extra-y)
xen/arch/x86/efi/buildid.ihex new file +3 -0
@@ -0,0 +1,3 @@
+:10000000648600004D8DAD57140000000000000014
+:0400100000000000EC
+:00000001FF
xen/arch/x86/efi/mkreloc.c +1 -0
@@ -342,6 +342,7 @@ int main(int argc, char *argv[])
          */
         if ( memcmp(sec1[i].name, ".initcal", sizeof(sec1[i].name)) == 0 ||
              memcmp(sec1[i].name, ".init.se", sizeof(sec1[i].name)) == 0 ||
+             memcmp(sec1[i].name, ".buildid", sizeof(sec1[i].name)) == 0 ||
              memcmp(sec1[i].name, ".lockpro", sizeof(sec1[i].name)) == 0 )
             continue;
 
xen/arch/x86/xen.lds.S +10 -3
@@ -91,7 +91,7 @@ SECTIONS
        *(.rodata)
        *(.rodata.*)
 
-#if defined(BUILD_ID) && defined(EFI)
+#if defined(BUILD_ID) && defined(EFI) && !defined(BUILD_ID_EFI)
 /*
  * No mechanism to put an PT_NOTE in the EFI file - so put
  * it in .rodata section. (notes.o supplies us with .note.gnu.build-id).
@@ -120,19 +120,26 @@ SECTIONS
 #endif
   } :text
 
-#if defined(BUILD_ID) && !defined(EFI)
+#if defined(BUILD_ID)
+#if !defined(EFI)
 /*
  * What a strange section name. The reason is that on ELF builds this section
  * is extracted to notes.o (which then is ingested in the EFI file). But the
  * compiler may want to inject other things in the .note which we don't care
  * about - hence this unique name.
  */
-  . = ALIGN(4);
   .note.gnu.build-id : {
        __note_gnu_build_id_start = .;
        *(.note.gnu.build-id)
        __note_gnu_build_id_end = .;
   } :note :text
+#elif defined(BUILD_ID_EFI)
+  .buildid : {
+       __note_gnu_build_id_start = .;
+       *(.buildid)
+       __note_gnu_build_id_end = .;
+  } :text
+#endif
 #endif
   _erodata = .;
 
xen/common/version.c +56 -1

79 lines not on this page · raw message

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#4 lore raw

Re: [PATCH 2/2] x86/EFI: use less crude way of generating the build ID

Quoted 51 lines
xen/arch/x86/Makefile +12 -6
@@ -158,24 +158,30 @@ $(TARGET).efi: VIRT_BASE = 0x$(shell $(N
 $(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),:)
+
 ifneq ($(build_id_linker),)
-$(TARGET).efi: note.o
+ifeq ($(call ld-ver-build-id,$(LD) $(EFI_LDFLAGS)),y)
+CFLAGS += -DBUILD_ID_EFI
+EFI_LDFLAGS += $(build_id_linker)
+note_file := efi/buildid.o
+else
 note_file := note.o
+endif
 else
 note_file :=
 endif
 
-$(TARGET).efi: prelink-efi.o efi.lds efi/relocs-dummy.o $(BASEDIR)/common/symbols-dummy.o efi/mkreloc
+$(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 -o $(@D)/.$(@F).$(base).0 &&) :
+	                $(BASEDIR)/common/symbols-dummy.o $(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 -o $(@D)/.$(@F).$(base).1 &&) :
+	                $(@D)/.$(@F).0r.o $(@D)/.$(@F).0s.o $(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
@@ -185,8 +191,8 @@ $(TARGET).efi: prelink-efi.o efi.lds efi
 	if $(guard) false; then rm -f $@; echo 'EFI support disabled'; fi
 	rm -f $(@D)/.$(@F).[0-9]*
 
-efi/boot.init.o efi/runtime.o efi/compat.o: $(BASEDIR)/arch/x86/efi/built_in.o
-efi/boot.init.o efi/runtime.o efi/compat.o: ;
+efi/boot.init.o efi/runtime.o efi/compat.o efi/buildid.o: $(BASEDIR)/arch/x86/efi/built_in.o
+efi/boot.init.o efi/runtime.o efi/compat.o efi/buildid.o: ;
 
 asm-offsets.s: $(TARGET_SUBARCH)/asm-offsets.c
 	$(CC) $(filter-out -flto,$(CFLAGS)) -S -o $@ $<

xen/arch/x86/efi/Makefile efi := $(if $(efi),$(shell $(CC) $(filte · line 16

Quoted 9 lines
xen/arch/x86/efi/Makefile +4 -1
@@ -9,6 +9,9 @@ efi := $(if $(efi),$(shell $(CC) $(filte
 efi := $(if $(efi),$(shell $(LD) -mi386pep --subsystem=10 -o check.efi check.o 2>disabled && echo y))
 efi := $(if $(efi),$(shell rm disabled)y,$(shell $(call create,boot.init.o); $(call create,runtime.o)))
 
-extra-$(efi) += boot.init.o relocs-dummy.o runtime.o compat.o
+extra-$(efi) += boot.init.o relocs-dummy.o runtime.o compat.o buildid.o
+
+%.o: %.ihex
+	$(OBJCOPY) -I ihex -O binary $< $@
 

Under Ubuntu 14.04.4 this fails compilation:

make[4]: *** No rule to make target buildid.o', needed by stub.o'. Stop.

The properties of Ubuntu 14.04.4 are:

konrad@ubuntu:~/xen$ gcc --version
gcc (Ubuntu 4.8.4-2ubuntu1~14.04.3) 4.8.4
konrad@ubuntu:~/xen/xen$ ld --version
GNU ld (GNU Binutils for Ubuntu) 2.24
konrad@ubuntu:~/xen/xen$ ld -mi386pep
ld: no input files
konrad@ubuntu:~/xen/xen$ cat /etc/debian_version 
jessie/sid

Hadn't dug in this.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#5 lore raw

Re: [PATCH 2/2] x86/EFI: use less crude way of generating the build ID

Quoted 17 lines

xen/arch/x86/efi/Makefile efi := $(if $(efi),$(shell $(CC) $(filte · line 15

Quoted 12 lines
Quoted 1 line · On 15.08.16 at 01:42, <[email protected]> wrote:
xen/arch/x86/efi/Makefile +4 -1
@@ -9,6 +9,9 @@ efi := $(if $(efi),$(shell $(CC) $(filte
 efi := $(if $(efi),$(shell $(LD) -mi386pep --subsystem=10 -o check.efi check.o 2>disabled && echo y))
 efi := $(if $(efi),$(shell rm disabled)y,$(shell $(call create,boot.init.o); $(call create,runtime.o)))
 
-extra-$(efi) += boot.init.o relocs-dummy.o runtime.o compat.o
+extra-$(efi) += boot.init.o relocs-dummy.o runtime.o compat.o buildid.o
+
+%.o: %.ihex
+	$(OBJCOPY) -I ihex -O binary $< $@

Under Ubuntu 14.04.4 this fails compilation:

Quoted 1 line

make[4]: *** No rule to make target buildid.o', needed by stub.o'.

That's extremely odd, namely considering that the rule is right there in the quoted text above. Could you double check xen/arch/x86/efi/buildid.ihex is actually there?

Quoted 10 lines

The properties of Ubuntu 14.04.4 are:

konrad@ubuntu:~/xen$ gcc --version
gcc (Ubuntu 4.8.4-2ubuntu1~14.04.3) 4.8.4
konrad@ubuntu:~/xen/xen$ ld --version
GNU ld (GNU Binutils for Ubuntu) 2.24
konrad@ubuntu:~/xen/xen$ ld -mi386pep
ld: no input files
konrad@ubuntu:~/xen/xen$ cat /etc/debian_version 
jessie/sid

For the error above the version of make is actually the most relevant one (albeit for this trivial a rule I can't really how the make version could matter). Since you've chopped off other make output - does the error indeed occur in xen/arch/x86/efi/ (and not in xen/arch/x86/)? I agree this should be the case, since in the other directory the printed name would have to be efi/buildid.o - I'm just trying make sure impossible things really are impossible.

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#6 lore raw

Re: [PATCH 2/2] x86/EFI: use less crude way of generating the build ID

Quoted 17 lines · Jan Beulich
Quoted 17 lines

xen/arch/x86/efi/Makefile efi := $(if $(efi),$(shell $(CC) $(filte · line 15

Quoted 12 lines
Quoted 1 line · On 15.08.16 at 01:42, <[email protected]> wrote:
xen/arch/x86/efi/Makefile +4 -1
@@ -9,6 +9,9 @@ efi := $(if $(efi),$(shell $(CC) $(filte
 efi := $(if $(efi),$(shell $(LD) -mi386pep --subsystem=10 -o check.efi check.o 2>disabled && echo y))
 efi := $(if $(efi),$(shell rm disabled)y,$(shell $(call create,boot.init.o); $(call create,runtime.o)))
 
-extra-$(efi) += boot.init.o relocs-dummy.o runtime.o compat.o
+extra-$(efi) += boot.init.o relocs-dummy.o runtime.o compat.o buildid.o
+
+%.o: %.ihex
+	$(OBJCOPY) -I ihex -O binary $< $@

Under Ubuntu 14.04.4 this fails compilation:

Quoted 5 lines
Quoted 1 line

make[4]: *** No rule to make target buildid.o', needed by stub.o'.

That's extremely odd, namely considering that the rule is right there in the quoted text above. Could you double check xen/arch/x86/efi/buildid.ihex is actually there?

<sigh>
No it is not. I had issues with your email (git am -s) so I did it by hand (patch -p2) and of course forgot to include the new file. And later on built it on another OS after pulling from a git tree which missed this file.

Sorry about the false report!

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#7 lore raw

Re: [PATCH 2/2] x86/EFI: use less crude way of generating the build ID

Quoted 24 lines · Konrad Rzeszutek Wilk
Quoted 17 lines · Jan Beulich
Quoted 17 lines

xen/arch/x86/efi/Makefile efi := $(if $(efi),$(shell $(CC) $(filte · line 15

Quoted 12 lines
Quoted 1 line · On 15.08.16 at 01:42, <[email protected]> wrote:
xen/arch/x86/efi/Makefile +4 -1
@@ -9,6 +9,9 @@ efi := $(if $(efi),$(shell $(CC) $(filte
 efi := $(if $(efi),$(shell $(LD) -mi386pep --subsystem=10 -o check.efi check.o 2>disabled && echo y))
 efi := $(if $(efi),$(shell rm disabled)y,$(shell $(call create,boot.init.o); $(call create,runtime.o)))
 
-extra-$(efi) += boot.init.o relocs-dummy.o runtime.o compat.o
+extra-$(efi) += boot.init.o relocs-dummy.o runtime.o compat.o buildid.o
+
+%.o: %.ihex
+	$(OBJCOPY) -I ihex -O binary $< $@

Under Ubuntu 14.04.4 this fails compilation:

Quoted 5 lines
Quoted 1 line

make[4]: *** No rule to make target buildid.o', needed by stub.o'.

That's extremely odd, namely considering that the rule is right there in the quoted text above. Could you double check xen/arch/x86/efi/buildid.ihex is actually there?

Quoted 6 lines

<sigh>
No it is not. I had issues with your email (git am -s) so I did it by hand (patch -p2) and of course forgot to include the new file. And later on built it on another OS after pulling from a git tree which missed this file.

Sorry about the false report!

About the review:

Quoted 5 lines

x86/EFI: use less crude way of generating the build ID

Recent enough binutils support --build-id also for COFF/PE output, and hence we should use that in favor of the original hack when possible.

Could you mention the exact version that gained this?

Quoted 3 lines

This gets complicated by the linker requiring at least one COFF object file to attach the .buildid section to. Hence the patch introduces a

Is that requirement spelled out in the manpage of the linker?

Quoted 3 lines

buildid.ihex (in order to avoid introducing binary files into the repo) which then gets converted to a binary minimal COFF object (no sections, no symbols).

Otherwise:

Thanks!

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#8 lore raw

Re: [PATCH 2/2] x86/EFI: use less crude way of generating the build ID

Quoted 39 lines
Quoted 1 line
Quoted 1 line · On 19.08.16 at 18:14, <[email protected]> wrote:
Quoted 6 lines · Konrad Rzeszutek Wilk
Quoted 5 lines · Jan Beulich
Quoted 5 lines

xen/arch/x86/efi/Makefile efi := $(if $(efi),$(shell $(CC) $(filte · line 9

Quoted 5 lines
Quoted 1 line · On 15.08.16 at 01:42, <[email protected]> wrote:
xen/arch/x86/efi/Makefile +0 -0
@@ -9,6 +9,9 @@ efi := $(if $(efi),$(shell $(CC) $(filte
 efi := $(if $(efi),$(shell $(LD) -mi386pep --subsystem=10 -o check.efi 

check.o 2>disabled && echo y))

Quoted 1 line
Quoted 1 line
Quoted 1 line

xen/arch/x86/efi/Makefile efi := $(if $(efi),$(shell $(CC) $(filte · line 10

Quoted 1 line
xen/arch/x86/efi/Makefile +0 -0
 efi := $(if $(efi),$(shell rm disabled)y,$(shell $(call 

create,boot.init.o); $(call create,runtime.o)))

Quoted 13 lines
Quoted 13 lines
Quoted 12 lines

xen/arch/x86/efi/Makefile efi := $(if $(efi),$(shell $(CC) $(filte · line 15

Quoted 6 lines
xen/arch/x86/efi/Makefile +4 -1
-extra-$(efi) += boot.init.o relocs-dummy.o runtime.o compat.o
+extra-$(efi) += boot.init.o relocs-dummy.o runtime.o compat.o buildid.o
+
+%.o: %.ihex
+	$(OBJCOPY) -I ihex -O binary $< $@

Under Ubuntu 14.04.4 this fails compilation:

make[4]: *** No rule to make target buildid.o', needed by stub.o'.

Quoted 8 lines
Quoted 3 lines

That's extremely odd, namely considering that the rule is right there in the quoted text above. Could you double check xen/arch/x86/efi/buildid.ihex is actually there?

<sigh>
No it is not. I had issues with your email (git am -s) so I did it by hand (patch -p2) and of course forgot to include the new file. And later on built it on another OS after pulling from a git tree which missed this

file.

Quoted 2 lines

Sorry about the false report!

About the review:

Quoted 1 line
Quoted 6 lines
Quoted 4 lines

x86/EFI: use less crude way of generating the build ID

Recent enough binutils support --build-id also for COFF/PE output, and hence we should use that in favor of the original hack when possible.

Could you mention the exact version that gained this?

Looks like that was 2.25; added.

Quoted 4 lines
Quoted 2 lines

This gets complicated by the linker requiring at least one COFF object file to attach the .buildid section to. Hence the patch introduces a

Is that requirement spelled out in the manpage of the linker?

No. Since it mysteriously failed initially, I had to dig into their sources to figure out that requirement.

Quoted 7 lines
Quoted 3 lines

buildid.ihex (in order to avoid introducing binary files into the repo) which then gets converted to a binary minimal COFF object (no sections, no symbols).

Otherwise:

Thanks.

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel