summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Jones <pjones@redhat.com>2021-03-11 10:00:52 -0500
committerJavier Martinez Canillas <javier@dowhile0.org>2021-03-12 10:15:01 +0100
commit2bf1d7ae59004df591ec6636f78910721a686d1e (patch)
tree7ddef69903cc4479de9f28d6a542f35780efe77b
parente02bb35a160d3b0fec07adbfb2f730031173e180 (diff)
downloadefi-boot-shim-2bf1d7ae59004df591ec6636f78910721a686d1e.tar.gz
efi-boot-shim-2bf1d7ae59004df591ec6636f78910721a686d1e.zip
linker scripts: put .sbat after _edata
Our section headers on arm binaries need to include .sbat on fallback and MokManger, and currently they do not. The reason for this is that gnu-efi provides static, (mostly) hand-coded section headers on arm and aarch64, due to having no efi-app-arm and efi-app-aa64 target support in binutils. Additionally, the assembler also generates (IMO pointless) relocations for _esbat/_sbat_size when those are actually inside the section, and relocated symbols can't be used in our section headers. This patch moves the .sbat section to be after _edata, so the sections don't overlap, and moves _esbat and _sbat_size to be after the section, to avoid the relocation. I'm not 100% sure we can't have overlapping sections, but now doesn't seem like the time to find out. Signed-off-by: Peter Jones <pjones@redhat.com>
-rw-r--r--elf_aarch64_efi.lds17
-rw-r--r--elf_arm_efi.lds17
-rw-r--r--elf_ia32_efi.lds18
-rw-r--r--elf_ia64_efi.lds18
-rw-r--r--elf_x86_64_efi.lds17
5 files changed, 47 insertions, 40 deletions
diff --git a/elf_aarch64_efi.lds b/elf_aarch64_efi.lds
index dfa16e8f..8196cc37 100644
--- a/elf_aarch64_efi.lds
+++ b/elf_aarch64_efi.lds
@@ -58,14 +58,6 @@ SECTIONS
*(.vendor_cert)
}
. = ALIGN(4096);
- .sbat :
- {
- _sbat = .;
- *(.sbat)
- *(.sbat.*)
- _esbat = .;
- }
- . = ALIGN(4096);
.rela :
{
*(.rela.dyn)
@@ -76,6 +68,15 @@ SECTIONS
}
_edata = .;
_data_size = . - _data;
+ . = ALIGN(4096);
+ .sbat :
+ {
+ _sbat = .;
+ *(.sbat)
+ *(.sbat.*)
+ }
+ _esbat = .;
+ _sbat_size = . - _sbat;
. = ALIGN(4096);
.dynsym : { *(.dynsym) }
diff --git a/elf_arm_efi.lds b/elf_arm_efi.lds
index 55abd31a..5f78933a 100644
--- a/elf_arm_efi.lds
+++ b/elf_arm_efi.lds
@@ -56,14 +56,6 @@ SECTIONS
*(.vendor_cert)
}
. = ALIGN(4096);
- .sbat :
- {
- _sbat = .;
- *(.sbat)
- *(.sbat.*)
- _esbat = .;
- }
- . = ALIGN(4096);
.rel :
{
*(.rel.dyn)
@@ -74,6 +66,15 @@ SECTIONS
}
_edata = .;
_data_size = . - _data;
+ . = ALIGN(4096);
+ .sbat :
+ {
+ _sbat = .;
+ *(.sbat)
+ *(.sbat.*)
+ }
+ _esbat = .;
+ _sbat_size = . - _sbat;
. = ALIGN(4096);
.dynsym : { *(.dynsym) }
diff --git a/elf_ia32_efi.lds b/elf_ia32_efi.lds
index 54cd3fb9..742e0a47 100644
--- a/elf_ia32_efi.lds
+++ b/elf_ia32_efi.lds
@@ -54,14 +54,6 @@ SECTIONS
*(.vendor_cert)
}
. = ALIGN(4096);
- .sbat :
- {
- _sbat = .;
- *(.sbat)
- *(.sbat.*)
- _esbat = .;
- }
- . = ALIGN(4096);
.dynamic : { *(.dynamic) }
. = ALIGN(4096);
.rel :
@@ -78,6 +70,16 @@ SECTIONS
_edata = .;
_data_size = . - _data;
. = ALIGN(4096);
+ .sbat :
+ {
+ _sbat = .;
+ *(.sbat)
+ *(.sbat.*)
+ }
+ _esbat = .;
+ _sbat_size = . - _sbat;
+
+ . = ALIGN(4096);
.dynsym : { *(.dynsym) }
. = ALIGN(4096);
.dynstr : { *(.dynstr) }
diff --git a/elf_ia64_efi.lds b/elf_ia64_efi.lds
index ae10149d..2669b856 100644
--- a/elf_ia64_efi.lds
+++ b/elf_ia64_efi.lds
@@ -56,14 +56,6 @@ SECTIONS
*(.vendor_cert)
}
. = ALIGN(4096);
- .sbat :
- {
- _sbat = .;
- *(.sbat)
- *(.sbat.*)
- _esbat = .;
- }
- . = ALIGN(4096);
.dynamic : { *(.dynamic) }
. = ALIGN(4096);
.rela :
@@ -79,6 +71,16 @@ SECTIONS
_edata = .;
_data_size = . - _data;
. = ALIGN(4096);
+ .sbat :
+ {
+ _sbat = .;
+ *(.sbat)
+ *(.sbat.*)
+ }
+ _esbat = .;
+ _sbat_size = . - _sbat;
+
+ . = ALIGN(4096);
.reloc : /* This is the PECOFF .reloc section! */
{
*(.reloc)
diff --git a/elf_x86_64_efi.lds b/elf_x86_64_efi.lds
index ae2cd911..bcc65270 100644
--- a/elf_x86_64_efi.lds
+++ b/elf_x86_64_efi.lds
@@ -61,14 +61,6 @@ SECTIONS
*(.vendor_cert)
}
. = ALIGN(4096);
- .sbat :
- {
- _sbat = .;
- *(.sbat)
- *(.sbat.*)
- _esbat = .;
- }
- . = ALIGN(4096);
.dynamic : { *(.dynamic) }
. = ALIGN(4096);
.rela :
@@ -79,6 +71,15 @@ SECTIONS
}
_edata = .;
_data_size = . - _data;
+ . = ALIGN(4096);
+ .sbat :
+ {
+ _sbat = .;
+ *(.sbat)
+ *(.sbat.*)
+ }
+ _esbat = .;
+ _sbat_size = . - _sbat;
. = ALIGN(4096);
.dynsym : { *(.dynsym) }