xref: /linux-6.15/arch/xtensa/kernel/Makefile (revision d38efc1f)
15a0015d6SChris Zankel#
25a0015d6SChris Zankel# Makefile for the Linux/Xtensa kernel.
35a0015d6SChris Zankel#
45a0015d6SChris Zankel
55a0015d6SChris Zankelextra-y := head.o vmlinux.lds
65a0015d6SChris Zankel
764ac24e7SMatthew Wilcoxobj-y := align.o entry.o irq.o coprocessor.o process.o ptrace.o \
81c0350bdSChris Zankel	 setup.o signal.o syscall.o time.o traps.o vectors.o platform.o  \
9*d38efc1fSMax Filippov	 pci-dma.o
105a0015d6SChris Zankel
115a0015d6SChris Zankelobj-$(CONFIG_KGDB) += xtensa-stub.o
125a0015d6SChris Zankelobj-$(CONFIG_PCI) += pci.o
135a0015d6SChris Zankelobj-$(CONFIG_MODULES) += xtensa_ksyms.o module.o
145a0015d6SChris Zankel
1578f3cdfaSChris Zankel# In the Xtensa architecture, assembly generates literals which must always
1678f3cdfaSChris Zankel# precede the L32R instruction with a relative offset less than 256 kB.
1778f3cdfaSChris Zankel# Therefore, the .text and .literal section must be combined in parenthesis
1878f3cdfaSChris Zankel# in the linker script, such as: *(.literal .text).
1978f3cdfaSChris Zankel#
2078f3cdfaSChris Zankel# We need to post-process the generated vmlinux.lds scripts to convert
2178f3cdfaSChris Zankel# *(xxx.text) to  *(xxx.literal xxx.text) for the following text sections:
2278f3cdfaSChris Zankel#   .text .ref.text .*init.text .*exit.text .text.*
2378f3cdfaSChris Zankel#
2478f3cdfaSChris Zankel# Replicate rules in scripts/Makefile.build
255a0015d6SChris Zankel
26ed5010eaSChris Zankelsed-y = -e 's/\*(\(\.[a-z]*it\|\.ref\|\)\.text)/*(\1.literal \1.text)/g'    \
27f6a03a12SMax Filippov	-e 's/\.text\.unlikely/.literal.unlikely .text.unlikely/g' \
28ed5010eaSChris Zankel	-e 's/\*(\(\.text\.[a-z]*\))/*(\1.literal \1)/g'
2978f3cdfaSChris Zankel
3078f3cdfaSChris Zankelquiet_cmd__cpp_lds_S = LDS     $@
3151b563fcSSam Ravnborg      cmd__cpp_lds_S = $(CPP) $(cpp_flags) -P -C -Uxtensa -D__ASSEMBLY__ $< \
3251b563fcSSam Ravnborg                       | sed $(sed-y) >$@
3378f3cdfaSChris Zankel
3478f3cdfaSChris Zankel$(obj)/vmlinux.lds: $(src)/vmlinux.lds.S FORCE
3578f3cdfaSChris Zankel	$(call if_changed_dep,_cpp_lds_S)
36