162306a36Sopenharmony_ci# SPDX-License-Identifier: GPL-2.0
262306a36Sopenharmony_ci#  Makefile for the Hexagon arch
362306a36Sopenharmony_ci
462306a36Sopenharmony_ciKBUILD_DEFCONFIG = comet_defconfig
562306a36Sopenharmony_ci
662306a36Sopenharmony_ci# Do not use GP-relative jumps
762306a36Sopenharmony_ciKBUILD_CFLAGS += -G0
862306a36Sopenharmony_ciLDFLAGS_vmlinux += -G0
962306a36Sopenharmony_ci
1062306a36Sopenharmony_ci# Do not use single-byte enums; these will overflow.
1162306a36Sopenharmony_ciKBUILD_CFLAGS += -fno-short-enums
1262306a36Sopenharmony_ci
1362306a36Sopenharmony_ci# We must use long-calls:
1462306a36Sopenharmony_ciKBUILD_CFLAGS += -mlong-calls
1562306a36Sopenharmony_ci
1662306a36Sopenharmony_ci# Modules must use either long-calls, or use pic/plt.
1762306a36Sopenharmony_ci# Use long-calls for now, it's easier.  And faster.
1862306a36Sopenharmony_ci# KBUILD_CFLAGS_MODULE += -fPIC
1962306a36Sopenharmony_ci# KBUILD_LDFLAGS_MODULE += -shared
2062306a36Sopenharmony_ciKBUILD_CFLAGS_MODULE += -mlong-calls
2162306a36Sopenharmony_ci
2262306a36Sopenharmony_cicflags-y += $(call cc-option,-mv${CONFIG_HEXAGON_ARCH_VERSION})
2362306a36Sopenharmony_ciaflags-y += $(call cc-option,-mv${CONFIG_HEXAGON_ARCH_VERSION})
2462306a36Sopenharmony_cildflags-y += $(call cc-option,-mv${CONFIG_HEXAGON_ARCH_VERSION})
2562306a36Sopenharmony_ci
2662306a36Sopenharmony_ciKBUILD_CFLAGS += $(cflags-y)
2762306a36Sopenharmony_ciKBUILD_AFLAGS += $(aflags-y)
2862306a36Sopenharmony_ciKBUILD_LDFLAGS += $(ldflags-y)
2962306a36Sopenharmony_ci
3062306a36Sopenharmony_ci# Thread-info register will be r19.  This value is not configureable;
3162306a36Sopenharmony_ci# it is hard-coded in several files.
3262306a36Sopenharmony_ciTIR_NAME := r19
3362306a36Sopenharmony_ciKBUILD_CFLAGS += -ffixed-$(TIR_NAME) -DTHREADINFO_REG=$(TIR_NAME) -D__linux__
3462306a36Sopenharmony_ciKBUILD_AFLAGS += -DTHREADINFO_REG=$(TIR_NAME)
35