Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
97 changes: 94 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,16 +58,107 @@ jobs:
uses: rlalik/setup-cpp-compiler@master
with:
compiler: ${{ matrix.compiler }}
- name: default build
- name: default build with -g
env:
CC: ${{ steps.install_cc.outputs.cc }}
run: make -j$(nproc)
run: make OPT_LEVEL=-g -j$(nproc)
if: ${{ always() }}
- name: default build with -Og
env:
CC: ${{ steps.install_cc.outputs.cc }}
run: |
make distclean
make OPT_LEVEL=-Og -j$(nproc)
if: ${{ always() }}
- name: default build with -O0
env:
CC: ${{ steps.install_cc.outputs.cc }}
run: |
make distclean
make OPT_LEVEL=-O0 -j$(nproc)
if: ${{ always() }}
- name: default build with -O1
env:
CC: ${{ steps.install_cc.outputs.cc }}
run: |
make distclean
make OPT_LEVEL=-O1 -j$(nproc)
if: ${{ always() }}
- name: default build with -O2
env:
CC: ${{ steps.install_cc.outputs.cc }}
run: |
make distclean
make OPT_LEVEL=-O2 -j$(nproc)
if: ${{ always() }}
- name: default build with -O3
env:
CC: ${{ steps.install_cc.outputs.cc }}
run: |
make distclean
make OPT_LEVEL=-O3 -j$(nproc)
if: ${{ always() }}
- name: default build with -Ofast
env:
CC: ${{ steps.install_cc.outputs.cc }}
run: |
make distclean
make OPT_LEVEL=-Ofast -j$(nproc)
if: ${{ always() }}
- name: default build for system emulation with -g
env:
CC: ${{ steps.install_cc.outputs.cc }}
run: |
make distclean
make OPT_LEVEL=-g ENABLE_SYSTEM=1 -j$(nproc)
if: ${{ always() }}
- name: default build for system emulation with -Og
env:
CC: ${{ steps.install_cc.outputs.cc }}
run: |
make distclean
make OPT_LEVEL=-Og ENABLE_SYSTEM=1 -j$(nproc)
if: ${{ always() }}
- name: default build for system emulation with -O0
env:
CC: ${{ steps.install_cc.outputs.cc }}
run: |
make distclean
make OPT_LEVEL=-O0 ENABLE_SYSTEM=1 -j$(nproc)
if: ${{ always() }}
- name: default build for system emulation with -O1
env:
CC: ${{ steps.install_cc.outputs.cc }}
run: |
make distclean
make OPT_LEVEL=-O1 ENABLE_SYSTEM=1 -j$(nproc)
if: ${{ always() }}
- name: default build for system emulation with -O2
env:
CC: ${{ steps.install_cc.outputs.cc }}
run: |
make distclean
make OPT_LEVEL=-O2 ENABLE_SYSTEM=1 -j$(nproc)
if: ${{ always() }}
- name: default build for system emulation with -O3
env:
CC: ${{ steps.install_cc.outputs.cc }}
run: |
make distclean
make OPT_LEVEL=-O3 ENABLE_SYSTEM=1 -j$(nproc)
if: ${{ always() }}
- name: default build for system emulation with -Ofast
env:
CC: ${{ steps.install_cc.outputs.cc }}
run: |
make distclean
make OPT_LEVEL=-Ofast ENABLE_SYSTEM=1 -j$(nproc)
Copy link
Collaborator

@RinHizakura RinHizakura Jan 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if we need to take care of -Os or even just retain the presentative -O level only, otherwise the possible options may be too many. Will let @jserv decide this.

Copy link
Collaborator Author

@ChinYikMing ChinYikMing Jan 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One more -Oz can be the candidate. It is related to size just like -Os. Thus, not embracing them at first.

if: ${{ always() }}
- name: check + tests
env:
CC: ${{ steps.install_cc.outputs.cc }}
run: |
make clean
make distclean
make check -j$(nproc)
make tests -j$(nproc)
make misalign -j$(nproc)
Expand Down
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ BIN := $(OUT)/rv32emu
CONFIG_FILE := $(OUT)/.config
-include $(CONFIG_FILE)

CFLAGS = -std=gnu99 -O2 -Wall -Wextra -Werror
OPT_LEVEL ?= -O2

CFLAGS = -std=gnu99 $(OPT_LEVEL) -Wall -Wextra -Werror
CFLAGS += -Wno-unused-label
CFLAGS += -include src/common.h -Isrc/

Expand Down
2 changes: 1 addition & 1 deletion mk/system.mk
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ DEV_OBJS := $(patsubst $(DEV_SRC)/%.c, $(DEV_OUT)/%.o, $(wildcard $(DEV_SRC)/*.c
deps := $(DEV_OBJS:%.o=%.o.d)

OBJS_EXT += system.o
OBJS_EXT += dtc/libfdt/fdt.o dtc/libfdt/fdt_ro.o dtc/libfdt/fdt_rw.o
OBJS_EXT += dtc/libfdt/fdt.o dtc/libfdt/fdt_ro.o dtc/libfdt/fdt_rw.o dtc/libfdt/fdt_wip.o

# system target execution by using default dependencies
LINUX_IMAGE_DIR := linux-image
Expand Down
Loading