[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH v5 19/28] build_id: Provide ld-embedded build-ids



On Fri, Apr 08, 2016 at 09:27:00AM -0600, Jan Beulich wrote:
> >>> On 08.04.16 at 03:52, <konrad@xxxxxxxxxx> wrote:
> > On Thu, Apr 07, 2016 at 08:18:27PM -0400, Konrad Rzeszutek Wilk wrote:
> >> > 
> >> > > +      $(OBJCOPY) -I binary -O elf64-x86-64 -B i386:x86-64 \
> >> > > +              --rename-section=.data=.note.gnu.build-id -S $@.bin $@
> >> > 
> >> > Since you put the notes into .rodata anyway, why name the
> >> > section .note.*? Just name it .rodata.*, avoiding to mislead
> >> > others who also think that a section's name has much of a
> >> > meaning.
> >> 
> >> Way back last year:
> >> http://lists.xenproject.org/archives/html/xen-devel/2016-01/msg01264.html 
> >> 
> >> which is where the .note came about. I can put it all in .rodata
> >> and not have it for normal ELF builds if you would like.
> > 
> > .rodata.notes for both ELF and EFI looks to have done the trick.
> > Now it is just the matter of testing it.
> 
> Why also for ELF? In ELF, these are ordinary notes, so imo
> belong into .note or .note.*. As opposed to COFF/PE, where
> the idea of notes doesn't exist.

The xen.lds.S will only have one #ifdef:

diff --git a/xen/arch/x86/xen.lds.S b/xen/arch/x86/xen.lds.S
index 5eb825e..3b4fd15 100644
--- a/xen/arch/x86/xen.lds.S
+++ b/xen/arch/x86/xen.lds.S
@@ -31,6 +31,9 @@ OUTPUT_ARCH(i386:x86-64)
 PHDRS
 {
   text PT_LOAD ;
+#if defined(BUILD_ID)
+  note PT_NOTE ;
+#endif
 }
 SECTIONS
 {
@@ -96,8 +99,18 @@ SECTIONS
        *(.lockprofile.data)
        __lock_profile_end = .;
 #endif
-       _erodata = .;
   } :text
+#if defined(BUILD_ID)
+  .rodata.note : {
+       . = ALIGN(4);
+       __note_gnu_build_id_start = .;
+       *(.note.gnu.build-id)
+       __note_gnu_build_id_end = .;
+       *(.note)
+       *(.note.*)
+  } :note :text
+#endif
+  _erodata = .;
 
 #ifdef EFI
   . = ALIGN(MB(2));

Instead of multiple ones.

But coming back to you:

"Since you put the notes into .rodata anyway, why name the section .note"

Perhaps you mean - why name the section .note.gnu_build-id ?

So that when xen.efi is linked with this build_id.o (in v5, now called notes.o 
in v6)
it can encapsulate __note_gnu_build_id_start and __note_gnu_build_id_end around
it. I could change for EFI builds the xen.lds.S to be:

     *(.rodata.*)
+#if defined(BUILD_ID) && defined(EFI)
+/*
+ * No mechanism to put an PT_NOTE in the EFI file - so put
+ * it in .data section.
+ */
+        . = ALIGN(4);
+
+       __note_gnu_build_id_start = .;
+       *(.rodata.note.gnu.build-id)
+       __note_gnu_build_id_end = .;
+       *(.note)
+       *(.note.*)
+#endif

But then it differes from the change for !EFI (Which would be naturally
called .note.gnu.build-id).




_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel

 


Rackspace

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