1b2441318SGreg Kroah-Hartman# SPDX-License-Identifier: GPL-2.0 2e4ff5b8fSIsaku Yamahata# The gate DSO image is built using a special linker script. 3e4ff5b8fSIsaku Yamahata 426160371SNicholas Piggintargets += gate.so gate.lds gate.o gate-dummy.o 526160371SNicholas Piggin 626160371SNicholas Pigginobj-y += gate-syms.o 7e4ff5b8fSIsaku Yamahata 8e4ff5b8fSIsaku YamahataCPPFLAGS_gate.lds := -P -C -U$(ARCH) 9e4ff5b8fSIsaku Yamahata 10e4ff5b8fSIsaku Yamahataquiet_cmd_gate = GATE $@ 11e4ff5b8fSIsaku Yamahata cmd_gate = $(CC) -nostdlib $(GATECFLAGS_$(@F)) -Wl,-T,$(filter-out FORCE,$^) -o $@ 12e4ff5b8fSIsaku Yamahata 13e4ff5b8fSIsaku YamahataGATECFLAGS_gate.so = -shared -s -Wl,-soname=linux-gate.so.1 \ 14*861fde31SNick Desaulniers -Wl,--hash-style=sysv 15e4ff5b8fSIsaku Yamahata$(obj)/gate.so: $(obj)/gate.lds $(obj)/gate.o FORCE 16e4ff5b8fSIsaku Yamahata $(call if_changed,gate) 17e4ff5b8fSIsaku Yamahata 1826160371SNicholas PigginGATECFLAGS_gate-dummy.o = -r 1926160371SNicholas Piggin$(obj)/gate-dummy.o: $(obj)/gate.lds $(obj)/gate.o FORCE 20e4ff5b8fSIsaku Yamahata $(call if_changed,gate) 21e4ff5b8fSIsaku Yamahata 2226160371SNicholas PigginLDFLAGS_gate-syms.o := -r -R 2326160371SNicholas Piggin$(obj)/gate-syms.o: $(obj)/gate-dummy.o FORCE 2426160371SNicholas Piggin $(call if_changed,ld) 2526160371SNicholas Piggin 26e1cb14b8SDenys Vlasenko# gate-data.o contains the gate DSO image as data in section .data..gate. 27e4ff5b8fSIsaku Yamahata# We must build gate.so before we can assemble it. 28e4ff5b8fSIsaku Yamahata# Note: kbuild does not track this dependency due to usage of .incbin 29e4ff5b8fSIsaku Yamahata$(obj)/gate-data.o: $(obj)/gate.so 30