diff --git a/dxe/Makefile b/dxe/Makefile index 2c2582b..dfb6642 100644 --- a/dxe/Makefile +++ b/dxe/Makefile @@ -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) \ diff --git a/dxe/elf_x86_64_efi.lds b/dxe/elf_x86_64_efi.lds new file mode 100644 index 0000000..70c41b6 --- /dev/null +++ b/dxe/elf_x86_64_efi.lds @@ -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) } +} diff --git a/dxe/linuxboot.c b/dxe/linuxboot.c index bf2670b..38c4999 100644 --- a/dxe/linuxboot.c +++ b/dxe/linuxboot.c @@ -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; } diff --git a/dxe/pei-x86-32.lds b/dxe/pei-x86-32.lds deleted file mode 100644 index 427ad01..0000000 --- a/dxe/pei-x86-32.lds +++ /dev/null @@ -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*) - } -} diff --git a/dxe/pei-x86-64.lds b/dxe/pei-x86-64.lds deleted file mode 100644 index 00b1881..0000000 --- a/dxe/pei-x86-64.lds +++ /dev/null @@ -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*) - } -}