<commit_before># Target architecture for the build.
TARGET_ARCH_RISCV ?= riscv-none-elf

# If TARGET_ARCH wasn't set by user, also check if riscv64-unknown-elf
# or riscv-none-embed is present.
ifeq (riscv-none-elf,$(TARGET_ARCH_RISCV))
  ifeq (,$(shell which $(TARGET_ARCH_RISCV)-gcc))
    ifneq (,$(shell which riscv64-unknown-elf-gcc))
      TARGET_ARCH_RISCV := riscv64-unknown-elf
    else ifneq (,$(shell which riscv-none-embed-gcc))
      $(info Falling back to legacy riscv-none-embed toolchain)
      TARGET_ARCH_RISCV := riscv-none-embed
    endif
  endif
endif

TARGET_ARCH ?= $(TARGET_ARCH_RISCV)

# define build specific options
CFLAGS_CPU   = -march=rv32imac -mabi=ilp32 -mcmodel=medlow -msmall-data-limit=8
CFLAGS_LINK  = -nostartfiles -ffunction-sections -fdata-sections<commit_msg>makefiles/arch/riscv.inc.mk: Detect target triple<commit_after># Target architecture for the build.

# The correct triple for 32 bit embedded RISC-V targets is "riscv32-none-elf".
# However, is unknown is used as sys (in place of none), it will also fall back
# to none. Finally, if the GCC RISC-V cross compiler is compiled with full
# multilib support, it can create both 32 bit and 64 bit binaries. Often this is
# indicated with "riscv" being used instead of "riscv32/riscv64", but e.g.
# Ubuntu uses "riscv64-unknown-elf" despite being able to produce both 32 and
# 64 bit binaries. We'll test all possible combinations from the most correct
# triple to the least correct triple all that might be able to produce our
# binaries. Finally, "riscv-none-embed" is also tested for compatibility with
# an previously popular legacy toolchain.

_TRIPLES_TO_TEST := \
    riscv32-none-elf \
    riscv-none-elf \
    riscv32-unknown-elf \
    riscv-unknown-elf \
    riscv64-none-elf \
    riscv64-unknown-elf \
    riscv-none-embed

TARGET_ARCH_RISCV ?= \
  $(strip \
    $(subst -gcc,,\
      $(notdir \
        $(word 1,\
          $(foreach triple,$(_TRIPLES_TO_TEST),$(shell which $(triple)-gcc))))))

TARGET_ARCH ?= $(TARGET_ARCH_RISCV)

# define build specific options
CFLAGS_CPU   = -march=rv32imac -mabi=ilp32 -mcmodel=medlow -msmall-data-limit=8
CFLAGS_LINK  = -nostartfiles -ffunction-sections -fdata-sections
{'fraction_non_alphanumeric': 0.10388437217705511, 'fraction_numerical': 0.01942186088527552, 'mean_word_length': 3.8152173913043477, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '786619', 'n_tokens_mistral': 777, 'n_tokens_neox': 753, 'n_words': 224}