Message ID | 20160224185245.GA18149@char.us.oracle.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On 24/02/16 18:52, Konrad Rzeszutek Wilk wrote: >>> diff --git a/xen/arch/arm/xen.lds.S b/xen/arch/arm/xen.lds.S >>> index f501a2f..5cf180f 100644 >>> --- a/xen/arch/arm/xen.lds.S >>> +++ b/xen/arch/arm/xen.lds.S >>> @@ -22,6 +22,9 @@ OUTPUT_ARCH(FORMAT) >>> PHDRS >>> { >>> text PT_LOAD /* XXX should be AT ( XEN_PHYS_START ) */ ; >>> +#if defined(BUILD_ID) >>> + note PT_NOTE ; >>> +#endif >>> } >>> SECTIONS >>> { >>> @@ -53,6 +56,16 @@ SECTIONS >>> _erodata = .; /* End of read-only data */ >>> } :text >>> >>> +#if defined(BUILD_ID) >>> + .note : { >>> + __note_gnu_build_id_start = .; >>> + *(.note.gnu.build-id) >>> + __note_gnu_build_id_end = .; >>> + *(.note) >>> + *(.note.*) >>> + } :text >>> +#endif >> This data really should be contained inside rodata. > I get (I replace :text with :rodata) and got: > ld: section `.note' assigned to non-existent phdr `rodata' > > Which makes sense as there are only two PHDRS. Where you suggesting that > the .note should be part of the .rodata section? Jan wanted this to be > in its own section (.note). > > Are you suggesting to add another one PHDR? (If so, then mkelf32 has to be modified, > and for EFI I think it will have to have some #ifdef machinery to make it work). I was just suggesting moving _erodata down a little to cover .note Whatever happens patching-wise, this build ID is constant and will want to remain so. ~Andrew
On Wed, Feb 24, 2016 at 07:13:11PM +0000, Andrew Cooper wrote: > On 24/02/16 18:52, Konrad Rzeszutek Wilk wrote: > >>> diff --git a/xen/arch/arm/xen.lds.S b/xen/arch/arm/xen.lds.S > >>> index f501a2f..5cf180f 100644 > >>> --- a/xen/arch/arm/xen.lds.S > >>> +++ b/xen/arch/arm/xen.lds.S > >>> @@ -22,6 +22,9 @@ OUTPUT_ARCH(FORMAT) > >>> PHDRS > >>> { > >>> text PT_LOAD /* XXX should be AT ( XEN_PHYS_START ) */ ; > >>> +#if defined(BUILD_ID) > >>> + note PT_NOTE ; > >>> +#endif > >>> } > >>> SECTIONS > >>> { > >>> @@ -53,6 +56,16 @@ SECTIONS > >>> _erodata = .; /* End of read-only data */ > >>> } :text > >>> > >>> +#if defined(BUILD_ID) > >>> + .note : { > >>> + __note_gnu_build_id_start = .; > >>> + *(.note.gnu.build-id) > >>> + __note_gnu_build_id_end = .; > >>> + *(.note) > >>> + *(.note.*) > >>> + } :text > >>> +#endif > >> This data really should be contained inside rodata. > > I get (I replace :text with :rodata) and got: > > ld: section `.note' assigned to non-existent phdr `rodata' > > > > Which makes sense as there are only two PHDRS. Where you suggesting that > > the .note should be part of the .rodata section? Jan wanted this to be > > in its own section (.note). > > > > Are you suggesting to add another one PHDR? (If so, then mkelf32 has to be modified, > > and for EFI I think it will have to have some #ifdef machinery to make it work). > > I was just suggesting moving _erodata down a little to cover .note Which oddly enough is only in ARM builds. Done! > > Whatever happens patching-wise, this build ID is constant and will want > to remain so. > > ~Andrew
diff --git a/xen/arch/x86/xen.lds.S b/xen/arch/x86/xen.lds.S index 9fde1db..ee16d22 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) && !defined(EFI) + note PT_NOTE ; +#endif } SECTIONS { @@ -65,8 +68,28 @@ SECTIONS *(.rodata) *(.rodata.*) +#if defined(BUILD_ID) && defined(EFI) + __note_gnu_build_id_start = .; + *(.note.gnu.build-id) + __note_gnu_build_id_end = .; +#endif } :text +#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 : { + __note_gnu_build_id_start = .; + *(.note.gnu.build-id) + __note_gnu_build_id_end = .; + *(.note) + *(.note.*) + } :note :text +#endif + . = ALIGN(SMP_CACHE_BYTES); .data.read_mostly : { /* Exception table */