Skip to content

Commit 53aa04b

Browse files
committed
[dhcp6relay] Make sure CFLAGS is appended to instead of overwritten
Also, use LDFLAGS when linking dhcp6relay. These two changes make sure the flags set in environment variables (by dpkg-buildflags) are honored. Also, explicitly 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 <[email protected]>
1 parent ae566d1 commit 53aa04b

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

src/dhcp6relay/Makefile

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ MKDIR := mkdir
55
CC := g++
66
MV := mv
77
LIBS := -levent -lhiredis -lswsscommon -pthread -lboost_thread -lboost_system
8-
CFLAGS = -g -Wall -std=c++17 -fPIC -I $(PWD)/../sonic-swss-common/common
8+
CFLAGS += -Wall -std=c++17 -fPIE -I$(PWD)/../sonic-swss-common/common
99
PWD := $(shell pwd)
1010

1111
ifneq ($(MAKECMDGOALS),clean)
@@ -21,7 +21,7 @@ all: sonic-dhcp6relay
2121
sonic-dhcp6relay: $(OBJS)
2222
@echo 'Building target: $@'
2323
@echo 'Invoking: G++ Linker'
24-
$(CC) -o $(DHCP6RELAY_TARGET) $(OBJS) $(LIBS)
24+
$(CC) $(LDFLAGS) -o $(DHCP6RELAY_TARGET) $(OBJS) $(LIBS)
2525
@echo 'Finished building target: $@'
2626
@echo ' '
2727

src/dhcp6relay/debian/rules

+2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
#!/usr/bin/make -f
22

3+
export DEB_BUILD_MAINT_OPTIONS=hardening=+all
4+
35
%:
46
dh $@ --parallel

src/dhcpmon/debian/rules

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#!/usr/bin/make -f
22

3+
export DEB_BUILD_MAINT_OPTIONS=hardening=+all
4+
35
DEB_CFLAGS_APPEND=-std=gnu11
46
export DEB_CFLAGS_APPEND
57

0 commit comments

Comments
 (0)