From bcd2d4b1758febcca0959d4e4353c4d67470f419 Mon Sep 17 00:00:00 2001 From: liuh-80 Date: Thu, 7 Sep 2023 09:26:27 +0800 Subject: [PATCH] Fix swss-common binskim errors --- Makefile.am | 2 +- common/Makefile.am | 2 ++ configure.ac | 1 + pyext/py2/Makefile.am | 4 ++-- pyext/py3/Makefile.am | 4 ++-- sonic-db-cli/Makefile.am | 2 ++ 6 files changed, 10 insertions(+), 5 deletions(-) diff --git a/Makefile.am b/Makefile.am index 3551760e..17a6c939 100644 --- a/Makefile.am +++ b/Makefile.am @@ -2,7 +2,7 @@ lib_LTLIBRARIES = bin_PROGRAMS = if DEBUG -DBGFLAGS = -ggdb -DDEBUG +DBGFLAGS = -ggdb -DDEBUG -gdwarf-5 else DBGFLAGS = -g -DNDEBUG endif diff --git a/common/Makefile.am b/common/Makefile.am index 19aaa2bc..7f39d5f1 100644 --- a/common/Makefile.am +++ b/common/Makefile.am @@ -75,6 +75,7 @@ common_libswsscommon_la_SOURCES = \ common_libswsscommon_la_CXXFLAGS = $(DBGFLAGS) $(AM_CFLAGS) $(CFLAGS_COMMON) $(LIBNL_CFLAGS) $(CODE_COVERAGE_CXXFLAGS) common_libswsscommon_la_CPPFLAGS = $(DBGFLAGS) $(AM_CFLAGS) $(CFLAGS_COMMON) $(LIBNL_CPPFLAGS) $(CODE_COVERAGE_CPPFLAGS) common_libswsscommon_la_LIBADD = -lpthread $(LIBNL_LIBS) $(CODE_COVERAGE_LIBS) -lzmq -lboost_serialization -luuid -lyang +common_libswsscommon_la_LDFLAGS = -Wl,-z,now $(LDFLAGS) common_swssloglevel_SOURCES = \ common/loglevel.cpp \ @@ -84,3 +85,4 @@ common_swssloglevel_SOURCES = \ common_swssloglevel_CXXFLAGS = $(DBGFLAGS) $(AM_CFLAGS) $(CFLAGS_COMMON) $(CODE_COVERAGE_CXXFLAGS) common_swssloglevel_CPPFLAGS = $(DBGFLAGS) $(AM_CFLAGS) $(CFLAGS_COMMON) $(CODE_COVERAGE_CPPFLAGS) common_swssloglevel_LDADD = common/libswsscommon.la $(CODE_COVERAGE_LIBS) +common_swssloglevel_LDFLAGS = -Wl,-z,now $(LDFLAGS) diff --git a/configure.ac b/configure.ac index 1d8c53b1..33b01750 100644 --- a/configure.ac +++ b/configure.ac @@ -89,6 +89,7 @@ CFLAGS_COMMON+=" -Wvariadic-macros" CFLAGS_COMMON+=" -Wno-write-strings" CFLAGS_COMMON+=" -Wno-missing-format-attribute" CFLAGS_COMMON+=" -Wno-long-long" +CFLAGS_COMMON+=" -fstack-protector-strong" AC_SUBST(CFLAGS_COMMON) diff --git a/pyext/py2/Makefile.am b/pyext/py2/Makefile.am index 2e69dcd4..410d990e 100644 --- a/pyext/py2/Makefile.am +++ b/pyext/py2/Makefile.am @@ -2,8 +2,8 @@ pkgpython_PYTHON = pyext/py2/swsscommon.py pyext/py2/__init__.py pkgpyexec_LTLIBRARIES = pyext/py2/_swsscommon.la pyext_py2__swsscommon_la_SOURCES = pyext/py2/swsscommon_wrap.cpp -pyext_py2__swsscommon_la_CPPFLAGS = -std=c++11 -Icommon -I/usr/include/python$(PYTHON_VERSION) -pyext_py2__swsscommon_la_LDFLAGS = -module +pyext_py2__swsscommon_la_CPPFLAGS = -std=c++11 -Icommon -I/usr/include/python$(PYTHON_VERSION) -fstack-protector-strong +pyext_py2__swsscommon_la_LDFLAGS = -module -Wl,-z,now pyext_py2__swsscommon_la_LIBADD = common/libswsscommon.la -lpython$(PYTHON_VERSION) pyext/py2/swsscommon_wrap.cpp: $(SWIG_SOURCES) diff --git a/pyext/py3/Makefile.am b/pyext/py3/Makefile.am index 3e2bbdc2..a8600638 100644 --- a/pyext/py3/Makefile.am +++ b/pyext/py3/Makefile.am @@ -2,8 +2,8 @@ pkgpython3_PYTHON = pyext/py3/swsscommon.py pyext/py3/__init__.py pkgpy3exec_LTLIBRARIES = pyext/py3/_swsscommon.la pyext_py3__swsscommon_la_SOURCES = pyext/py3/swsscommon_wrap.cpp -pyext_py3__swsscommon_la_CPPFLAGS = -std=c++11 -Icommon -I/usr/include/python$(PYTHON3_VERSION) -pyext_py3__swsscommon_la_LDFLAGS = -module +pyext_py3__swsscommon_la_CPPFLAGS = -std=c++11 -Icommon -I/usr/include/python$(PYTHON3_VERSION) -fstack-protector-strong +pyext_py3__swsscommon_la_LDFLAGS = -module -Wl,-z,now pyext_py3__swsscommon_la_LIBADD = common/libswsscommon.la $(PYTHON3_BLDLIBRARY) pyext/py3/swsscommon_wrap.cpp: $(SWIG_SOURCES) diff --git a/sonic-db-cli/Makefile.am b/sonic-db-cli/Makefile.am index a0c65ede..27a7e89b 100755 --- a/sonic-db-cli/Makefile.am +++ b/sonic-db-cli/Makefile.am @@ -3,9 +3,11 @@ sonic_db_cli_libsonicdbcli_la_SOURCES = sonic-db-cli/sonic-db-cli.cpp sonic_db_cli_libsonicdbcli_la_CFLAGS = $(DBGFLAGS) $(AM_CFLAGS) $(CFLAGS_COMMON) sonic_db_cli_libsonicdbcli_la_CPPFLAGS = $(DBGFLAGS) $(AM_CPPFLAGS) $(CFLAGS_COMMON) sonic_db_cli_libsonicdbcli_la_LIBADD = common/libswsscommon.la -lpthread +sonic_db_cli_libsonicdbcli_la_LDFLAGS = -Wl,-z,now $(LDFLAGS) bin_PROGRAMS += sonic-db-cli/sonic-db-cli sonic_db_cli_sonic_db_cli_SOURCES = sonic-db-cli/sonic-db-cli.cpp sonic-db-cli/main.cpp sonic_db_cli_sonic_db_cli_CFLAGS = $(DBGFLAGS) $(AM_CFLAGS) $(CFLAGS_COMMON) sonic_db_cli_sonic_db_cli_CPPFLAGS = $(DBGFLAGS) $(AM_CPPFLAGS) $(CFLAGS_COMMON) sonic_db_cli_sonic_db_cli_LDADD = common/libswsscommon.la -lpthread +sonic_db_cli_sonic_db_cli_LDFLAGS = -Wl,-z,now $(LDFLAGS)