Make shim_version live in a special aligned section.

This makes it so two builds of the same .deb on different hosts won't
have wildly different file offsets.

Signed-off-by: Peter Jones <pjones@redhat.com>
This commit is contained in:
Peter Jones 2017-02-22 15:57:36 -05:00
parent 9f2c83e60e
commit 4990d3fb95
7 changed files with 54 additions and 8 deletions

View File

@ -170,7 +170,7 @@ FORMAT ?= --target efi-app-$(ARCH)
ifneq ($(OBJCOPY_GTE224),1)
$(error objcopy >= 2.24 is required)
endif
$(OBJCOPY) -j .text -j .sdata -j .data \
$(OBJCOPY) -j .text -j .sdata -j .data -j .data.ident \
-j .dynamic -j .dynsym -j .rel* \
-j .rela* -j .reloc -j .eh_frame \
-j .vendor_cert \

View File

@ -15,6 +15,16 @@ SECTIONS
_etext = .;
}
.dynamic : { *(.dynamic) }
. = ALIGN(4096);
.note.gnu.build-id : {
*(.note.gnu.build-id)
}
.data.ident : {
*(.data.ident)
}
. = ALIGN(4096);
.data :
{
_data = .;
@ -37,7 +47,6 @@ SECTIONS
. = ALIGN(16);
_bss_end = .;
}
.note.gnu.build-id : { *(.note.gnu.build-id) }
. = ALIGN(4096);
.vendor_cert :

View File

@ -15,6 +15,16 @@ SECTIONS
_etext = .;
}
.dynamic : { *(.dynamic) }
. = ALIGN(4096);
.note.gnu.build-id : {
*(.note.gnu.build-id)
}
.data.ident : {
*(.data.ident)
}
. = ALIGN(4096);
.data :
{
_data = .;
@ -37,9 +47,8 @@ SECTIONS
. = ALIGN(16);
_bss_end = .;
}
.note.gnu.build-id : { *(.note.gnu.build-id) }
. = ALIGN(4096);
. = ALIGN(4096);
.vendor_cert :
{
*(.vendor_cert)

View File

@ -19,6 +19,14 @@ SECTIONS
{
*(.reloc)
}
. = ALIGN(4096);
.note.gnu.build-id : {
*(.note.gnu.build-id)
}
.data.ident : {
*(.data.ident)
}
. = ALIGN(4096);
.data :
{
@ -38,7 +46,7 @@ SECTIONS
*(.bss)
*(COMMON)
}
.note.gnu.build-id : { *(.note.gnu.build-id) }
. = ALIGN(4096);
.vendor_cert :
{

View File

@ -27,6 +27,14 @@ SECTIONS
*(.sbss)
*(.scommon)
}
. = ALIGN(4096);
.note.gnu.build-id : {
*(.note.gnu.build-id)
}
.data.ident : {
*(.data.ident)
}
. = ALIGN(4096);
.data :
{
@ -41,7 +49,7 @@ SECTIONS
*(.bss)
*(COMMON)
}
.note.gnu.build-id : { *(.note.gnu.build-id) }
. = ALIGN(4096);
.vendor_cert :
{

View File

@ -24,6 +24,14 @@ SECTIONS
{
*(.reloc)
}
. = ALIGN(4096);
.note.gnu.build-id : {
*(.note.gnu.build-id)
}
.data.ident : {
*(.data.ident)
}
. = ALIGN(4096);
.data :
{
@ -42,7 +50,7 @@ SECTIONS
*(COMMON)
*(.rel.local)
}
.note.gnu.build-id : { *(.note.gnu.build-id) }
. = ALIGN(4096);
.vendor_cert :
{
@ -54,7 +62,11 @@ SECTIONS
.rela :
{
*(.rela.data*)
}
.rela.got : {
*(.rela.got)
}
.rela.stab : {
*(.rela.stab)
}
_edata = .;

View File

@ -1,7 +1,7 @@
#include "version.h"
CHAR8 shim_version[] =
CHAR8 shim_version[] __attribute__((section (".data.ident"))) =
"UEFI SHIM\n"
"$Version: @@VERSION@@ $\n"
"$BuildMachine: @@UNAME@@ $\n"