diff options
Diffstat (limited to 'efi_memtest/Makefile')
-rw-r--r-- | efi_memtest/Makefile | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/efi_memtest/Makefile b/efi_memtest/Makefile index 24d0875..ed061bd 100644 --- a/efi_memtest/Makefile +++ b/efi_memtest/Makefile @@ -3,15 +3,26 @@ MAIN_FILE = MemtestEfi CC = gcc # Treat all warnings as errors -#CFLAGS = -Werror +#CFLAGS = -Werror +CFLAGS += -Wall +# Warnings not covered by Wall +CFLAGS += -Wextra +CFLAGS += -Wshadow +CFLAGS += -Wdouble-promotion +CFLAGS += -Wformat=2 -Wformat-truncation -Wformat-overflow +CFLAGS += -Wundef # for undefined macros +#CFLAGS += -Wno-array-bounds +CFLAGS += -Wconversion +CFLAGS += -Wpadded -CFLAGS += -Wall -Wno-array-bounds CFLAGS += -fno-builtin +CFLAGS += -ffunction-sections # Each functions gets own section. Unused sections can be culled at a final optimization + # EFI requires -fshort-wchar CFLAGS += -fshort-wchar -CFLAGS += -fno-common +CFLAGS += -fno-common # Disabled the ability for tentative definitions to be merged into a pre-existing definition CFLAGS += -fno-strict-aliasing # EFI uses Microsoft ABI so no red zone is defined @@ -74,7 +85,10 @@ BaseLib_OBJS=ARShiftU64.o BitField.o CheckSum.o CpuDeadLoop.o Cpu.o DivU64x64Rem LIBRARIES=MemtestEfi.lib -debug: CFLAGS += -g +debug: CFLAGS += -g3 +debug: CFLAGS += -fstack-usage # emit .su (stack usage) files for each c file you compile +debug: CFLAGS += -Wstack-usage=255 +debug: CFLAGS += -Werror debug: all release: #CFLAGS += -flto @@ -89,11 +103,11 @@ $(MAIN_FILE).efi: $(MAIN_FILE).dll ./memtest86+/efi/Include/GenFw -e UEFI_APPLICATION -o $(MAIN_FILE).efi $(MAIN_FILE).dll #objcopy --add-gnu-debuglink=MemtestEfi.debug MemtestEfi.efi - +# gc-sections culls unused sections $(MAIN_FILE).dll: $(MAIN_FILE).lib $(CC) $(CFLAGS) $(PREPROCESSOR) $(M) $(LIBRARIES) -o $(MAIN_FILE).dll \ -nostdlib \ - -Wl,-n,-q,--gc-sections \ + -Wl,-n,-q,--gc-sections,--print-gc-sections \ -Wl,--entry,_ModuleEntryPoint \ -Wl,-Map,$(MAIN_FILE).map,--whole-archive \ -Wl,-melf_x86_64,--oformat=elf64-x86-64,-pie \ |