hv: fix symbols not stripped from release binaries

In release environment, binary files must be stripped in
order to remove debugging code sections and symbol information
that aid attackers in the process of disassembly and reverse
engineering.
Use '-s' linking option to remove symbol table and relocation
information from release binaries.

Tracked-On: #3433
Signed-off-by: Tianhua Sun <tianhuax.s.sun@intel.com>
Reviewed-by: Yonghua Huang <yonghua.huang@intel.com>
This commit is contained in:
Tianhua Sun 2019-07-16 10:32:47 +08:00 committed by ACRN System Integration
parent 877ce914a2
commit b12b492d74
3 changed files with 11 additions and 0 deletions

View File

@ -52,6 +52,9 @@ LDFLAGS += -Wl,-z,noexecstack
LDFLAGS += -Wl,-z,relro,-z,now LDFLAGS += -Wl,-z,relro,-z,now
LDFLAGS += -pie LDFLAGS += -pie
LDFLAGS += -L$(TOOLS_OUT) LDFLAGS += -L$(TOOLS_OUT)
ifeq ($(RELEASE),1)
LDFLAGS += -s
endif
LIBS = -lrt LIBS = -lrt
LIBS += -lpthread LIBS += -lpthread

View File

@ -18,6 +18,7 @@ BASEDIR := $(shell pwd)
HV_OBJDIR ?= $(CURDIR)/build HV_OBJDIR ?= $(CURDIR)/build
HV_FILE := acrn HV_FILE := acrn
SUB_MAKEFILES := $(wildcard */Makefile) SUB_MAKEFILES := $(wildcard */Makefile)
RELEASE ?= 0
LIB_DEBUG = $(HV_OBJDIR)/debug/libdebug.a LIB_DEBUG = $(HV_OBJDIR)/debug/libdebug.a
LIB_RELEASE = $(HV_OBJDIR)/release/librelease.a LIB_RELEASE = $(HV_OBJDIR)/release/librelease.a
@ -90,6 +91,10 @@ else
LDFLAGS += -static LDFLAGS += -static
endif endif
ifeq ($(RELEASE),y)
LDFLAGS += -s
endif
ARCH_CFLAGS += -gdwarf-2 ARCH_CFLAGS += -gdwarf-2
ARCH_ASFLAGS += -gdwarf-2 -DASSEMBLER=1 ARCH_ASFLAGS += -gdwarf-2 -DASSEMBLER=1
ARCH_ARFLAGS += ARCH_ARFLAGS +=

View File

@ -47,6 +47,9 @@ LDFLAGS += -pie
LDFLAGS += -L$(OUT_DIR) LDFLAGS += -L$(OUT_DIR)
LDFLAGS += -lpthread LDFLAGS += -lpthread
LDFLAGS += -lacrn-mngr LDFLAGS += -lacrn-mngr
ifeq ($(RELEASE),1)
LDFLAGS += -s
endif
.PHONY: all .PHONY: all
ifeq ($(RELEASE),0) ifeq ($(RELEASE),0)