linuxboot bds makes it to the end using the gnu-efi lds script

This commit is contained in:
Trammell hudson 2018-05-07 16:03:14 -04:00 committed by Trammell Hudson
parent 85c67c1d84
commit 4cf7d4974a
Failed to extract signature
5 changed files with 81 additions and 61 deletions

View File

@ -21,7 +21,7 @@ FORCE:
%.exe: %.o
$(CROSS)ld \
$(LDFLAGS) \
-T pei-x86-64.lds \
-T elf_x86_64_efi.lds \
-o $@ \
$^
@ -30,6 +30,8 @@ FORCE:
%.efi: %.exe
objcopy \
-j .text -j .sdata -j .data -j .dynamic \
-j .dynsym -j .rel -j .rela -j .reloc \
--subsystem efi-bsd \
--target efi-app-$(EFI_ARCH) \
$^ \
@ -66,6 +68,8 @@ CFLAGS += \
LDFLAGS += \
-nostdlib \
-znocombreloc \
-shared \
-Bsymbolic \
NO_LFLAGS += \
-T $(EFI_LDS) \

74
dxe/elf_x86_64_efi.lds Normal file
View File

@ -0,0 +1,74 @@
/* Same as elf_x86_64_fbsd_efi.lds, except for OUTPUT_FORMAT below - KEEP IN SYNC */
OUTPUT_FORMAT("elf64-x86-64", "elf64-x86-64", "elf64-x86-64")
OUTPUT_ARCH(i386:x86-64)
ENTRY(efi_main)
SECTIONS
{
. = 0;
ImageBase = .;
.hash : { *(.hash) } /* this MUST come first! */
. = ALIGN(4096);
.eh_frame :
{
*(.eh_frame)
}
. = ALIGN(4096);
.text :
{
_text = .;
*(.text)
*(.text.*)
*(.gnu.linkonce.t.*)
. = ALIGN(16);
}
_etext = .;
_text_size = . - _text;
. = ALIGN(4096);
.reloc :
{
*(.reloc)
}
. = ALIGN(4096);
.data :
{
_data = .;
*(.rodata*)
*(.got.plt)
*(.got)
*(.data*)
*(.sdata)
/* the EFI loader doesn't seem to like a .bss section, so we stick
it all into .data: */
*(.sbss)
*(.scommon)
*(.dynbss)
*(.bss)
*(COMMON)
*(.rel.local)
}
.note.gnu.build-id : { *(.note.gnu.build-id) }
_edata = .;
_data_size = . - _etext;
. = ALIGN(4096);
.dynamic : { *(.dynamic) }
. = ALIGN(4096);
.rela :
{
*(.rela.data*)
*(.rela.got)
*(.rela.stab)
}
. = ALIGN(4096);
.dynsym : { *(.dynsym) }
. = ALIGN(4096);
.dynstr : { *(.dynstr) }
. = ALIGN(4096);
.ignored.reloc :
{
*(.rela.reloc)
*(.eh_frame)
*(.note.GNU-stack)
}
.comment 0 : { *(.comment) }
}

View File

@ -265,7 +265,7 @@ efi_main(
serial_string("| |\r\n");
serial_string("+--------------------+\r\n");
(void) image;
(void) image; // should we call loaded image protocol?
gST = st;
gBS = gST->BootServices;
gRT = gST->RuntimeServices;
@ -295,5 +295,6 @@ efi_main(
&efi_bds_arch_protocol
);
serial_string("waiting for callback\r\n");
return 0;
}

View File

@ -1,30 +0,0 @@
OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386")
/*OUTPUT_FORMAT("pei-x86-64", "pei-x86-64", "pei-x86-64") */
OUTPUT_ARCH(i386)
ENTRY(efi_main)
SECTIONS
{
/* 0x1e0 is the size of the MZ header that will be added by gcc */
.text 0x1e0 :
{
*(.text)
}
.data :
{
*(.rodata*)
*(.data*)
/* the EFI loader doesn't seem to like a .bss section, so we stick
it all into .data: */
*(.bss)
}
/DISCARD/ :
{
*(.xdata*)
*(.idata*)
*(.pdata*)
*(.comment)
*(.eh_fram*)
}
}

View File

@ -1,29 +0,0 @@
OUTPUT_FORMAT("elf64-x86-64", "elf64-x86-64", "elf64-x86-64")
/*OUTPUT_FORMAT("pei-x86-64", "pei-x86-64", "pei-x86-64") */
OUTPUT_ARCH(i386:x86-64)
ENTRY(efi_main)
SECTIONS
{
.text 0x1000 :
{
*(.text)
}
.data :
{
*(.rodata*)
*(.data*)
/* the EFI loader doesn't seem to like a .bss section, so we stick
it all into .data: */
*(.bss)
}
/DISCARD/ :
{
*(.xdata*)
*(.idata*)
*(.pdata*)
*(.comment)
*(.eh_fram*)
}
}