mirror of https://github.com/ipxe/ipxe.git
[efi] Treat writable sections as data sections
Hybrid bzImage and UEFI binaries (such as wimboot) may include 16-bit executable code that is opaque data from the perspective of a UEFI PE binary, as described in wimboot commit fe456ca ("[efi] Use separate .text and .data PE sections"). The ELF section will be marked as containing both executable code and writable data. Choose to treat such a section as a data section rather than a code section, since that matches the expected semantics for ELF files that we expect to process. Signed-off-by: Michael Brown <mcb30@ipxe.org>pull/1082/head
parent
8c8ead2530
commit
678a60f61d
|
@ -591,16 +591,6 @@ static struct pe_section * process_section ( struct elf_file *elf,
|
||||||
|
|
||||||
/* Fill in section characteristics and update RVA limits */
|
/* Fill in section characteristics and update RVA limits */
|
||||||
if ( ( shdr->sh_type == SHT_PROGBITS ) &&
|
if ( ( shdr->sh_type == SHT_PROGBITS ) &&
|
||||||
( shdr->sh_flags & SHF_EXECINSTR ) ) {
|
|
||||||
/* .text-type section */
|
|
||||||
new->hdr.Characteristics =
|
|
||||||
( EFI_IMAGE_SCN_CNT_CODE |
|
|
||||||
EFI_IMAGE_SCN_MEM_NOT_PAGED |
|
|
||||||
EFI_IMAGE_SCN_MEM_EXECUTE |
|
|
||||||
EFI_IMAGE_SCN_MEM_READ );
|
|
||||||
applicable_start = &code_start;
|
|
||||||
applicable_end = &code_end;
|
|
||||||
} else if ( ( shdr->sh_type == SHT_PROGBITS ) &&
|
|
||||||
( shdr->sh_flags & SHF_WRITE ) ) {
|
( shdr->sh_flags & SHF_WRITE ) ) {
|
||||||
/* .data-type section */
|
/* .data-type section */
|
||||||
new->hdr.Characteristics =
|
new->hdr.Characteristics =
|
||||||
|
@ -610,6 +600,16 @@ static struct pe_section * process_section ( struct elf_file *elf,
|
||||||
EFI_IMAGE_SCN_MEM_WRITE );
|
EFI_IMAGE_SCN_MEM_WRITE );
|
||||||
applicable_start = &data_start;
|
applicable_start = &data_start;
|
||||||
applicable_end = &data_mid;
|
applicable_end = &data_mid;
|
||||||
|
} else if ( ( shdr->sh_type == SHT_PROGBITS ) &&
|
||||||
|
( shdr->sh_flags & SHF_EXECINSTR ) ) {
|
||||||
|
/* .text-type section */
|
||||||
|
new->hdr.Characteristics =
|
||||||
|
( EFI_IMAGE_SCN_CNT_CODE |
|
||||||
|
EFI_IMAGE_SCN_MEM_NOT_PAGED |
|
||||||
|
EFI_IMAGE_SCN_MEM_EXECUTE |
|
||||||
|
EFI_IMAGE_SCN_MEM_READ );
|
||||||
|
applicable_start = &code_start;
|
||||||
|
applicable_end = &code_end;
|
||||||
} else if ( shdr->sh_type == SHT_PROGBITS ) {
|
} else if ( shdr->sh_type == SHT_PROGBITS ) {
|
||||||
/* .rodata-type section */
|
/* .rodata-type section */
|
||||||
new->hdr.Characteristics =
|
new->hdr.Characteristics =
|
||||||
|
|
Loading…
Reference in New Issue