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) ifneq ($(OBJCOPY_GTE224),1)
$(error objcopy >= 2.24 is required) $(error objcopy >= 2.24 is required)
endif 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 .dynamic -j .dynsym -j .rel* \
-j .rela* -j .reloc -j .eh_frame \ -j .rela* -j .reloc -j .eh_frame \
-j .vendor_cert \ -j .vendor_cert \

View File

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

View File

@ -15,6 +15,16 @@ SECTIONS
_etext = .; _etext = .;
} }
.dynamic : { *(.dynamic) } .dynamic : { *(.dynamic) }
. = ALIGN(4096);
.note.gnu.build-id : {
*(.note.gnu.build-id)
}
.data.ident : {
*(.data.ident)
}
. = ALIGN(4096);
.data : .data :
{ {
_data = .; _data = .;
@ -37,7 +47,6 @@ SECTIONS
. = ALIGN(16); . = ALIGN(16);
_bss_end = .; _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) *(.reloc)
} }
. = ALIGN(4096);
.note.gnu.build-id : {
*(.note.gnu.build-id)
}
.data.ident : {
*(.data.ident)
}
. = ALIGN(4096); . = ALIGN(4096);
.data : .data :
{ {
@ -38,7 +46,7 @@ SECTIONS
*(.bss) *(.bss)
*(COMMON) *(COMMON)
} }
.note.gnu.build-id : { *(.note.gnu.build-id) }
. = ALIGN(4096); . = ALIGN(4096);
.vendor_cert : .vendor_cert :
{ {

View File

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

View File

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

View File

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