diff --git a/.gitignore b/.gitignore index 7f79717..188fde0 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ +*.sw? +*~ *.efi *.efi.debug *.o @@ -5,3 +7,9 @@ *.so *.tar.* *.tar +/aarch64/ +/arm/ +/ia32/ +/ia64/ +/mips64el/ +/x86_64/ diff --git a/Make.defaults b/Make.defaults index cf7a88e..5b0c690 100755 --- a/Make.defaults +++ b/Make.defaults @@ -180,6 +180,9 @@ EFI_CFLAGS += -std=c11 ifeq ($(ARCH),x86_64) ifeq ($(GCCNEWENOUGH),1) EFI_CFLAGS += -DGNU_EFI_USE_MS_ABI + ifeq ($(GNU_EFI_EXPORT_MS_ABI),1) + EFI_CFLAGS += -mabi=ms -DGNU_EFI_EXPORT_MS_ABI + endif ifneq ($(USING_CLANG),clang) EFI_CFLAGS += -maccumulate-outgoing-args endif @@ -270,12 +273,17 @@ ifeq ($(IS_MINGW32),) EFI_CFLAGS += -fPIC endif +OPTIMIZATION_CFLAGS ?= -O2 +DEBUG_CFLAGS ?= -g + ifeq ($(USING_FREEBSD),1) -EFI_CFLAGS += $(ARCH3264) -g -O2 -Wall -Wextra -Wstrict-prototypes -Werror \ +EFI_CFLAGS += $(ARCH3264) $(OPTIMIZATION_CFLAGS) $(DEBUG_CFLAGS) \ + -Wall -Wextra -Wstrict-prototypes -Werror \ -fno-strict-aliasing \ -ffreestanding -fno-stack-protector else -EFI_CFLAGS += $(ARCH3264) -g -O2 -Wall -Wextra -Wstrict-prototypes -Werror \ +EFI_CFLAGS += $(ARCH3264) $(OPTIMIZATION_CFLAGS) $(DEBUG_CFLAGS) \ + -Wall -Wextra -Wstrict-prototypes -Werror \ -fno-strict-aliasing \ -ffreestanding -fno-stack-protector \ $(if $(findstring 0,$(USING_CLANG)),-fno-merge-all-constants,) diff --git a/gnuefi/crt0-efi-x86_64.S b/gnuefi/crt0-efi-x86_64.S index b393a18..7ffd316 100644 --- a/gnuefi/crt0-efi-x86_64.S +++ b/gnuefi/crt0-efi-x86_64.S @@ -40,6 +40,28 @@ .globl _start .type _start,%function _start: + +#if defined(GNU_EFI_EXPORT_MS_ABI) + pushq %rsi + movq %rdx, %rsi + pushq %rbx + movq %rcx, %rbx + movq %rdx, %r9 + movq %rcx, %r8 + subq $40, %rsp + + lea _DYNAMIC(%rip), %rdx + lea ImageBase(%rip), %rcx + call _relocate + + addq $40, %rsp + movq %rsi, %rdx + movq %rbx, %rcx + popq %rbx + popq %rsi + jmp _entry + nop +#else subq $8, %rsp pushq %rcx pushq %rdx @@ -59,6 +81,7 @@ _start: call _entry addq $8, %rsp +#endif .L_exit: ret diff --git a/lib/.gitignore b/lib/.gitignore new file mode 100644 index 0000000..eee4ded --- /dev/null +++ b/lib/.gitignore @@ -0,0 +1 @@ +ms_va_print.c