diff options
Diffstat (limited to 'src/arch')
| -rw-r--r-- | src/arch/i386/Makefile.efi | 16 | ||||
| -rw-r--r-- | src/arch/i386/prefix/efiprefix.S | 175 | ||||
| -rw-r--r-- | src/arch/i386/scripts/efi.lds | 180 | ||||
| -rw-r--r-- | src/arch/x86/Makefile | 1 | ||||
| -rw-r--r-- | src/arch/x86/prefix/efiprefix.c | 39 | ||||
| -rw-r--r-- | src/arch/x86/scripts/efi.lds | 106 | ||||
| -rw-r--r-- | src/arch/x86_64/Makefile.efi | 16 | ||||
| -rw-r--r-- | src/arch/x86_64/prefix/efiprefix.S | 174 | ||||
| -rw-r--r-- | src/arch/x86_64/scripts/efi.lds | 180 |
9 files changed, 156 insertions, 731 deletions
diff --git a/src/arch/i386/Makefile.efi b/src/arch/i386/Makefile.efi index fec7a4074..c75338c9e 100644 --- a/src/arch/i386/Makefile.efi +++ b/src/arch/i386/Makefile.efi @@ -2,11 +2,11 @@ # The EFI linker script # -LDSCRIPT = arch/i386/scripts/efi.lds +LDSCRIPT = arch/x86/scripts/efi.lds -# Use a relocatable link; we perform final relocations in the efilink utility. +# Retain relocation information for elf2efi # -LDFLAGS += -r -d -S +LDFLAGS += -q -S # Media types. # @@ -14,12 +14,6 @@ NON_AUTO_MEDIA += efi # Rule for building EFI files # -$(BIN)/%.efi.tmp-reloc : $(BIN)/%.efi.tmp $(EFILINK) - $(QM)$(ECHO) " [EFILINK] $@" - $(Q)# Check for unresolved symbols - $(Q)$(LD) -e 0 --no-warn-mismatch -o /dev/null $< - $(Q)$(EFILINK) $< $@ - -$(BIN)/%.efi : $(BIN)/%.efi.tmp-reloc +$(BIN)/%.efi : $(BIN)/%.efi.tmp $(ELF2EFI32) $(QM)$(ECHO) " [FINISH] $@" - $(Q)$(OBJCOPY) -Obinary $< $@ + $(Q)$(ELF2EFI32) $< $@ diff --git a/src/arch/i386/prefix/efiprefix.S b/src/arch/i386/prefix/efiprefix.S deleted file mode 100644 index c4cf68e41..000000000 --- a/src/arch/i386/prefix/efiprefix.S +++ /dev/null @@ -1,175 +0,0 @@ - .text - .code32 - .arch i386 - .section ".prefix", "a", @progbits - .org 0x00 - - /* DOS (.com) header - * - * EFI executables seem to leave most of this empty - */ -mzhdr: - .ascii "MZ" /* Magic number */ - .word 0 /* Bytes on last page of file */ - .word 0 /* Pages in file */ - .word 0 /* Relocations */ - .word 0 /* Size of header in paragraphs */ - .word 0 /* Minimum extra paragraphs needed */ - .word 0 /* Maximum extra paragraphs needed */ - .word 0 /* Initial (relative) SS value */ - .word 0 /* Initial SP value */ - .word 0 /* "Checksum" */ - .word 0 /* Initial IP value */ - .word 0 /* Initial (relative) CS value */ - .word 0 /* File address of relocation table */ - .word 0 /* Ovesrlay number */ - .word 0, 0, 0, 0 /* Reserved words */ - .word 0 /* OEM identifier (for e_oeminfo) */ - .word 0 /* OEM information; e_oemid specific */ - .word 0, 0, 0, 0, 0 /* Reserved words */ - .word 0, 0, 0, 0, 0 /* Reserved words */ - .long pehdr_lma /* File address of new exe header */ - .size mzhdr, . - mzhdr - - /* PE header */ - .org 0xc0 /* For compatibility with MS toolchain */ -pehdr: - .ascii "PE\0\0" /* Magic number */ - .word 0x014c /* CPU architecture: i386 */ - .word num_pe_sections /* Number of sections */ - .long 0x10d1a884 /* Timestamp */ - .long 0 /* Symbol table */ - .long 0 /* Number of symbols */ - .word opthdr_size /* Size of optional header */ - .word 0x2102 /* Characteristics */ - .size pehdr, . - pehdr - .equ pehdr_lma, pehdr - mzhdr - - /* "Optional" header */ -opthdr: - .word 0x010b /* Magic number */ - .byte 0 /* Linker major version number */ - .byte 0 /* Linker minor version number */ - .long _text_filesz /* Size of text section */ - .long _data_filesz /* Size of data section */ - .long _bss_filesz /* Size of bss section */ - .long efi_entry_lma /* Entry point */ - .long _text_lma /* Text section start RVA */ - .long _data_lma /* Data section start RVA */ - .long 0 /* Image base address */ - .long _max_align /* Section alignment */ - .long _max_align /* File alignment */ - .word 0 /* Operating system major version number */ - .word 0 /* Operating system minor version number */ - .word 0 /* Image major version number */ - .word 0 /* Image minor version number */ - .word 0 /* Subsystem major version number */ - .word 0 /* Subsystem minor version number */ - .long 0 /* Reserved */ - .long _filesz /* Total image size */ - .long _prefix_filesz /* Total header size */ - .long 0 /* "Checksum" */ - .word 0x0a /* Subsystem: EFI */ - .word 0 /* DLL characteristics */ - .long 0 /* Size of stack reserve */ - .long 0 /* Size of stack commit */ - .long 0 /* Size of heap reserve */ - .long 0 /* Size of heap commit */ - .long 0 /* Loader flags */ - .long 16 /* Number of data directory entries */ - .long 0, 0 /* Export directory */ - .long 0, 0 /* Import directory */ - .long 0, 0 /* Resource directory */ - .long 0, 0 /* Exception directory */ - .long 0, 0 /* Security directory */ - .long _reloc_lma, _reloc_filesz /* Base relocation directory */ - .long debugdir_lma, debugdir_size /* Debug directory */ - .long 0, 0 /* Description directory */ - .long 0, 0 /* Special directory */ - .long 0, 0 /* Thread storage directory */ - .long 0, 0 /* Load configuration directory */ - .long 0, 0 /* Bound import directory */ - .long 0, 0 /* Import address table directory */ - .long 0, 0 /* Delay import directory */ - .long 0, 0 /* Reserved */ - .long 0, 0 /* Reserved */ - .size opthdr, . - opthdr - .equ opthdr_size, . - opthdr - - /* PE sections */ -pe_sections: -text_section: - .asciz ".text" /* Section name */ - .align 8 - .long _text_filesz /* Section size */ - .long _text_lma /* Relative Virtual Address */ - .long _text_filesz /* Section size (rounded up) */ - .long _text_lma /* Pointer to raw data */ - .long 0 /* Link-time relocations */ - .long 0 /* Line numbers */ - .word 0 /* Number of link-time relocations */ - .word 0 /* Number of line numbers */ - .long 0x68000020 /* Characteristics */ -rodata_section: - .asciz ".rodata" /* Section name */ - .align 8 - .long _rodata_filesz /* Section size */ - .long _rodata_lma /* Relative Virtual Address */ - .long _rodata_filesz /* Section size (rounded up) */ - .long _rodata_lma /* Pointer to raw data */ - .long 0 /* Link-time relocations */ - .long 0 /* Line numbers */ - .word 0 /* Number of link-time relocations */ - .word 0 /* Number of line numbers */ - .long 0x48000040 /* Characteristics */ -data_section: - .asciz ".data" /* Section name */ - .align 8 - .long _data_filesz /* Section size */ - .long _data_lma /* Relative Virtual Address */ - .long _data_filesz /* Section size (rounded up) */ - .long _data_lma /* Pointer to raw data */ - .long 0 /* Link-time relocations */ - .long 0 /* Line numbers */ - .word 0 /* Number of link-time relocations */ - .word 0 /* Number of line numbers */ - .long 0xc8000040 /* Characteristics */ -reloc_section: - .asciz ".reloc" /* Section name */ - .align 8 - .long _reloc_filesz /* Section size */ - .long _reloc_lma /* Relative Virtual Address */ - .long _reloc_filesz /* Section size (rounded up) */ - .long _reloc_lma /* Pointer to raw data */ - .long 0 /* Link-time relocations */ - .long 0 /* Line numbers */ - .word 0 /* Number of link-time relocations */ - .word 0 /* Number of line numbers */ - .long 0x42000040 /* Characteristics */ - -pe_sections_end: - .size pe_sections, . - pe_sections - .equ num_pe_sections, ( ( . - pe_sections ) / 0x28 ) - - /* Debug directory */ - .section ".rodata" - .globl debugdir -debugdir: - .long 0 /* Characteristics */ - .long 0x10d1a884 /* Timestamp */ - .word 0 /* Major version */ - .word 0 /* Minor version */ - .long 0x02 /* RSDS? */ - .long codeview_rsds_size /* Size of data */ - .long codeview_rsds_lma /* RVA */ - .long codeview_rsds_lma /* File offset */ - .size debugdir, . - debugdir - .equ debugdir_size, . - debugdir - /* Codeview structure */ - .globl codeview_rsds -codeview_rsds: - .ascii "RSDS" /* Magic number */ - .long 0, 0, 0, 0, 0 /* Unused by EFI */ - .asciz "efiprefix.pdb" - .size codeview_rsds, . - codeview_rsds - .equ codeview_rsds_size, . - codeview_rsds diff --git a/src/arch/i386/scripts/efi.lds b/src/arch/i386/scripts/efi.lds deleted file mode 100644 index b6255a68d..000000000 --- a/src/arch/i386/scripts/efi.lds +++ /dev/null @@ -1,180 +0,0 @@ -/* -*- sh -*- */ - -/* - * Linker script for EFI images - * - */ - -EXTERN ( efi_entry ) - -SECTIONS { - - /* The file starts at a virtual address of zero, and sections are - * contiguous. Each section is aligned to at least _max_align, - * which defaults to 32. Load addresses are equal to virtual - * addresses. - */ - - . = 0; - PROVIDE ( _max_align = 32 ); - - /* - * The prefix - * - */ - - .prefix : { - _prefix = .; - *(.prefix) - *(.prefix.*) - _mprefix = .; - } .bss.prefix (NOLOAD) : { - _eprefix = .; - } - _prefix_filesz = ABSOLUTE ( _mprefix - _prefix ); - _prefix_memsz = ABSOLUTE ( _eprefix - _prefix ); - - /* - * The text section - * - */ - - . = ALIGN ( _max_align ); - .text : { - _text = .; - *(.text) - *(.text.*) - _mtext = .; - } .bss.text (NOLOAD) : { - _etext = .; - } - _text_filesz = ABSOLUTE ( _mtext - _text ); - _text_memsz = ABSOLUTE ( _etext - _text ); - - /* - * The rodata section - * - */ - - . = ALIGN ( _max_align ); - .rodata : { - _rodata = .; - *(.rodata) - *(.rodata.*) - _mrodata = .; - } .bss.rodata (NOLOAD) : { - _erodata = .; - } - _rodata_filesz = ABSOLUTE ( _mrodata - _rodata ); - _rodata_memsz = ABSOLUTE ( _erodata - _rodata ); - - /* - * The data section - * - */ - - . = ALIGN ( _max_align ); - .data : { - _data = .; - *(.data) - *(.data.*) - *(SORT(.tbl.*)) /* Various tables. See include/tables.h */ - /* EFI seems to not support proper bss sections */ - *(.bss) - *(.bss.*) - *(COMMON) - *(.stack) - *(.stack.*) - _mdata = .; - } .bss.data (NOLOAD) : { - _edata = .; - } - _data_filesz = ABSOLUTE ( _mdata - _data ); - _data_memsz = ABSOLUTE ( _edata - _data ); - - /* - * The bss section - * - */ - - . = ALIGN ( _max_align ); - .bss : { - _bss = .; - /* EFI seems to not support proper bss sections */ - _mbss = .; - } .bss.bss (NOLOAD) : { - _ebss = .; - } - _bss_filesz = ABSOLUTE ( _mbss - _bss ); - _bss_memsz = ABSOLUTE ( _ebss - _bss ); - - /* - * The reloc section - * - */ - - . = ALIGN ( _max_align ); - .reloc : { - _reloc = .; - /* Provide some dummy contents to force ld to include this - * section. It will be created by the efilink utility. - */ - . += 1; - _mreloc = .; - } .bss.reloc (NOLOAD) : { - _ereloc = .; - } - _reloc_filesz = ABSOLUTE ( _mreloc - _reloc ); - _reloc_memsz = ABSOLUTE ( _ereloc - _reloc ); - - _filesz = ABSOLUTE ( . ); - - /* - * Weak symbols that need zero values if not otherwise defined - * - */ - - .weak 0x0 : { - _weak = .; - *(.weak) - _eweak = .; - } - _assert = ASSERT ( ( _weak == _eweak ), ".weak is non-zero length" ); - - /* - * Dispose of the comment and note sections to make the link map - * easier to read - * - */ - - /DISCARD/ : { - *(.comment) - *(.comment.*) - *(.note) - *(.note.*) - *(.eh_frame) - *(.eh_frame.*) - *(.rel) - *(.rel.*) - } - - /* - * Load address calculations. - * - */ - - _prefix_lma = ABSOLUTE ( _prefix ); - _text_lma = ABSOLUTE ( _text ); - _rodata_lma = ABSOLUTE ( _rodata ); - _data_lma = ABSOLUTE ( _data ); - _bss_lma = ABSOLUTE ( _bss ); - _reloc_lma = ABSOLUTE ( _reloc ); - - /* - * Load addresses required by the prefix - * - */ - efi_entry_lma = ABSOLUTE ( efi_entry ); - debugdir_lma = ABSOLUTE ( debugdir ); - codeview_rsds_lma = ABSOLUTE ( codeview_rsds ); -} diff --git a/src/arch/x86/Makefile b/src/arch/x86/Makefile index 9ac75b456..a7c4bc0ec 100644 --- a/src/arch/x86/Makefile +++ b/src/arch/x86/Makefile @@ -6,3 +6,4 @@ CFLAGS += -Iarch/x86/include # SRCDIRS += arch/x86/core SRCDIRS += arch/x86/interface/efi +SRCDIRS += arch/x86/prefix diff --git a/src/arch/x86/prefix/efiprefix.c b/src/arch/x86/prefix/efiprefix.c new file mode 100644 index 000000000..b05b744d3 --- /dev/null +++ b/src/arch/x86/prefix/efiprefix.c @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2009 Michael Brown <mbrown@fensystems.co.uk>. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include <stdlib.h> +#include <gpxe/efi/efi.h> + +/** + * EFI entry point + * + * @v image_handle Image handle + * @v systab System table + * @ret efirc EFI return status code + */ +EFI_STATUS EFIAPI _start ( EFI_HANDLE image_handle, + EFI_SYSTEM_TABLE *systab ) { + EFI_STATUS efirc; + + /* Initialise EFI environment */ + if ( ( efirc = efi_init ( image_handle, systab ) ) != 0 ) + return efirc; + + /* Call to main() */ + return RC_TO_EFIRC ( main () ); +} diff --git a/src/arch/x86/scripts/efi.lds b/src/arch/x86/scripts/efi.lds new file mode 100644 index 000000000..bfe817398 --- /dev/null +++ b/src/arch/x86/scripts/efi.lds @@ -0,0 +1,106 @@ +/* -*- sh -*- */ + +/* + * Linker script for EFI images + * + */ + +EXTERN ( _start ) +ENTRY ( _start ) + +SECTIONS { + + /* The file starts at a virtual address of zero, and sections are + * contiguous. Each section is aligned to at least _max_align, + * which defaults to 32. Load addresses are equal to virtual + * addresses. + */ + + _max_align = 32; + + /* Allow plenty of space for file headers */ + . = 0x1000; + + /* + * The text section + * + */ + + . = ALIGN ( _max_align ); + .text : { + _text = .; + *(.text) + *(.text.*) + _etext = .; + } + + /* + * The rodata section + * + */ + + . = ALIGN ( _max_align ); + .rodata : { + _rodata = .; + *(.rodata) + *(.rodata.*) + _erodata = .; + } + + /* + * The data section + * + */ + + . = ALIGN ( _max_align ); + .data : { + _data = .; + *(.data) + *(.data.*) + *(SORT(.tbl.*)) /* Various tables. See include/tables.h */ + _edata = .; + } + + /* + * The bss section + * + */ + + . = ALIGN ( _max_align ); + .bss : { + _bss = .; + *(.bss) + *(.bss.*) + *(COMMON) + _ebss = .; + } + + /* + * Weak symbols that need zero values if not otherwise defined + * + */ + + .weak 0x0 : { + _weak = .; + *(.weak) + _eweak = .; + } + _assert = ASSERT ( ( _weak == _eweak ), ".weak is non-zero length" ); + + /* + * Dispose of the comment and note sections to make the link map + * easier to read + * + */ + + /DISCARD/ : { + *(.comment) + *(.comment.*) + *(.note) + *(.note.*) + *(.eh_frame) + *(.eh_frame.*) + *(.rel) + *(.rel.*) + } +} diff --git a/src/arch/x86_64/Makefile.efi b/src/arch/x86_64/Makefile.efi index 9b9b373ff..928f5e92a 100644 --- a/src/arch/x86_64/Makefile.efi +++ b/src/arch/x86_64/Makefile.efi @@ -6,11 +6,11 @@ CFLAGS += -mno-red-zone # The EFI linker script # -LDSCRIPT = arch/x86_64/scripts/efi.lds +LDSCRIPT = arch/x86/scripts/efi.lds -# Use a relocatable link; we perform final relocations in the efilink utility. +# Retain relocation information for elf2efi # -LDFLAGS += -r -d -S +LDFLAGS += -q -S # Media types. # @@ -18,12 +18,6 @@ NON_AUTO_MEDIA += efi # Rule for building EFI files # -$(BIN)/%.efi.tmp-reloc : $(BIN)/%.efi.tmp $(EFILINK) - $(QM)$(ECHO) " [EFILINK] $@" - $(Q)# Check for unresolved symbols - $(Q)$(LD) -e 0 --no-warn-mismatch -o /dev/null $< - $(Q)$(EFILINK) $< $@ - -$(BIN)/%.efi : $(BIN)/%.efi.tmp-reloc +$(BIN)/%.efi : $(BIN)/%.efi.tmp $(ELF2EFI64) $(QM)$(ECHO) " [FINISH] $@" - $(Q)$(OBJCOPY) -Obinary $< $@ + $(Q)$(ELF2EFI64) $< $@ diff --git a/src/arch/x86_64/prefix/efiprefix.S b/src/arch/x86_64/prefix/efiprefix.S deleted file mode 100644 index a3b503b82..000000000 --- a/src/arch/x86_64/prefix/efiprefix.S +++ /dev/null @@ -1,174 +0,0 @@ - .text - .code32 - .arch i386 - .section ".prefix", "a", @progbits - .org 0x00 - - /* DOS (.com) header - * - * EFI executables seem to leave most of this empty - */ -mzhdr: - .ascii "MZ" /* Magic number */ - .word 0 /* Bytes on last page of file */ - .word 0 /* Pages in file */ - .word 0 /* Relocations */ - .word 0 /* Size of header in paragraphs */ - .word 0 /* Minimum extra paragraphs needed */ - .word 0 /* Maximum extra paragraphs needed */ - .word 0 /* Initial (relative) SS value */ - .word 0 /* Initial SP value */ - .word 0 /* "Checksum" */ - .word 0 /* Initial IP value */ - .word 0 /* Initial (relative) CS value */ - .word 0 /* File address of relocation table */ - .word 0 /* Ovesrlay number */ - .word 0, 0, 0, 0 /* Reserved words */ - .word 0 /* OEM identifier (for e_oeminfo) */ - .word 0 /* OEM information; e_oemid specific */ - .word 0, 0, 0, 0, 0 /* Reserved words */ - .word 0, 0, 0, 0, 0 /* Reserved words */ - .long pehdr_lma /* File address of new exe header */ - .size mzhdr, . - mzhdr - - /* PE header */ - .org 0xc0 /* For compatibility with MS toolchain */ -pehdr: - .ascii "PE\0\0" /* Magic number */ - .word 0x8664 /* CPU architecture: x86_64 */ - .word num_pe_sections /* Number of sections */ - .long 0x10d1a884 /* Timestamp */ - .long 0 /* Symbol table */ - .long 0 /* Number of symbols */ - .word opthdr_size /* Size of optional header */ - .word 0x2002 /* Characteristics */ - .size pehdr, . - pehdr - .equ pehdr_lma, pehdr - mzhdr - - /* "Optional" header */ -opthdr: - .word 0x020b /* Magic number */ - .byte 0 /* Linker major version number */ - .byte 0 /* Linker minor version number */ - .long _text_filesz /* Size of text section */ - .long _data_filesz /* Size of data section */ - .long _bss_filesz /* Size of bss section */ - .long efi_entry_lma /* Entry point */ - .long _text_lma /* Text section start RVA */ - .quad 0 /* Image base address */ - .long _max_align /* Section alignment */ - .long _max_align /* File alignment */ - .word 0 /* Operating system major version number */ - .word 0 /* Operating system minor version number */ - .word 0 /* Image major version number */ - .word 0 /* Image minor version number */ - .word 0 /* Subsystem major version number */ - .word 0 /* Subsystem minor version number */ - .long 0 /* Reserved */ - .long _filesz /* Total image size */ - .long _prefix_filesz /* Total header size */ - .long 0 /* "Checksum" */ - .word 0x0a /* Subsystem: EFI */ - .word 0 /* DLL characteristics */ - .quad 0 /* Size of stack reserve */ - .quad 0 /* Size of stack commit */ - .quad 0 /* Size of heap reserve */ - .quad 0 /* Size of heap commit */ - .long 0 /* Loader flags */ - .long 16 /* Number of data directory entries */ - .long 0, 0 /* Export directory */ - .long 0, 0 /* Import directory */ - .long 0, 0 /* Resource directory */ - .long 0, 0 /* Exception directory */ - .long 0, 0 /* Security directory */ - .long _reloc_lma, _reloc_filesz /* Base relocation directory */ - .long debugdir_lma, debugdir_size /* Debug directory */ - .long 0, 0 /* Description directory */ - .long 0, 0 /* Special directory */ - .long 0, 0 /* Thread storage directory */ - .long 0, 0 /* Load configuration directory */ - .long 0, 0 /* Bound import directory */ - .long 0, 0 /* Import address table directory */ - .long 0, 0 /* Delay import directory */ - .long 0, 0 /* Reserved */ - .long 0, 0 /* Reserved */ - .size opthdr, . - opthdr - .equ opthdr_size, . - opthdr - - /* PE sections */ -pe_sections: -text_section: - .asciz ".text" /* Section name */ - .align 8 - .long _text_filesz /* Section size */ - .long _text_lma /* Relative Virtual Address */ - .long _text_filesz /* Section size (rounded up) */ - .long _text_lma /* Pointer to raw data */ - .long 0 /* Link-time relocations */ - .long 0 /* Line numbers */ - .word 0 /* Number of link-time relocations */ - .word 0 /* Number of line numbers */ - .long 0x68000020 /* Characteristics */ -rodata_section: - .asciz ".rodata" /* Section name */ - .align 8 - .long _rodata_filesz /* Section size */ - .long _rodata_lma /* Relative Virtual Address */ - .long _rodata_filesz /* Section size (rounded up) */ - .long _rodata_lma /* Pointer to raw data */ - .long 0 /* Link-time relocations */ - .long 0 /* Line numbers */ - .word 0 /* Number of link-time relocations */ - .word 0 /* Number of line numbers */ - .long 0x48000040 /* Characteristics */ -data_section: - .asciz ".data" /* Section name */ - .align 8 - .long _data_filesz /* Section size */ - .long _data_lma /* Relative Virtual Address */ - .long _data_filesz /* Section size (rounded up) */ - .long _data_lma /* Pointer to raw data */ - .long 0 /* Link-time relocations */ - .long 0 /* Line numbers */ - .word 0 /* Number of link-time relocations */ - .word 0 /* Number of line numbers */ - .long 0xc8000040 /* Characteristics */ -reloc_section: - .asciz ".reloc" /* Section name */ - .align 8 - .long _reloc_filesz /* Section size */ - .long _reloc_lma /* Relative Virtual Address */ - .long _reloc_filesz /* Section size (rounded up) */ - .long _reloc_lma /* Pointer to raw data */ - .long 0 /* Link-time relocations */ - .long 0 /* Line numbers */ - .word 0 /* Number of link-time relocations */ - .word 0 /* Number of line numbers */ - .long 0x42000040 /* Characteristics */ - -pe_sections_end: - .size pe_sections, . - pe_sections - .equ num_pe_sections, ( ( . - pe_sections ) / 0x28 ) - - /* Debug directory */ - .section ".rodata" - .globl debugdir -debugdir: - .long 0 /* Characteristics */ - .long 0x10d1a884 /* Timestamp */ - .word 0 /* Major version */ - .word 0 /* Minor version */ - .long 0x02 /* RSDS? */ - .long codeview_rsds_size /* Size of data */ - .long codeview_rsds_lma /* RVA */ - .long codeview_rsds_lma /* File offset */ - .size debugdir, . - debugdir - .equ debugdir_size, . - debugdir - /* Codeview structure */ - .globl codeview_rsds -codeview_rsds: - .ascii "RSDS" /* Magic number */ - .long 0, 0, 0, 0, 0 /* Unused by EFI */ - .asciz "efiprefix.pdb" - .size codeview_rsds, . - codeview_rsds - .equ codeview_rsds_size, . - codeview_rsds diff --git a/src/arch/x86_64/scripts/efi.lds b/src/arch/x86_64/scripts/efi.lds deleted file mode 100644 index 833905c93..000000000 --- a/src/arch/x86_64/scripts/efi.lds +++ /dev/null @@ -1,180 +0,0 @@ -/* -*- sh -*- */ - -/* - * Linker script for EFI images - * - */ - -EXTERN ( efi_entry ) - -SECTIONS { - - /* The file starts at a virtual address of zero, and sections are - * contiguous. Each section is aligned to at least _max_align, - * which defaults to 32. Load addresses are equal to virtual - * addresses. - */ - - . = 0; - _max_align = 32; - - /* - * The prefix - * - */ - - .prefix : { - _prefix = .; - *(.prefix) - *(.prefix.*) - _mprefix = .; - } .bss.prefix (NOLOAD) : { - _eprefix = .; - } - _prefix_filesz = ABSOLUTE ( _mprefix - _prefix ); - _prefix_memsz = ABSOLUTE ( _eprefix - _prefix ); - - /* - * The text section - * - */ - - . = ALIGN ( _max_align ); - .text : { - _text = .; - *(.text) - *(.text.*) - _mtext = .; - } .bss.text (NOLOAD) : { - _etext = .; - } - _text_filesz = ABSOLUTE ( _mtext - _text ); - _text_memsz = ABSOLUTE ( _etext - _text ); - - /* - * The rodata section - * - */ - - . = ALIGN ( _max_align ); - .rodata : { - _rodata = .; - *(.rodata) - *(.rodata.*) - _mrodata = .; - } .bss.rodata (NOLOAD) : { - _erodata = .; - } - _rodata_filesz = ABSOLUTE ( _mrodata - _rodata ); - _rodata_memsz = ABSOLUTE ( _erodata - _rodata ); - - /* - * The data section - * - */ - - . = ALIGN ( _max_align ); - .data : { - _data = .; - *(.data) - *(.data.*) - *(SORT(.tbl.*)) /* Various tables. See include/tables.h */ - /* EFI seems to not support proper bss sections */ - *(.bss) - *(.bss.*) - *(COMMON) - *(.stack) - *(.stack.*) - _mdata = .; - } .bss.data (NOLOAD) : { - _edata = .; - } - _data_filesz = ABSOLUTE ( _mdata - _data ); - _data_memsz = ABSOLUTE ( _edata - _data ); - - /* - * The bss section - * - */ - - . = ALIGN ( _max_align ); - .bss : { - _bss = .; - /* EFI seems to not support proper bss sections */ - _mbss = .; - } .bss.bss (NOLOAD) : { - _ebss = .; - } - _bss_filesz = ABSOLUTE ( _mbss - _bss ); - _bss_memsz = ABSOLUTE ( _ebss - _bss ); - - /* - * The reloc section - * - */ - - . = ALIGN ( _max_align ); - .reloc : { - _reloc = .; - /* Provide some dummy contents to force ld to include this - * section. It will be created by the efilink utility. - */ - BYTE(0); - _mreloc = .; - } .bss.reloc (NOLOAD) : { - _ereloc = .; - } - _reloc_filesz = ABSOLUTE ( _mreloc - _reloc ); - _reloc_memsz = ABSOLUTE ( _ereloc - _reloc ); - - _filesz = ABSOLUTE ( . ); - - /* - * Weak symbols that need zero values if not otherwise defined - * - */ - - .weak 0x0 : { - _weak = .; - *(.weak) - _eweak = .; - } - _assert = ASSERT ( ( _weak == _eweak ), ".weak is non-zero length" ); - - /* - * Dispose of the comment and note sections to make the link map - * easier to read - * - */ - - /DISCARD/ : { - *(.comment) - *(.comment.*) - *(.note) - *(.note.*) - *(.eh_frame) - *(.eh_frame.*) - *(.rel) - *(.rel.*) - } - - /* - * Load address calculations. - * - */ - - _prefix_lma = ABSOLUTE ( _prefix ); - _text_lma = ABSOLUTE ( _text ); - _rodata_lma = ABSOLUTE ( _rodata ); - _data_lma = ABSOLUTE ( _data ); - _bss_lma = ABSOLUTE ( _bss ); - _reloc_lma = ABSOLUTE ( _reloc ); - - /* - * Load addresses required by the prefix - * - */ - efi_entry_lma = ABSOLUTE ( efi_entry ); - debugdir_lma = ABSOLUTE ( debugdir ); - codeview_rsds_lma = ABSOLUTE ( codeview_rsds ); -} |
