Skip to content

Commit

Permalink
arch/riscv: Move -mcmodel=medany from Make.defs to Toolchain.defs
Browse files Browse the repository at this point in the history
to avoid the code duplication

Signed-off-by: Xiang Xiao <[email protected]>
  • Loading branch information
xiaoxiang781216 authored and pussuw committed Sep 25, 2023
1 parent b12c01c commit a4ee2da
Show file tree
Hide file tree
Showing 7 changed files with 3 additions and 33 deletions.
4 changes: 3 additions & 1 deletion arch/risc-v/src/common/Toolchain.defs
Original file line number Diff line number Diff line change
Expand Up @@ -183,12 +183,14 @@ ifeq ($(CONFIG_RISCV_TOOLCHAIN),GNU_RVG)
ARCHTYPE = rv64
ARCHABITYPE = lp64
LLVM_ARCHTYPE := riscv64
# https://www.sifive.com/blog/all-aboard-part-4-risc-v-code-models
ARCHCPUFLAGS = -mcmodel=medany
endif

# Construct arch flags

ARCHCPUEXTFLAGS = i$(ARCHRVISAM)$(ARCHRVISAA)$(ARCHRVISAF)$(ARCHRVISAD)$(ARCHRVISAC)$(ARCHRVISAZ)
ARCHCPUFLAGS = -march=$(ARCHTYPE)$(ARCHCPUEXTFLAGS)
ARCHCPUFLAGS += -march=$(ARCHTYPE)$(ARCHCPUEXTFLAGS)

# Construct arch abi flags

Expand Down
9 changes: 0 additions & 9 deletions boards/risc-v/c906/smartl-c906/scripts/Make.defs
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,8 @@ ifeq ($(CONFIG_C906_WITH_QEMU),y)
else
LDSCRIPT = ld.script
endif

ARCHSCRIPT += $(BOARD_DIR)$(DELIM)scripts$(DELIM)$(LDSCRIPT)

# The following options are for the toolchain from T-HEAD.
# For more info ahout the T-HEAD ISA extensions, please refer to the C906 user guide.
# ARCHCPUFLAGS = -march=rv64gcxthead -mabi=lp64d -mtune=c906 -mcmodel=medany
# TODO: We are not going to enable this at this time for the CI compatibility.

ARCHCPUFLAGS += -mcmodel=medany


CFLAGS = $(ARCHCFLAGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS) -pipe
CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS) -pipe
Expand Down
2 changes: 0 additions & 2 deletions boards/risc-v/jh7110/star64/scripts/Make.defs
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ include $(TOPDIR)/arch/risc-v/src/common/Toolchain.defs

LDSCRIPT = ld.script
ARCHSCRIPT += $(BOARD_DIR)$(DELIM)scripts$(DELIM)$(LDSCRIPT)

ARCHCPUFLAGS += -mcmodel=medany
ARCHPICFLAGS = -fpic -msingle-pic-base

CFLAGS := $(ARCHCFLAGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS) -pipe
Expand Down
2 changes: 0 additions & 2 deletions boards/risc-v/k210/maix-bit/scripts/Make.defs
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ include $(TOPDIR)/arch/risc-v/src/common/Toolchain.defs
LDSCRIPT = ld.script
ARCHSCRIPT += $(BOARD_DIR)$(DELIM)scripts$(DELIM)$(LDSCRIPT)

ARCHCPUFLAGS += -mcmodel=medany -mstrict-align

CFLAGS := $(ARCHCFLAGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS) -pipe
CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
CXXFLAGS := $(ARCHCXXFLAGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS) -pipe
Expand Down
8 changes: 0 additions & 8 deletions boards/risc-v/mpfs/icicle/scripts/Make.defs
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,6 @@ ifneq ($(LDMEMORY),)
endif
ARCHSCRIPT += $(BOARD_DIR)$(DELIM)scripts$(DELIM)$(LDSCRIPT)

# The following options are for the toolchain from T-HEAD.
# For more info ahout the T-HEAD ISA extensions, please refer to the MPFS user guide.
# ARCHCPUFLAGS = -march=rv64gcxthead -mabi=lp64d -mcmodel=medany
# TODO: We are not going to enable this at this time for the CI compatibility.

ARCHCPUFLAGS += -mcmodel=medany


CFLAGS = $(ARCHCFLAGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS) -pipe
CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS) -pipe
Expand Down
9 changes: 0 additions & 9 deletions boards/risc-v/mpfs/m100pfsevp/scripts/Make.defs
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,8 @@ ifeq ($(CONFIG_MPFS_BOOTLOADER),y)
else
LDSCRIPT = ld.script
endif

ARCHSCRIPT += $(BOARD_DIR)$(DELIM)scripts$(DELIM)$(LDSCRIPT)

# The following options are for the toolchain from T-HEAD.
# For more info ahout the T-HEAD ISA extensions, please refer to the MPFS user guide.
# ARCHCPUFLAGS = -march=rv64gcxthead -mabi=lp64d -mcmodel=medany
# TODO: We are not going to enable this at this time for the CI compatibility.

ARCHCPUFLAGS += -mcmodel=medany


CFLAGS = $(ARCHCFLAGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS) -pipe
CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS) -pipe
Expand Down
2 changes: 0 additions & 2 deletions boards/risc-v/qemu-rv/rv-virt/scripts/Make.defs
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ endif
endif

ARCHSCRIPT += $(BOARD_DIR)$(DELIM)scripts$(DELIM)$(LDSCRIPT)

ARCHCPUFLAGS += -mcmodel=medany
ARCHPICFLAGS = -fpic -msingle-pic-base

CFLAGS := $(ARCHCFLAGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS) -pipe
Expand Down

0 comments on commit a4ee2da

Please sign in to comment.