diff --git a/efi/crt0/crt0-efi-aarch64.S b/efi/crt0/crt0-efi-aarch64.S index edd1fa1..970dbc5 100644 --- a/efi/crt0/crt0-efi-aarch64.S +++ b/efi/crt0/crt0-efi-aarch64.S @@ -1,5 +1,6 @@ + /* - * crt0-efi-aarch64.S - PE/COFF header for AArch64 EFI applications + * crt0-efi-aarch64-local.S - PE/COFF header for AArch64 EFI applications (without suitable objcopy) * * Copyright (C) 2014 Linaro Ltd. * @@ -108,6 +109,17 @@ section_table: .2byte 0 // NumberOfLineNumbers (0 for executables) .4byte 0x60000020 // Characteristics (section flags) + .ascii ".data\0\0\0" + .4byte _data_vsize - ImageBase // VirtualSize + .4byte _data - ImageBase // VirtualAddress + .4byte _data_size - ImageBase // SizeOfRawData + .4byte _data - ImageBase // PointerToRawData + .4byte 0 // PointerToRelocations + .4byte 0 // PointerToLineNumbers + .2byte 0 // NumberOfRelocations + .2byte 0 // NumberOfLineNumbers + .4byte 0xC0000040 // Characteristics (section flags) + /* * The EFI application loader requires a relocation section * because EFI applications must be relocatable. This is a @@ -124,17 +136,6 @@ section_table: .2byte 0 // NumberOfLineNumbers .4byte 0x42000040 // Characteristics (section flags) - .ascii ".data\0\0\0" - .4byte _data_vsize - ImageBase // VirtualSize - .4byte _data - ImageBase // VirtualAddress - .4byte _data_size - ImageBase // SizeOfRawData - .4byte _data - ImageBase // PointerToRawData - .4byte 0 // PointerToRelocations - .4byte 0 // PointerToLineNumbers - .2byte 0 // NumberOfRelocations - .2byte 0 // NumberOfLineNumbers - .4byte 0xC0000040 // Characteristics (section flags) - .ascii ".rodata\0" .4byte _rodata_vsize - ImageBase // VirtualSize .4byte _rodata - ImageBase // VirtualAddress @@ -145,7 +146,7 @@ section_table: .2byte 0 // NumberOfRelocations .2byte 0 // NumberOfLineNumbers .4byte 0x40000040 // Characteristics (section flags) - + #ifdef USING_SBAT .ascii ".sbat\0\0\0" .4byte _sbat_vsize - ImageBase // VirtualSize @@ -173,6 +174,7 @@ section_table: .4byte 0x40000040 // Characteristics (section flags) #endif + .text .globl _start .type _start,%function @@ -187,23 +189,24 @@ _start: adrp x1, _DYNAMIC add x1, x1, #:lo12:_DYNAMIC bl _relocate - cbnz x0, 0f + cbnz x0, .L_exit ldp x0, x1, [sp, #16] - bl efi_main + bl _entry -0: ldp x29, x30, [sp], #32 +.L_exit: + ldp x29, x30, [sp], #32 ret - -// hand-craft a dummy .reloc section so EFI knows it's a relocatable executable: + + // hand-craft a dummy .reloc section so EFI knows it's a relocatable executable: .data -dummy: .4byte 0 +dummy0: .4byte 0 +dummy1: .4byte 0 #define IMAGE_REL_ABSOLUTE 0 - .section .reloc, "a" -label1: - .4byte dummy-label1 // Page RVA + .section .reloc, "a", %progbits + .4byte dummy1 - dummy0 // Page RVA .4byte 12 // Block Size (2*4+2*2), must be aligned by 32 Bits .2byte (IMAGE_REL_ABSOLUTE<<12) + 0 // reloc for dummy .2byte (IMAGE_REL_ABSOLUTE<<12) + 0 // reloc for dummy diff --git a/efi/crt0/crt0-efi-arm.S b/efi/crt0/crt0-efi-arm.S index af75d74..0956d9b 100644 --- a/efi/crt0/crt0-efi-arm.S +++ b/efi/crt0/crt0-efi-arm.S @@ -31,7 +31,7 @@ pe_header: .2byte 0 coff_header: .2byte 0x1c2 // Mixed ARM/Thumb - .2byte NR_SECTIONS // nr_sections + .2byte NR_SECTIONS // nr_sections .4byte 0 // TimeDateStamp .4byte 0 // PointerToSymbolTable .4byte 0 // NumberOfSymbols @@ -48,9 +48,9 @@ optional_header: .4byte _text_size - ImageBase // SizeOfCode .4byte _alldata_size - ImageBase // SizeOfInitializedData .4byte 0 // SizeOfUninitializedData - .4byte _start - ImageBase // AddressOfEntryPoint + .4byte _text - ImageBase // AddressOfEntryPoint .4byte _text - ImageBase // BaseOfCode - .4byte _reloc - ImageBase // BaseOfData + .4byte _data - ImageBase // BaseOfData extra_header_fields: .4byte 0 // ImageBase @@ -110,6 +110,17 @@ section_table: .2byte 0 // NumberOfLineNumbers (0 for executables) .4byte 0x60000020 // Characteristics (section flags) + .ascii ".data\0\0\0" + .4byte _data_vsize - ImageBase // VirtualSize + .4byte _data - ImageBase // VirtualAddress + .4byte _data_size - ImageBase // SizeOfRawData + .4byte _data - ImageBase // PointerToRawData + .4byte 0 // PointerToRelocations + .4byte 0 // PointerToLineNumbers + .2byte 0 // NumberOfRelocations + .2byte 0 // NumberOfLineNumbers + .4byte 0xC0000040 // Characteristics (section flags) + /* * The EFI application loader requires a relocation section * because EFI applications must be relocatable. This is a @@ -126,17 +137,6 @@ section_table: .2byte 0 // NumberOfLineNumbers .4byte 0x42000040 // Characteristics (section flags) - .ascii ".data\0\0\0" - .4byte _data_vsize - ImageBase // VirtualSize - .4byte _data - ImageBase // VirtualAddress - .4byte _data_size - ImageBase // SizeOfRawData - .4byte _data - ImageBase // PointerToRawData - .4byte 0 // PointerToRelocations - .4byte 0 // PointerToLineNumbers - .2byte 0 // NumberOfRelocations - .2byte 0 // NumberOfLineNumbers - .4byte 0xC0000040 // Characteristics (section flags) - .ascii ".rodata\0" .4byte _rodata_vsize - ImageBase // VirtualSize .4byte _rodata - ImageBase // VirtualAddress @@ -147,6 +147,7 @@ section_table: .2byte 0 // NumberOfRelocations .2byte 0 // NumberOfLineNumbers .4byte 0x40000040 // Characteristics (section flags) + #ifdef USING_SBAT .ascii ".sbat\0\0\0" .4byte _sbat_vsize - ImageBase // VirtualSize @@ -188,12 +189,13 @@ _start: sub r0, r0, #0x1000 bl _relocate teq r0, #0 - bne 0f + bne .L_exit ldmfd sp, {r0-r1} - bl efi_main + bl _entry -0: add sp, sp, #12 +.L_exit: + add sp, sp, #12 ldr pc, [sp], #4 .L_DYNAMIC: @@ -202,11 +204,12 @@ _start: // hand-craft a dummy .reloc section so EFI knows it's a relocatable executable: .data -dummy: .4byte 0 +dummy0: .4byte 0 +dummy1: .4byte 0 #define IMAGE_REL_ABSOLUTE 0 - .section .areloc - .4byte dummy // Page RVA + .section .areloc, "a", %progbits + .4byte dummy1 - dummy0 // Page RVA .4byte 12 // Block Size (2*4+2*2), must be aligned by 32 Bits .2byte (IMAGE_REL_ABSOLUTE<<12) + 0 // reloc for dummy .2byte (IMAGE_REL_ABSOLUTE<<12) + 0 // reloc for dummy diff --git a/efi/crt0/crt0-efi-loongarch64.S b/efi/crt0/crt0-efi-loongarch64.S index 1e697a9..3d9e3a3 100644 --- a/efi/crt0/crt0-efi-loongarch64.S +++ b/efi/crt0/crt0-efi-loongarch64.S @@ -108,6 +108,17 @@ section_table: .2byte 0 // NumberOfLineNumbers (0 for executables) .4byte 0x60000020 // Characteristics (section flags) + .ascii ".data\0\0\0" + .4byte _data_vsize - ImageBase // VirtualSize + .4byte _data - ImageBase // VirtualAddress + .4byte _data_size - ImageBase // SizeOfRawData + .4byte _data - ImageBase // PointerToRawData + .4byte 0 // PointerToRelocations + .4byte 0 // PointerToLineNumbers + .2byte 0 // NumberOfRelocations + .2byte 0 // NumberOfLineNumbers + .4byte 0xC0000040 // Characteristics (section flags) + /* * The EFI application loader requires a relocation section * because EFI applications must be relocatable. This is a @@ -124,17 +135,6 @@ section_table: .2byte 0 // NumberOfLineNumbers .4byte 0x42000040 // Characteristics (section flags) - .ascii ".data\0\0\0" - .4byte _data_vsize - ImageBase // VirtualSize - .4byte _data - ImageBase // VirtualAddress - .4byte _data_size - ImageBase // SizeOfRawData - .4byte _data - ImageBase // PointerToRawData - .4byte 0 // PointerToRelocations - .4byte 0 // PointerToLineNumbers - .2byte 0 // NumberOfRelocations - .2byte 0 // NumberOfLineNumbers - .4byte 0xC0000040 // Characteristics (section flags) - .ascii ".rodata\0" .4byte _rodata_vsize - ImageBase // VirtualSize .4byte _rodata - ImageBase // VirtualAddress @@ -187,25 +187,26 @@ _start: la.local $a0, ImageBase // a0: ImageBase la.local $a1, _DYNAMIC // a1: DynamicSection bl _relocate - bnez $a0, 0f + bnez $a0, .L_exit ld.d $a0, $sp, 8 ld.d $a1, $sp, 16 bl efi_main -0: ld.d $ra, $sp, 0 +.L_exit: + ld.d $ra, $sp, 0 addi.d $sp, $sp, 24 jr $ra .end _start // hand-craft a dummy .reloc section so EFI knows it's a relocatable executable: - .data -dummy: .4byte 0 + .data +dummy0: .4byte 0 +dummy1: .4byte 0 #define IMAGE_REL_ABSOLUTE 0 - .section .reloc, "a" -label1: - .4byte dummy-label1 // Page RVA + .section .reloc, "a", %progbits + .4byte dummy1 - dummy0 // Page RVA .4byte 12 // Block Size (2*4+2*2), must be aligned by 32 Bits .2byte (IMAGE_REL_ABSOLUTE<<12) + 0 // reloc for dummy .2byte (IMAGE_REL_ABSOLUTE<<12) + 0 // reloc for dummy diff --git a/efi/crt0/crt0-efi-riscv64.S b/efi/crt0/crt0-efi-riscv64.S index 9754bc2..95b2e05 100644 --- a/efi/crt0/crt0-efi-riscv64.S +++ b/efi/crt0/crt0-efi-riscv64.S @@ -1,5 +1,7 @@ -/* SPDX-License-Identifier: GPL-2.0+ OR BSD-2-Clause */ +/* SPDX-License-Identifier: GPL-2.0-or-later OR BSD-2-Clause */ /* + * crt0-efi-riscv64-local.S - PE/COFF header for RISC-V 64 EFI applications (without suitable objcopy) + * * Copyright (C) 2014 Linaro Ltd. * Copyright (C) 2018 Alexander Graf * @@ -16,7 +18,6 @@ * either version 2 of the License, or (at your option) any later version. */ - .section .text.head /* @@ -68,7 +69,7 @@ extra_header_fields: // Everything before the kernel image is considered part of the header .4byte _text - ImageBase // SizeOfHeaders .4byte 0 // CheckSum - .2byte EFI_SUBSYSTEM // Subsystem + .2byte EFI_SUBSYSTEM // Subsystem .2byte 0 // DllCharacteristics .8byte 0 // SizeOfStackReserve .8byte 0 // SizeOfStackCommit @@ -109,6 +110,17 @@ section_table: .2byte 0 // NumberOfLineNumbers (0 for executables) .4byte 0x60000020 // Characteristics (section flags) + .ascii ".data\0\0\0" + .4byte _data_vsize - ImageBase // VirtualSize + .4byte _data - ImageBase // VirtualAddress + .4byte _data_size - ImageBase // SizeOfRawData + .4byte _data - ImageBase // PointerToRawData + .4byte 0 // PointerToRelocations + .4byte 0 // PointerToLineNumbers + .2byte 0 // NumberOfRelocations + .2byte 0 // NumberOfLineNumbers + .4byte 0xC0000040 // Characteristics (section flags) + /* * The EFI application loader requires a relocation section * because EFI applications must be relocatable. This is a @@ -125,17 +137,6 @@ section_table: .2byte 0 // NumberOfLineNumbers .4byte 0x42000040 // Characteristics (section flags) - .ascii ".data\0\0\0" - .4byte _data_vsize - ImageBase // VirtualSize - .4byte _data - ImageBase // VirtualAddress - .4byte _data_size - ImageBase // SizeOfRawData - .4byte _data - ImageBase // PointerToRawData - .4byte 0 // PointerToRelocations - .4byte 0 // PointerToLineNumbers - .2byte 0 // NumberOfRelocations - .2byte 0 // NumberOfLineNumbers - .4byte 0xC0000040 // Characteristics (section flags) - .ascii ".rodata\0" .4byte _rodata_vsize - ImageBase // VirtualSize .4byte _rodata - ImageBase // VirtualAddress @@ -185,23 +186,24 @@ _start: lla a0, ImageBase lla a1, _DYNAMIC call _relocate - bne a0, zero, 0f + bne a0, zero, .L_exit ld a1, 8(sp) ld a0, 0(sp) - call efi_main + call _entry ld ra, 16(sp) -0: addi sp, sp, 24 +.L_exit: + addi sp, sp, 24 ret // hand-craft a dummy .reloc section so EFI knows it's a relocatable executable: .data -dummy: .4byte 0 +dummy0: .4byte 0 +dummy1: .4byte 0 #define IMAGE_REL_ABSOLUTE 0 - .section .reloc, "a" -label1: - .4byte dummy-label1 // Page RVA + .section .reloc, "a", %progbits + .4byte dummy1 - dummy0 // Page RVA .4byte 12 // Block Size (2*4+2*2), must be aligned by 32 Bits .2byte (IMAGE_REL_ABSOLUTE<<12) + 0 // reloc for dummy .2byte (IMAGE_REL_ABSOLUTE<<12) + 0 // reloc for dummy diff --git a/efi/lds/elf_aarch64_efi.lds b/efi/lds/elf_aarch64_efi.lds index c976853..5eb0b9c 100644 --- a/efi/lds/elf_aarch64_efi.lds +++ b/efi/lds/elf_aarch64_efi.lds @@ -19,17 +19,8 @@ SECTIONS _text_vsize = _evtext - _text; _text_size = _etext - _text; . = ALIGN(65536); - _reloc = .; - .reloc : { - *(.reloc) - _evreloc = .; - . = ALIGN(4096); - _ereloc = .; - } =0 - _reloc_vsize = _evreloc - _reloc; - _reloc_size = _ereloc - _reloc; - . = ALIGN(4096); _data = .; + _DYNAMIC = .; .dynamic : { *(.dynamic) } . = ALIGN(4096); .data : @@ -86,7 +77,16 @@ SECTIONS } =0 _data_vsize = _evdata - _data; _data_size = _edata - _data; - + . = ALIGN(4096); + _reloc = .; + .reloc : { + *(.reloc) + _evreloc = .; + . = ALIGN(4096); + _ereloc = .; + } =0 + _reloc_vsize = _evreloc - _reloc; + _reloc_size = _ereloc - _reloc; . = ALIGN(4096); _rodata = .; .rela : @@ -113,38 +113,9 @@ SECTIONS } =0 _rodata_vsize = _evrodata - _rodata; _rodata_size = _erodata - _rodata; - /* - * Note that _sbat must be the beginning of the data, and _esbat must be the - * end and must be before any section padding. The sbat self-check uses - * _esbat to find the bounds of the data, and if the padding is included, the - * CSV parser (correctly) rejects the data as having NUL values in one of the - * required columns. - */ - . = ALIGN(4096); - .sbat : - { - _sbat = .; - *(.sbat) - *(.sbat.*) - _esbat = .; - . = ALIGN(4096); - _epsbat = .; - } =0 - _sbat_size = _epsbat - _sbat; - _sbat_vsize = _esbat - _sbat; - . = ALIGN(4096); - .sbom : - { - _sbom = .; - *(.sbom) - _esbom = .; - . = ALIGN(4096); - _epsbom = .; - } =0 - _sbom_size = _epsbom - _sbom; - _sbom_vsize = _esbom - _sbom; + _image_end = .; - _alldata_size = _image_end - _reloc; + _alldata_size = _image_end - _data; . = ALIGN(4096); .dynsym : { *(.dynsym) } diff --git a/efi/lds/elf_aarch64_efi_system.lds b/efi/lds/elf_aarch64_efi_system.lds index e3af2c5..d9cdba4 100644 --- a/efi/lds/elf_aarch64_efi_system.lds +++ b/efi/lds/elf_aarch64_efi_system.lds @@ -20,29 +20,20 @@ SECTIONS *(.gnu.linkonce.t.*) *(.plt) . = ALIGN(16); - _etext = .; } + _etext = .; _text_size = _etext - _text; . = ALIGN(65536); - _reloc = .; - .reloc : { - *(.reloc) - _ereloc = .; - } - _reloc_size = _ereloc - _reloc; - . = ALIGN(4096); - _data = .; - .dynamic : { *(.dynamic) } - . = ALIGN(4096); .data : { + _data = .; *(.sdata) *(.data) *(.data1) *(.data.*) *(.got.plt) *(.got) - + /* * Note that these aren't the using the GNU "CONSTRUCTOR" output section * command, so they don't start with a size. Because of p2align and the @@ -77,17 +68,22 @@ SECTIONS *(.sbss) *(.scommon) *(.dynbss) - *(.bss) - *(.bss.*) + *(.bss*) *(COMMON) + *(.rel.local) . = ALIGN(16); + _bss_end = .; - _edata = .; } - _data_size = _edata - _data; - . = ALIGN(4096); - _rodata = .; + .reloc : + { + KEEP (*(.reloc)) + } + . = ALIGN(4096); + _DYNAMIC = .; + .dynamic : { *(.dynamic) } + . = ALIGN(4096); .rela : { *(.rela.text*) @@ -104,11 +100,7 @@ SECTIONS . = ALIGN(4096); .rela.plt : { *(.rela.plt) } . = ALIGN(4096); - .rodata : { - *(.rodata*) - _erodata = .; - } - _rodata_size = _erodata - _rodata; + .rodata : { *(.rodata*) } /* * Note that _sbat must be the beginning of the data, and _esbat must be the * end and must be before any section padding. The sbat self-check uses @@ -129,15 +121,10 @@ SECTIONS _sbat_size = _epsbat - _sbat; _sbat_vsize = _esbat - _sbat; . = ALIGN(4096); - .sbom : - { - _sbom = .; - *(.sbom) - _epsbom = .; - } - _sbom_size = _epsbom - _sbom; - _image_end = .; - _alldata_size = _image_end - _reloc; + .sbom : { *(.sbom) } + . = ALIGN(512); + _edata = .; + _data_size = _edata - _data; . = ALIGN(4096); .dynsym : { *(.dynsym) } @@ -145,7 +132,7 @@ SECTIONS .dynstr : { *(.dynstr) } . = ALIGN(4096); .note.gnu.build-id : { *(.note.gnu.build-id) } - /DISCARD/ : + .ignored.reloc : { *(.rela.reloc) *(.note.GNU-stack) diff --git a/efi/lds/elf_arm_efi.lds b/efi/lds/elf_arm_efi.lds index 4aade31..e7883da 100644 --- a/efi/lds/elf_arm_efi.lds +++ b/efi/lds/elf_arm_efi.lds @@ -19,17 +19,8 @@ SECTIONS _text_vsize = _evtext - _text; _text_size = _etext - _text; . = ALIGN(4096); - _reloc = .; - .areloc : { - *(.areloc) - _evreloc = .; - . = ALIGN(4096); - _ereloc = .; - } =0 - _reloc_vsize = _evreloc - _reloc; - _reloc_size = _ereloc - _reloc; - . = ALIGN(4096); _data = .; + _DYNAMIC = .; .dynamic : { *(.dynamic) } . = ALIGN(4096); .data : @@ -86,6 +77,16 @@ SECTIONS } =0 _data_vsize = _evdata - _data; _data_size = _edata - _data; + . = ALIGN(4096); + _reloc = .; + .areloc : { + *(.areloc) + _evreloc = .; + . = ALIGN(4096); + _ereloc = .; + } =0 + _reloc_vsize = _evreloc - _reloc; + _reloc_size = _ereloc - _reloc; . = ALIGN(4096); _rodata = .; @@ -113,7 +114,7 @@ SECTIONS } =0 _rodata_vsize = _evrodata - _rodata; _rodata_size = _erodata - _rodata; - /* +/* * Note that _sbat must be the beginning of the data, and _esbat must be the * end and must be before any section padding. The sbat self-check uses * _esbat to find the bounds of the data, and if the padding is included, the @@ -144,7 +145,7 @@ SECTIONS _sbom_size = _epsbom - _sbom; _sbom_vsize = _esbom - _sbom; _image_end = .; - _alldata_size = _image_end - _reloc; + _alldata_size = _image_end - _data; . = ALIGN(4096); .dynsym : { *(.dynsym) } diff --git a/efi/lds/elf_loongarch64_efi.lds b/efi/lds/elf_loongarch64_efi.lds index c7a77a3..a1d1f99 100644 --- a/efi/lds/elf_loongarch64_efi.lds +++ b/efi/lds/elf_loongarch64_efi.lds @@ -18,16 +18,6 @@ SECTIONS } =0 _text_vsize = _evtext - _text; _text_size = _etext - _text; - . = ALIGN(4096); - _reloc = .; - .reloc : { - *(.reloc) - _evreloc = .; - . = ALIGN(4096); - _ereloc = .; - } =0 - _reloc_vsize = _evreloc - _reloc; - _reloc_size = _ereloc - _reloc; . = ALIGN(65536); _data = .; .dynamic : { *(.dynamic) } @@ -86,7 +76,16 @@ SECTIONS } =0 _data_vsize = _evdata - _data; _data_size = _edata - _data; - + . = ALIGN(4096); + _reloc = .; + .reloc : { + *(.reloc) + _evreloc = .; + . = ALIGN(4096); + _ereloc = .; + } =0 + _reloc_vsize = _evreloc - _reloc; + _reloc_size = _ereloc - _reloc; . = ALIGN(4096); _rodata = .; .rela : diff --git a/efi/lds/elf_riscv64_efi.lds b/efi/lds/elf_riscv64_efi.lds index b5577d1..d386ac2 100644 --- a/efi/lds/elf_riscv64_efi.lds +++ b/efi/lds/elf_riscv64_efi.lds @@ -21,17 +21,8 @@ SECTIONS _text_vsize = _evtext - _text; _text_size = _etext - _text; . = ALIGN(4096); - _reloc = .; - .reloc : { - *(.reloc) - _evreloc = .; - . = ALIGN(4096); - _ereloc = .; - } =0 - _reloc_vsize = _evreloc - _reloc; - _reloc_size = _ereloc - _reloc; - . = ALIGN(4096); _data = .; + _DYNAMIC = .; .dynamic : { *(.dynamic) } . = ALIGN(4096); .data : @@ -88,6 +79,16 @@ SECTIONS } =0 _data_vsize = _evdata - _data; _data_size = _edata - _data; + . = ALIGN(4096); + _reloc = .; + .reloc : { + *(.reloc) + _evreloc = .; + . = ALIGN(4096); + _ereloc = .; + } =0 + _reloc_vsize = _evreloc - _reloc; + _reloc_size = _ereloc - _reloc; . = ALIGN(4096); _rodata = .; @@ -146,7 +147,7 @@ SECTIONS _sbom_size = _epsbom - _sbom; _sbom_vsize = _esbom - _sbom; _image_end = .; - _alldata_size = _image_end - _reloc; + _alldata_size = _image_end - _data; . = ALIGN(4096); .dynsym : { *(.dynsym) } @@ -170,4 +171,3 @@ SECTIONS } .comment 0 : { *(.comment) } } - diff --git a/efi/lds/elf_riscv64_efi_system.lds b/efi/lds/elf_riscv64_efi_system.lds index b245b2b..e67a288 100644 --- a/efi/lds/elf_riscv64_efi_system.lds +++ b/efi/lds/elf_riscv64_efi_system.lds @@ -26,11 +26,6 @@ SECTIONS _etext = .; _text_size = _etext - _text; . = ALIGN(65536); - .reloc : - { - KEEP (*(.reloc)) - } - . = ALIGN(4096); _DYNAMIC = .; .dynamic : { *(.dynamic) } . = ALIGN(4096); @@ -85,6 +80,11 @@ SECTIONS _bss_end = .; } + . = ALIGN(4096); + .reloc : + { + KEEP (*(.reloc)) + } . = ALIGN(4096); .rela : @@ -124,13 +124,7 @@ SECTIONS _sbat_size = _epsbat - _sbat; _sbat_vsize = _esbat - _sbat; . = ALIGN(4096); - .sbom : - { - _sbom = .; - *(.sbom) - _epsbom = .; - } - _sbom_size = _epsbom - _sbom; + .sbom : { *(.sbom) } . = ALIGN(512); _edata = .; _data_size = _edata - _data; @@ -147,4 +141,4 @@ SECTIONS *(.note.GNU-stack) } .comment 0 : { *(.comment) } -} \ No newline at end of file +} diff --git a/efi/lds/elf_x86_64_efi.lds b/efi/lds/elf_x86_64_efi.lds index d274f7e..012b94a 100644 --- a/efi/lds/elf_x86_64_efi.lds +++ b/efi/lds/elf_x86_64_efi.lds @@ -25,11 +25,6 @@ SECTIONS } _etext = .; _text_size = _etext - _text; - . = ALIGN(4096); - .reloc : - { - KEEP (*(.reloc)) - } . = ALIGN(4096); .data : @@ -81,6 +76,12 @@ SECTIONS _edata = .; _data_size = _edata - _etext; . = ALIGN(4096); + .reloc : + { + KEEP (*(.reloc)) + } + . = ALIGN(4096); + _DYNAMIC = .; .dynamic : { *(.dynamic) } . = ALIGN(4096); .rela :