# SPDX-License-Identifier: GPL-2.0-only OR License-Ref-kk-custom
#
# Copyright (C) 2023 Kernkonzept GmbH.
# Author(s): Georg Kotheimer <georg.kotheimer@kernkonzept.com>

GENERIC_BUILTINS_SRC += $(GENERIC_SOURCES_TF)

BUILTINS_SRC = riscv/save.S riscv/restore.S

ifeq ($(BITS),32)
  BUITINS_FLAGS += -fforce-enable-int128
  BUILTINS_SRC += riscv/mulsi3.S
endif

ifeq ($(BITS),64)
  BUILTINS_SRC += riscv/muldi3.S
endif

# Clang >= 16
ifneq ($(call libclang_rt_if_min_version,16),)
  BUILTINS_SRC += riscv/fp_mode.c
endif

# Clang >= 20
ifneq ($(call libclang_rt_if_min_version,16),)
  BUILTINS_SRC += cpu_model/riscv.c
endif
