mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-11-26 04:24:40 +00:00
hv: mutl-arch: Makefile: move CONFIG_RELOC related options to arch specific
To support CONFIG_RELOC differnt ${ARCH} has different CFLAGS and
LDFlAGS. This patch move CFLAGS and LDFLAGS to support x86 relocation
build to x86 arch/Makefile.
Tracked-On: #8825
Signed-off-by: Jian Jun Chen <jian.jun.chen@intel.com>
Acked-by: Wang, Yu1 <yu1.wang@intel.com>
This commit is contained in:
committed by
acrnsi-robot
parent
1dee977429
commit
37692038c9
@@ -49,11 +49,6 @@ CFLAGS += -Werror
|
|||||||
# ACRN depends on zero length array. Silence the gcc if Warrary-bounds is default option
|
# ACRN depends on zero length array. Silence the gcc if Warrary-bounds is default option
|
||||||
CFLAGS += -Wno-array-bounds
|
CFLAGS += -Wno-array-bounds
|
||||||
CFLAGS += -O2
|
CFLAGS += -O2
|
||||||
ifeq (y, $(CONFIG_RELOC))
|
|
||||||
CFLAGS += -fpie
|
|
||||||
else
|
|
||||||
CFLAGS += -static
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifdef STACK_PROTECTOR
|
ifdef STACK_PROTECTOR
|
||||||
ifeq (true, $(shell [ $(GCC_MAJOR) -gt 4 ] && echo true))
|
ifeq (true, $(shell [ $(GCC_MAJOR) -gt 4 ] && echo true))
|
||||||
@@ -80,17 +75,6 @@ LDFLAGS += -Wl,--gc-sections -nostartfiles -nostdlib
|
|||||||
LDFLAGS += -Wl,-n,-z,max-page-size=0x1000
|
LDFLAGS += -Wl,-n,-z,max-page-size=0x1000
|
||||||
LDFLAGS += -Wl,--no-dynamic-linker
|
LDFLAGS += -Wl,--no-dynamic-linker
|
||||||
|
|
||||||
ifeq (y, $(CONFIG_RELOC))
|
|
||||||
# on X86_64, when build with "-pie", GCC fails on linking R_X86_64_32
|
|
||||||
# relocations with "recompile with fPIC" error, because it may cause
|
|
||||||
# run-time relocation overflow if it runs at address above 4GB.
|
|
||||||
# We know it's safe because Hypervisor runs under 4GB. "noreloc-overflow"
|
|
||||||
# is used to avoid the compile error
|
|
||||||
LDFLAGS += -pie -z noreloc-overflow
|
|
||||||
else
|
|
||||||
LDFLAGS += -static
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq (y, $(CONFIG_RELEASE))
|
ifeq (y, $(CONFIG_RELEASE))
|
||||||
LDFLAGS += -s
|
LDFLAGS += -s
|
||||||
endif
|
endif
|
||||||
|
|||||||
@@ -21,6 +21,19 @@ VP_X86_TEE_MOD = $(HV_MODDIR)/vp_x86_tee_mod.a
|
|||||||
VP_HCALL_MOD = $(HV_MODDIR)/vp_hcall_mod.a
|
VP_HCALL_MOD = $(HV_MODDIR)/vp_hcall_mod.a
|
||||||
SYS_INIT_MOD = $(HV_MODDIR)/sys_init_mod.a
|
SYS_INIT_MOD = $(HV_MODDIR)/sys_init_mod.a
|
||||||
|
|
||||||
|
ifeq (y, $(CONFIG_RELOC))
|
||||||
|
CFLAGS += -fpie
|
||||||
|
# on X86_64, when build with "-pie", GCC fails on linking R_X86_64_32
|
||||||
|
# relocations with "recompile with fPIC" error, because it may cause
|
||||||
|
# run-time relocation overflow if it runs at address above 4GB.
|
||||||
|
# We know it's safe because Hypervisor runs under 4GB. "noreloc-overflow"
|
||||||
|
# is used to avoid the compile error
|
||||||
|
LDFLAGS += -pie -z noreloc-overflow
|
||||||
|
else
|
||||||
|
CFLAGS += -static
|
||||||
|
LDFLAGS += -static
|
||||||
|
endif
|
||||||
|
|
||||||
ARCH_CFLAGS += -m64 -mno-mmx -mno-sse -mno-sse2 -mno-80387 -mno-fp-ret-in-387
|
ARCH_CFLAGS += -m64 -mno-mmx -mno-sse -mno-sse2 -mno-80387 -mno-fp-ret-in-387
|
||||||
ARCH_CFLAGS += -mno-red-zone -mpopcnt
|
ARCH_CFLAGS += -mno-red-zone -mpopcnt
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user