xref: /illumos-gate/usr/src/test/bhyve-tests/tests/Makefile.in_guest (revision 55fea89dcaa64928bed4327112404dcb3e07b79f)
1#
2# This file and its contents are supplied under the terms of the
3# Common Development and Distribution License ("CDDL"), version 1.0.
4# You may only use this file in accordance with the terms of version
5# 1.0 of the CDDL.
6#
7# A full copy of the text of the CDDL should have accompanied this
8# source.  A copy of the CDDL is also available via the Internet at
9# http://www.illumos.org/license/CDDL.
10#
11
12# Copyright 2022 Oxide Computer Company
13
14PAYLOAD_CLEANFILES =	payload_start.o	\
15		$(PAYLOADS:%=payload_%)		\
16		$(PAYLOADS:%=payload_%.o)		\
17		$(PAYLOADS:%=pobj_%.o)		\
18		$(PAYLOADS:%=pobj_%.s)
19
20$(PAYLOADS:%=payload_%.o) := AS_CPPFLAGS += -I../common
21# Without a real runtime in the payload, the stack protector must be disabled
22$(PAYLOADS:%=payload_%.o) := STACKPROTECT = none
23# Like our own kernel, prevent the compiler from using the FPU via SIMD
24$(PAYLOADS:%=payload_%.o) := CFLAGS64 += $(STAND_FLAGS_64)
25
26payload_%: payload_start.o payload_%.o
27	$(LD) -dn -e _start -M ../common/Mapfile.payload -o $@ $^
28
29pobj_%.s: payload_%
30	@echo " .data"                                  > $@
31	@echo " .globl payload_data"                    >> $@
32	@echo "payload_data:"                           >> $@
33	$(ELFEXTRACT) $^                                >> $@
34	@echo " .size  payload_data, [.-payload_data]"  >> $@
35	@echo " .align 4"                               >> $@
36	@echo " .globl payload_size"                    >> $@
37	@echo " .size payload_size, 4"                  >> $@
38	@echo "payload_size:"                           >> $@
39	@echo " .data"                                  >> $@
40	@echo " .long  [.-payload_data]"                >> $@
41
42pobj_%.o: pobj_%.s
43	$(COMPILE.s) -o $@ $^
44	$(POST_PROCESS)
45
46%.o: ../common/%.S
47	$(COMPILE.s) -o $@ $^
48	$(POST_PROCESS)
49
50%.o: ../common/%.c
51	$(COMPILE.c) -o $@ $^
52	$(POST_PROCESS)
53