Skip to content

Commit

Permalink
[dhcp6relay] Make sure CFLAGS is appended to instead of overwritten
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
saiarcot895 committed Jan 27, 2022
1 parent ae566d1 commit 53aa04b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/dhcp6relay/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ MKDIR := mkdir
CC := g++
MV := mv
LIBS := -levent -lhiredis -lswsscommon -pthread -lboost_thread -lboost_system
CFLAGS = -g -Wall -std=c++17 -fPIC -I $(PWD)/../sonic-swss-common/common
CFLAGS += -Wall -std=c++17 -fPIE -I$(PWD)/../sonic-swss-common/common
PWD := $(shell pwd)

ifneq ($(MAKECMDGOALS),clean)
Expand All @@ -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 ' '

Expand Down
2 changes: 2 additions & 0 deletions src/dhcp6relay/debian/rules
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#!/usr/bin/make -f

export DEB_BUILD_MAINT_OPTIONS=hardening=+all

%:
dh $@ --parallel
2 changes: 2 additions & 0 deletions src/dhcpmon/debian/rules
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/usr/bin/make -f

export DEB_BUILD_MAINT_OPTIONS=hardening=+all

DEB_CFLAGS_APPEND=-std=gnu11
export DEB_CFLAGS_APPEND

Expand Down

0 comments on commit 53aa04b

Please sign in to comment.