[201811][dhcp] enable building dhcpmon and dhcp6relay debug symbols (#9959)
* dhcp6relay: Save the dbgsym package into the target folder (#9013) This makes it possible to install the debug symbols if needed. Also install the package into the debug version of sonic-dhcp-relay container. Signed-off-by: Saikrishna Arcot <sarcot@microsoft.com> * Package debugging and hardening for dhcpmon and dhcp6relay (#9862) Enable dbgsym package for dhcpmon. Allow CFLAGS and LDFLAGS from environment variables to be used in the dhcp6relay build. This makes sure that the -O2 flag from dpkg-buildflags gets used. Finally, enable all hardening flags in dpkg-buildflags for dhcp6relay and dhcpmon. The change from the default set of flags is that during linking, immediate binding of symbols is done instead of lazy binding. Signed-off-by: Saikrishna Arcot <sarcot@microsoft.com> * [201811][dhcp] update debian build rules Signed-off-by: Ying Xie <ying.xie@microsoft.com> Co-authored-by: Saikrishna Arcot <sarcot@microsoft.com>
This commit is contained in:
parent
8e6d08a6b5
commit
76af3dc148
@ -7,3 +7,6 @@ SONIC_DHCP6RELAY = sonic-$(SONIC_DHCP6RELAY_PKG_NAME)_$(SONIC_DHCP6RELAY_VERSION
|
||||
$(SONIC_DHCP6RELAY)_DEPENDS = $(LIBSWSSCOMMON) $(LIBHIREDIS) $(LIBSWSSCOMMON_DEV) $(LIBHIREDIS_DEV)
|
||||
$(SONIC_DHCP6RELAY)_SRC_PATH = $(SRC_PATH)/$(SONIC_DHCP6RELAY_PKG_NAME)
|
||||
SONIC_DPKG_DEBS += $(SONIC_DHCP6RELAY)
|
||||
|
||||
SONIC_DHCP6RELAY_DBG = sonic-$(SONIC_DHCP6RELAY_PKG_NAME)-dbg_$(SONIC_DHCP6RELAY_VERSION)_amd64.deb
|
||||
$(eval $(call add_derived_package,$(SONIC_DHCP6RELAY),$(SONIC_DHCP6RELAY_DBG)))
|
||||
|
@ -6,3 +6,6 @@ SONIC_DHCPMON_PKG_NAME = dhcpmon
|
||||
SONIC_DHCPMON = sonic-$(SONIC_DHCPMON_PKG_NAME)_$(SONIC_DHCPMON_VERSION)_amd64.deb
|
||||
$(SONIC_DHCPMON)_SRC_PATH = $(SRC_PATH)/$(SONIC_DHCPMON_PKG_NAME)
|
||||
SONIC_DPKG_DEBS += $(SONIC_DHCPMON)
|
||||
|
||||
SONIC_DHCPMON_DBG = sonic-$(SONIC_DHCPMON_PKG_NAME)-dbg_$(SONIC_DHCPMON_VERSION)_amd64.deb
|
||||
$(eval $(call add_derived_package,$(SONIC_DHCPMON),$(SONIC_DHCPMON_DBG)))
|
||||
|
@ -8,7 +8,7 @@ $(DOCKER_DHCP_RELAY)_PATH = $(DOCKERS_PATH)/docker-dhcp-relay
|
||||
|
||||
$(DOCKER_DHCP_RELAY)_DEPENDS += $(ISC_DHCP_COMMON) $(ISC_DHCP_RELAY) $(REDIS_TOOLS) $(SONIC_DHCPMON) $(SONIC_DHCP6RELAY) $(LIBSWSSCOMMON)
|
||||
$(DOCKER_DHCP_RELAY)_DBG_DEPENDS = $($(DOCKER_CONFIG_ENGINE)_DBG_DEPENDS)
|
||||
$(DOCKER_DHCP_RELAY)_DBG_DEPENDS += $(ISC_DHCP_DBG)
|
||||
$(DOCKER_DHCP_RELAY)_DBG_DEPENDS += $(ISC_DHCP_DBG) $(SONIC_DHCP6RELAY_DBG) $(SONIC_DHCPMON_DBG)
|
||||
$(DOCKER_DHCP_RELAY)_DBG_IMAGE_PACKAGES = $($(DOCKER_CONFIG_ENGINE)_DBG_IMAGE_PACKAGES)
|
||||
|
||||
$(DOCKER_DHCP_RELAY)_LOAD_DOCKERS = $(DOCKER_CONFIG_ENGINE)
|
||||
|
@ -4,8 +4,8 @@ CP := cp
|
||||
MKDIR := mkdir
|
||||
CC := g++
|
||||
MV := mv
|
||||
LIBS := -levent -lswsscommon -pthread -lboost_thread -lboost_system -I $(PWD)/../sonic-swss-common/common
|
||||
CFLAGS = -g -Wall -std=gnu11
|
||||
LIBS := -levent -lhiredis -lswsscommon -pthread -lboost_thread -lboost_system
|
||||
CFLAGS += -Wall -std=c++14 -fPIE -I$(PWD)/../sonic-swss-common/common
|
||||
PWD := $(shell pwd)
|
||||
|
||||
ifneq ($(MAKECMDGOALS),clean)
|
||||
@ -21,7 +21,7 @@ all: sonic-dhcp6relay
|
||||
sonic-dhcp6relay: $(OBJS)
|
||||
@echo 'Building target: $@'
|
||||
@echo 'Invoking: G++ Linker'
|
||||
$(CC) -o $(DHCP6RELAY_TARGET) $(OBJS) $(LIBS)
|
||||
$(CC) $(LDFLAGS) -o $(DHCP6RELAY_TARGET) $(OBJS) $(LIBS)
|
||||
@echo 'Finished building target: $@'
|
||||
@echo ' '
|
||||
|
||||
|
@ -15,3 +15,13 @@ Depends: libevent-2.0-5,
|
||||
libboost-thread1.55.0,
|
||||
libboost-system1.55.0
|
||||
Description: SONiC DHCPv6 Relay
|
||||
|
||||
Package: sonic-dhcp6relay-dbg
|
||||
Architecture: any
|
||||
Section: debug
|
||||
Priority: extra
|
||||
Built-Using: ${misc:Built-Using}
|
||||
Depends: libevent-2.0-5,
|
||||
libboost-thread1.55.0,
|
||||
libboost-system1.55.0
|
||||
Description: SONiC DHCPv6 Relay debug symbols
|
||||
|
@ -1,4 +1,12 @@
|
||||
#!/usr/bin/make -f
|
||||
|
||||
export DEB_BUILD_MAINT_OPTIONS=hardening=+all
|
||||
|
||||
%:
|
||||
dh $@ --parallel
|
||||
|
||||
override_dh_strip:
|
||||
dh_strip --dbg-package=sonic-dhcp6relay-dbg
|
||||
|
||||
override_dh_auto_install:
|
||||
dh_auto_install --destdir=debian/sonic-dhcp6relay
|
||||
|
@ -18,6 +18,6 @@ C_DEPS += \
|
||||
src/%.o: src/%.cpp
|
||||
@echo 'Building file: $<'
|
||||
@echo 'Invoking: GCC C++ Compiler'
|
||||
$(CC) -std=c++14 -D__FILENAME__="$(subst src/,,$<)" $(LIBS) -Wall -c -fmessage-length=0 -fPIC -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<"
|
||||
$(CC) -D__FILENAME__="$(subst src/,,$<)" $(CFLAGS) -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<"
|
||||
@echo 'Finished building: $<'
|
||||
@echo ' '
|
||||
|
@ -10,6 +10,16 @@ XS-Go-Import-Path: github.com/Azure/sonic-buildimage
|
||||
|
||||
Package: sonic-dhcpmon
|
||||
Architecture: any
|
||||
Section: devel
|
||||
Priority: optional
|
||||
Built-Using: ${misc:Built-Using}
|
||||
Depends: libevent-2.0-5
|
||||
Description: SONiC DHCP Monitor
|
||||
|
||||
Package: sonic-dhcpmon-dbg
|
||||
Architecture: any
|
||||
Section: debug
|
||||
Priority: extra
|
||||
Built-Using: ${misc:Built-Using}
|
||||
Depends: libevent-2.0-5
|
||||
Description: SONiC DHCP Monitor debug symbols
|
||||
|
@ -1,7 +1,15 @@
|
||||
#!/usr/bin/make -f
|
||||
|
||||
export DEB_BUILD_MAINT_OPTIONS=hardening=+all
|
||||
|
||||
DEB_CFLAGS_APPEND=-std=gnu11
|
||||
export DEB_CFLAGS_APPEND
|
||||
|
||||
%:
|
||||
dh $@ --parallel
|
||||
|
||||
override_dh_strip:
|
||||
dh_strip --dbg-package=sonic-dhcpmon-dbg
|
||||
|
||||
override_dh_auto_install:
|
||||
dh_auto_install --destdir=debian/sonic-dhcpmon
|
||||
|
Loading…
Reference in New Issue
Block a user