Avoid sbverify warning about gap in section table.

We have a .setup section in the EFI image that contains the remainder of
the Linux boot header and the real-mode setup code to support booting via
an intermediate bootloader. This sits between the PE header and the .text
section. We don't want the EFI loader to load this section, so simply
increase the SizeOfHeader field in the PE header to cover it.
This commit is contained in:
Martin Whitaker 2023-02-02 09:32:47 +00:00 committed by Sam Demeulemeester
parent d088740757
commit b01c8e4388
3 changed files with 5 additions and 4 deletions

View File

@ -144,7 +144,7 @@ extra_header_fields:
.long 0 # Win32VersionValue
.long _virt_img_size # SizeOfImage
.long end_of_headers # SizeOfHeaders
.long _file_head_size # SizeOfHeaders
.long 0 # CheckSum
.word 10 # Subsystem (EFI application)
.word 0 # DllCharacteristics
@ -241,7 +241,6 @@ boot_flag:
.word 0xAA55
.org 512
end_of_headers:
.section ".reloc"
.long 0 // Page RVA

View File

@ -38,6 +38,7 @@ SECTIONS {
_real_reloc_size = _real_reloc_end - _file_reloc_start;
_real_sbat_size = _real_sbat_end - _file_sbat_start;
_file_head_size = _file_text_start;
_file_text_size = _file_text_end - _file_text_start;
_file_reloc_size = _file_reloc_end - _file_reloc_start;
_file_sbat_size = _file_sbat_end - _file_sbat_start;
@ -45,7 +46,7 @@ SECTIONS {
_sys_size = (_real_text_size + 15) >> 4;
_init_size = _real_text_size + _bss_size;
_virt_head_size = ((_file_text_start + 4095) >> 12) << 12;
_virt_head_size = ((_file_head_size + 4095) >> 12) << 12;
_virt_text_size = ((_init_size + 4095) >> 12) << 12;
_virt_reloc_size = ((_file_reloc_size + 4095) >> 12) << 12;
_virt_sbat_size = ((_file_sbat_size + 4095) >> 12) << 12;

View File

@ -38,6 +38,7 @@ SECTIONS {
_real_reloc_size = _real_reloc_end - _file_reloc_start;
_real_sbat_size = _real_sbat_end - _file_sbat_start;
_file_head_size = _file_text_start;
_file_text_size = _file_text_end - _file_text_start;
_file_reloc_size = _file_reloc_end - _file_reloc_start;
_file_sbat_size = _file_sbat_end - _file_sbat_start;
@ -45,7 +46,7 @@ SECTIONS {
_sys_size = (_real_text_size + 15) >> 4;
_init_size = _real_text_size + _bss_size;
_virt_head_size = ((_file_text_start + 4095) >> 12) << 12;
_virt_head_size = ((_file_head_size + 4095) >> 12) << 12;
_virt_text_size = ((_init_size + 4095) >> 12) << 12;
_virt_reloc_size = ((_file_reloc_size + 4095) >> 12) << 12;
_virt_sbat_size = ((_file_sbat_size + 4095) >> 12) << 12;