linux-yocto/arch/hexagon/Makefile
Masahiro Yamada ce697ccee1 kbuild: remove head-y syntax
Kbuild puts the objects listed in head-y at the head of vmlinux.
Conventionally, we do this for head*.S, which contains the kernel entry
point.

A counter approach is to control the section order by the linker script.
Actually, the code marked as __HEAD goes into the ".head.text" section,
which is placed before the normal ".text" section.

I do not know if both of them are needed. From the build system
perspective, head-y is not mandatory. If you can achieve the proper code
placement by the linker script only, it would be cleaner.

I collected the current head-y objects into head-object-list.txt. It is
a whitelist. My hope is it will be reduced in the long run.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Tested-by: Nick Desaulniers <ndesaulniers@google.com>
Reviewed-by: Nicolas Schier <nicolas@fjasle.eu>
2022-10-02 18:06:03 +09:00

1.0 KiB

SPDX-License-Identifier: GPL-2.0

Makefile for the Hexagon arch

KBUILD_DEFCONFIG = comet_defconfig

Do not use GP-relative jumps

KBUILD_CFLAGS += -G0 LDFLAGS_vmlinux += -G0

Do not use single-byte enums; these will overflow.

KBUILD_CFLAGS += -fno-short-enums

We must use long-calls:

KBUILD_CFLAGS += -mlong-calls

Modules must use either long-calls, or use pic/plt.

Use long-calls for now, it's easier. And faster.

KBUILD_CFLAGS_MODULE += -fPIC

KBUILD_LDFLAGS_MODULE += -shared

KBUILD_CFLAGS_MODULE += -mlong-calls

cflags-y += $(call cc-option,-mv${CONFIG_HEXAGON_ARCH_VERSION}) aflags-y += $(call cc-option,-mv${CONFIG_HEXAGON_ARCH_VERSION}) ldflags-y += $(call cc-option,-mv${CONFIG_HEXAGON_ARCH_VERSION})

KBUILD_CFLAGS += $(cflags-y) KBUILD_AFLAGS += $(aflags-y) KBUILD_LDFLAGS += $(ldflags-y)

Thread-info register will be r19. This value is not configureable;

it is hard-coded in several files.

TIR_NAME := r19 KBUILD_CFLAGS += -ffixed-$(TIR_NAME) -DTHREADINFO_REG=$(TIR_NAME) -D__linux__ KBUILD_AFLAGS += -DTHREADINFO_REG=$(TIR_NAME)