linux/arch/csky/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

79 lines
1.5 KiB
Makefile

# SPDX-License-Identifier: GPL-2.0-only
OBJCOPYFLAGS :=-O binary
GZFLAGS :=-9
ifdef CONFIG_CPU_HAS_FPU
FPUEXT = f
endif
ifdef CONFIG_CPU_HAS_VDSP
VDSPEXT = v
endif
ifdef CONFIG_CPU_HAS_TEE
TEEEXT = t
endif
ifdef CONFIG_CPU_CK610
CPUTYPE = ck610
CSKYABI = abiv1
endif
ifdef CONFIG_CPU_CK810
CPUTYPE = ck810
CSKYABI = abiv2
endif
ifdef CONFIG_CPU_CK807
CPUTYPE = ck807
CSKYABI = abiv2
endif
ifdef CONFIG_CPU_CK860
CPUTYPE = ck860
CSKYABI = abiv2
endif
ifneq ($(CSKYABI),)
MCPU_STR = $(CPUTYPE)$(FPUEXT)$(VDSPEXT)$(TEEEXT)
KBUILD_CFLAGS += -mcpu=$(CPUTYPE) -Wa,-mcpu=$(MCPU_STR)
KBUILD_CFLAGS += -DCSKYCPU_DEF_NAME=\"$(MCPU_STR)\"
KBUILD_CFLAGS += -msoft-float -mdiv
KBUILD_CFLAGS += -fno-tree-vectorize
endif
KBUILD_CFLAGS += -pipe
ifeq ($(CSKYABI),abiv2)
KBUILD_CFLAGS += -mno-stack-size
endif
ifdef CONFIG_FRAME_POINTER
KBUILD_CFLAGS += -mbacktrace
endif
abidirs := $(patsubst %,arch/csky/%/,$(CSKYABI))
KBUILD_CFLAGS += $(patsubst %,-I$(srctree)/%inc,$(abidirs))
KBUILD_CPPFLAGS += -mlittle-endian
LDFLAGS += -EL
KBUILD_AFLAGS += $(KBUILD_CFLAGS)
core-y += arch/csky/$(CSKYABI)/
libs-y += arch/csky/lib/ \
$(shell $(CC) $(KBUILD_CFLAGS) $(KCFLAGS) -print-libgcc-file-name)
boot := arch/csky/boot
all: zImage
zImage Image uImage: vmlinux
$(Q)$(MAKE) $(build)=$(boot) $(boot)/$@
define archhelp
echo '* zImage - Compressed kernel image (arch/$(ARCH)/boot/zImage)'
echo ' Image - Uncompressed kernel image (arch/$(ARCH)/boot/Image)'
echo ' uImage - U-Boot wrapped zImage'
endef