misc: Improve UEFI linker scripts

This commit is contained in:
mintsuki 2023-09-09 15:49:17 -05:00
parent e7311fc8a0
commit f5e43d2e9b
3 changed files with 63 additions and 84 deletions

View File

@ -19,35 +19,29 @@ SECTIONS
*(.pe_header)
. = ALIGN(0x1000);
__text_start = ABSOLUTE(.);
*(.text .text.*)
. = ALIGN(0x1000);
} :text
__text_start = __image_base + 0x1000;
__text_size = SIZEOF(.text) - 0x1000;
__text_end = __text_start + __text_size;
.data.sbat : {
*(.data.sbat)
. = ALIGN(0x1000);
} :data
PROVIDE(__sbat_sizev = 1);
__sbat_start = __text_end;
__sbat_size = SIZEOF(.data.sbat);
__sbat_end = __sbat_start + __sbat_size;
.data.reloc : {
*(.data.reloc)
. = ALIGN(0x1000);
} :data
__reloc_start = __sbat_end;
__reloc_size = SIZEOF(.data.reloc);
__reloc_end = __reloc_start + __reloc_size;
. = ALIGN(0x1000);
__text_end = .;
__text_size = __text_end - __text_start;
.data : {
__sbat_start = ABSOLUTE(.);
*(.data.sbat)
. = ALIGN(0x1000);
__sbat_end = ABSOLUTE(.);
__sbat_size = ABSOLUTE(__sbat_end - __sbat_start);
PROVIDE(__sbat_sizev = ABSOLUTE(0));
__reloc_start = ABSOLUTE(.);
*(.data.reloc)
. = ALIGN(0x1000);
__reloc_end = ABSOLUTE(.);
__reloc_size = ABSOLUTE(__reloc_end - __reloc_start);
__data_start = ABSOLUTE(.);
*(.rodata .rodata.*)
#ifdef LINKER_NOMAP
@ -78,11 +72,10 @@ SECTIONS
. = ALIGN(0x1000);
} :data :dynamic
__data_start = __reloc_end;
__data_size = SIZEOF(.data) + SIZEOF(.rela) + SIZEOF(.got) + SIZEOF(.dynamic);
__data_end = __data_start + __data_size;
__data_end = .;
__data_size = __data_end - __data_start;
__image_end = __data_end;
__image_end = .;
/DISCARD/ : {
*(.eh_frame)

View File

@ -19,35 +19,29 @@ SECTIONS
*(.pe_header)
. = ALIGN(0x1000);
__text_start = ABSOLUTE(.);
*(.text .text.*)
. = ALIGN(0x1000);
} :text
__text_start = __image_base + 0x1000;
__text_size = SIZEOF(.text) - 0x1000;
__text_end = __text_start + __text_size;
.data.sbat : {
*(.data.sbat)
. = ALIGN(0x1000);
} :data
PROVIDE(__sbat_sizev = 1);
__sbat_start = __text_end;
__sbat_size = SIZEOF(.data.sbat);
__sbat_end = __sbat_start + __sbat_size;
.data.reloc : {
*(.data.reloc)
. = ALIGN(0x1000);
} :data
__reloc_start = __sbat_end;
__reloc_size = SIZEOF(.data.reloc);
__reloc_end = __reloc_start + __reloc_size;
. = ALIGN(0x1000);
__text_end = .;
__text_size = __text_end - __text_start;
.data : {
__sbat_start = ABSOLUTE(.);
*(.data.sbat)
. = ALIGN(0x1000);
__sbat_end = ABSOLUTE(.);
__sbat_size = ABSOLUTE(__sbat_end - __sbat_start);
PROVIDE(__sbat_sizev = ABSOLUTE(0));
__reloc_start = ABSOLUTE(.);
*(.data.reloc)
. = ALIGN(0x1000);
__reloc_end = ABSOLUTE(.);
__reloc_size = ABSOLUTE(__reloc_end - __reloc_start);
__data_start = ABSOLUTE(.);
*(.rodata .rodata.*)
#ifdef LINKER_NOMAP
@ -78,11 +72,10 @@ SECTIONS
. = ALIGN(0x1000);
} :data :dynamic
__data_start = __reloc_end;
__data_size = SIZEOF(.data) + SIZEOF(.rel) + SIZEOF(.got) + SIZEOF(.dynamic);
__data_end = __data_start + __data_size;
__data_end = .;
__data_size = __data_end - __data_start;
__image_end = __data_end;
__image_end = .;
/DISCARD/ : {
*(.eh_frame)

View File

@ -19,35 +19,29 @@ SECTIONS
*(.pe_header)
. = ALIGN(0x1000);
__text_start = ABSOLUTE(.);
*(.text .text.*)
. = ALIGN(0x1000);
} :text
__text_start = __image_base + 0x1000;
__text_size = SIZEOF(.text) - 0x1000;
__text_end = __text_start + __text_size;
.data.sbat : {
*(.data.sbat)
. = ALIGN(0x1000);
} :data
PROVIDE(__sbat_sizev = 1);
__sbat_start = __text_end;
__sbat_size = SIZEOF(.data.sbat);
__sbat_end = __sbat_start + __sbat_size;
.data.reloc : {
*(.data.reloc)
. = ALIGN(0x1000);
} :data
__reloc_start = __sbat_end;
__reloc_size = SIZEOF(.data.reloc);
__reloc_end = __reloc_start + __reloc_size;
. = ALIGN(0x1000);
__text_end = .;
__text_size = __text_end - __text_start;
.data : {
__sbat_start = ABSOLUTE(.);
*(.data.sbat)
. = ALIGN(0x1000);
__sbat_end = ABSOLUTE(.);
__sbat_size = ABSOLUTE(__sbat_end - __sbat_start);
PROVIDE(__sbat_sizev = ABSOLUTE(0));
__reloc_start = ABSOLUTE(.);
*(.data.reloc)
. = ALIGN(0x1000);
__reloc_end = ABSOLUTE(.);
__reloc_size = ABSOLUTE(__reloc_end - __reloc_start);
__data_start = ABSOLUTE(.);
*(.rodata .rodata.*)
#ifdef LINKER_NOMAP
@ -78,11 +72,10 @@ SECTIONS
. = ALIGN(0x1000);
} :data :dynamic
__data_start = __reloc_end;
__data_size = SIZEOF(.data) + SIZEOF(.rela) + SIZEOF(.got) + SIZEOF(.dynamic);
__data_end = __data_start + __data_size;
__data_end = .;
__data_size = __data_end - __data_start;
__image_end = __data_end;
__image_end = .;
/DISCARD/ : {
*(.eh_frame)