xref: /linux-6.15/arch/xtensa/kernel/Makefile (revision 78f3cdfa)
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  \
9787a22d1SChris Zankel	 pci-dma.o init_task.o io.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
15*78f3cdfaSChris Zankel# In the Xtensa architecture, assembly generates literals which must always
16*78f3cdfaSChris Zankel# precede the L32R instruction with a relative offset less than 256 kB.
17*78f3cdfaSChris Zankel# Therefore, the .text and .literal section must be combined in parenthesis
18*78f3cdfaSChris Zankel# in the linker script, such as: *(.literal .text).
19*78f3cdfaSChris Zankel#
20*78f3cdfaSChris Zankel# We need to post-process the generated vmlinux.lds scripts to convert
21*78f3cdfaSChris Zankel# *(xxx.text) to  *(xxx.literal xxx.text) for the following text sections:
22*78f3cdfaSChris Zankel#   .text .ref.text .*init.text .*exit.text .text.*
23*78f3cdfaSChris Zankel#
24*78f3cdfaSChris Zankel# Replicate rules in scripts/Makefile.build
255a0015d6SChris Zankel
26*78f3cdfaSChris Zankelsed-y = -e 's/(\(\.[a-z]*it\|\.ref\|\)\.text)/(\1.literal \1.text)/g'	\
27*78f3cdfaSChris Zankel	-e 's/(\(\.text\.[a-z]*\))/(\1.literal \1)/g'
28*78f3cdfaSChris Zankel
29*78f3cdfaSChris Zankelquiet_cmd__cpp_lds_S = LDS     $@
30*78f3cdfaSChris Zankel      cmd__cpp_lds_S = $(CPP) $(cpp_flags) -D__ASSEMBLY__ $< | sed $(sed-y) >$@
31*78f3cdfaSChris Zankel
32*78f3cdfaSChris Zankel$(obj)/vmlinux.lds: $(src)/vmlinux.lds.S FORCE
33*78f3cdfaSChris Zankel	$(call if_changed_dep,_cpp_lds_S)
34