diff options
Diffstat (limited to 'debugging_demo/Makefile')
-rw-r--r-- | debugging_demo/Makefile | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/debugging_demo/Makefile b/debugging_demo/Makefile index c34dbca..8dd5162 100644 --- a/debugging_demo/Makefile +++ b/debugging_demo/Makefile @@ -8,7 +8,9 @@ CFLAGS += -fno-builtin # EFI requires -fshort-wchar CFLAGS += -fshort-wchar CFLAGS += -fno-common -CFLAGS += -fno-strict-aliasing -g +CFLAGS += -fno-strict-aliasing +# Enable debug info generation at compile time +CFLAGS += -g # EFI uses Microsoft ABI so no red zone is defined CFLAGS += -mno-red-zone @@ -17,10 +19,10 @@ CFLAGS += -fpie #CFLAGS += -fno-pie -no-pie -static # the UEFI PE executables must be relocatable -CFLAGS += -fPIC +CFLAGS += -fpic CFLAGS += -ffunction-sections CFLAGS += -fdata-sections -CFLAGS += -flto +# CFLAGS += -flto !!Do not use it. All is written to special ELF sections # function calls must include the number of arguments passed to the functions CFLAGS += -maccumulate-outgoing-args @@ -64,16 +66,15 @@ SECTIONS=.text .sdata .data .dynamic .dynsym .rel .rela .reloc all: clean MemtestEfi.efi move run -MemtestEfi.efi: OUTPUT/MemtestEfi.so +MemtestEfi.efi: MemtestEfi.so objcopy $(foreach sec,$(SECTIONS), -j $(sec)) --target=pei-x86-64 --subsystem=10 $< $@ -OUTPUT/$(MAIN_FILE).so: $(OBJS) - ld -shared -Bsymbolic -Telf_x86_64_efi.lds -o $@ $^ +$(MAIN_FILE).so: $(OBJS) + ld -shared -Bsymbolic -fuse-linker-plugin -Telf_x86_64_efi.lds -o $@ $^ #rm $^ $(MAIN_FILE).o: $(MAIN_FILE).c $(CC) $(CFLAGS) $(PREPROCESSOR) $(M) -c -o $@ $< \ - -include memtest86+/efi/Include/Efi_Defs.h \ -I . \ -I"memtest86+" \ -I"memtest86+/efi/Include" @@ -134,7 +135,7 @@ BasePrintLib.o: PrintLib.o PrintLibInternal.o rm $^ %.o: memtest86+/efi/Include/src/UefiDevicePathLib/%.c - $(CC) $(CFLAGS) $(PREPROCESSOR) $(M) -c -o $@ $< \ + $(CC) $(CFLAGS) $(PREPROCESSOR) -flto $(M) -c -o $@ $< \ -I"memtest86+/efi/Include" UefiDevicePathLib2.o: $(UefiDevicePathLib_OBJS) @@ -156,15 +157,14 @@ BaseLib.o: $(BaseLib_OBJS) -I"memtest86+/efi/Include" clean: - rm -f OUTPUT/* rm -f memtest86+/*.o rm -f *.o - rm -f MemtestEfi.obj + rm -f MemtestEfi.o rm -f MemtestEfi.map rm -f MemtestEfi.dll rm -f MemtestEfi.efi rm -f MemtestEfi.txt - rm -f Efi_Defs.obj + rm -f Efi_Defs.o move: |