Maze works at -O2 with -fpeel-loops

This commit is contained in:
Toby Jaffey 2025-12-11 01:33:04 +00:00
parent a55300c8c3
commit 8802b4c268
2 changed files with 5 additions and 4 deletions

View file

@ -1,9 +1,9 @@
PREFIX:=riscv64-elf- PREFIX:=riscv64-elf-
OPT ?= -Os OPT ?= -Os
CFLAGS+=-I${TOPDIR}/common CFLAGS+=-I${TOPDIR}/common
CFLAGS+=-fno-stack-protector -fno-builtin-memcpy -fno-builtin CFLAGS+=${OPT} -fno-stack-protector -fno-builtin-memcpy -fno-builtin
CFLAGS+=-static-libgcc -fdata-sections -ffunction-sections CFLAGS+=-static-libgcc -fdata-sections -ffunction-sections
CFLAGS+=-g ${OPT} -march=rv32im -mabi=ilp32 -static CFLAGS+=-g -march=rv32im -mabi=ilp32 -static
LDFLAGS:= -T ${TOPDIR}/apps/linker.ld -nostdlib -Wl,--gc-sections LDFLAGS:= -T ${TOPDIR}/apps/linker.ld -nostdlib -Wl,--gc-sections
LIBS:= -lgcc # needed for softfp LIBS:= -lgcc # needed for softfp
@ -22,7 +22,7 @@ else
endif endif
all_common: all_common:
@${PREFIX}gcc -o ${PROJECT}.elf ${CFLAGS} ${LDFLAGS} ${SRCS} ${LIBS} ${PREFIX}gcc -o ${PROJECT}.elf ${CFLAGS} ${LDFLAGS} ${SRCS} ${LIBS}
@$(PREFIX)objcopy ${PROJECT}.elf -O binary ${PROJECT}.bin @$(PREFIX)objcopy ${PROJECT}.elf -O binary ${PROJECT}.bin
disasm_common: all disasm_common: all

View file

@ -1,7 +1,8 @@
TOPDIR=../../ TOPDIR=../../
PROJECT:=$(shell basename ${PWD}) PROJECT:=$(shell basename ${PWD})
SRCS=${PROJECT}.c ${TOPDIR}/apps/crt0.S SRCS=${PROJECT}.c ${TOPDIR}/apps/crt0.S
OPT=-O0 OPT=-O2
CFLAGS+=-fpeel-loops
all: all_common all: all_common
test: test_common test: test_common
clean: clean_common clean: clean_common