diff --git a/hypervisor/Makefile b/hypervisor/Makefile index cfc07635a..a1c8fabf5 100644 --- a/hypervisor/Makefile +++ b/hypervisor/Makefile @@ -185,7 +185,6 @@ C_SRCS += arch/x86/vmx.c C_SRCS += arch/x86/cpu_state_tbl.c C_SRCS += arch/x86/pm.c S_SRCS += arch/x86/wakeup.S -C_SRCS += arch/x86/static_checks.c C_SRCS += arch/x86/trampoline.c S_SRCS += arch/x86/sched.S C_SRCS += arch/x86/guest/vcpuid.c @@ -224,8 +223,6 @@ C_SRCS += common/trusty_hypercall.c C_SRCS += common/schedule.c C_SRCS += common/vm_load.c C_SRCS += common/ptdev.c -C_SRCS += common/static_checks.c - ifdef STACK_PROTECTOR C_SRCS += common/stack_protector.c endif @@ -263,6 +260,8 @@ ifneq ($(CONFIG_RELEASE),y) CFLAGS += -DHV_DEBUG -DPROFILING_ON -fno-omit-frame-pointer endif S_OBJS := $(patsubst %.S,$(HV_OBJDIR)/%.o,$(S_SRCS)) +PRE_BUILD_SRCS += pre_build/static_checks.c +PRE_BUILD_OBJS := $(patsubst %.c,$(HV_OBJDIR)/%.o,$(PRE_BUILD_SRCS)) DISTCLEAN_OBJS := $(shell find $(BASEDIR) -name '*.o') VERSION := $(HV_OBJDIR)/include/version.h @@ -302,7 +301,7 @@ else endif .PHONY: all -all: lib $(HV_OBJDIR)/$(HV_FILE).32.out $(HV_OBJDIR)/$(HV_FILE).bin +all: pre_build lib $(HV_OBJDIR)/$(HV_FILE).32.out $(HV_OBJDIR)/$(HV_FILE).bin ifeq ($(FIRMWARE),sbl) install: lib $(HV_OBJDIR)/$(HV_FILE).32.out @@ -322,6 +321,9 @@ else endif endif +.PHONY: pre_build +pre_build: $(PRE_BUILD_OBJS) + .PHONY: header header: $(VERSION) $(HV_OBJDIR)/$(HV_CONFIG_H) $(TARGET_ACPI_INFO_HEADER) diff --git a/hypervisor/common/static_checks.c b/hypervisor/common/static_checks.c deleted file mode 100644 index 730c3eb39..000000000 --- a/hypervisor/common/static_checks.c +++ /dev/null @@ -1,13 +0,0 @@ -/* - * Copyright (C) 2018 Intel Corporation. All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ -#include - -#define CAT__(A,B) A ## B -#define CAT_(A,B) CAT__(A,B) -#define CTASSERT(expr) \ -typedef int32_t CAT_(CTA_DummyType,__LINE__)[(expr) ? 1 : -1] - -CTASSERT(sizeof(struct vhm_request) == (4096U/VHM_REQUEST_MAX)); diff --git a/hypervisor/arch/x86/static_checks.c b/hypervisor/pre_build/static_checks.c similarity index 98% rename from hypervisor/arch/x86/static_checks.c rename to hypervisor/pre_build/static_checks.c index 8b81895b5..701f4bc04 100644 --- a/hypervisor/arch/x86/static_checks.c +++ b/hypervisor/pre_build/static_checks.c @@ -68,3 +68,4 @@ CTASSERT(CPU_CONTEXT_OFFSET_LDTR - CPU_CONTEXT_OFFSET_EXTCTX_START CTASSERT((sizeof(struct trusty_startup_param) + sizeof(struct trusty_key_info)) < 0x1000U); CTASSERT(NR_WORLD == 2); +CTASSERT(sizeof(struct vhm_request) == (4096U/VHM_REQUEST_MAX));