libwd/0075-add-secure-compilation-option.patch
2023-11-23 10:41:04 +08:00

44 lines
1.4 KiB
Diff

From 6ad3084be58e00c97d56e1dcf2507bd6519599fd Mon Sep 17 00:00:00 2001
From: Qi Tao <taoqi10@huawei.com>
Date: Fri, 10 Nov 2023 11:52:44 +0800
Subject: [PATCH 75/85] add secure compilation option
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Add PIE、PIC、BIND_NOW、SP、NO Rpath/RunPath、FS、Ftrapv and Strip
to UADK compilation.
Signed-off-by: Qi Tao <taoqi10@huawei.com>
---
uadk_tool/Makefile.am | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/uadk_tool/Makefile.am b/uadk_tool/Makefile.am
index 6b787f9..7f00087 100644
--- a/uadk_tool/Makefile.am
+++ b/uadk_tool/Makefile.am
@@ -1,7 +1,9 @@
ACLOCAL_AMFLAGS = -I m4 -I./include
AUTOMAKE_OPTIONS = foreign subdir-objects
-AM_CFLAGS=-Wall -fno-strict-aliasing -I$(top_srcdir) -I$(top_srcdir)/benchmark/include \
+AM_CFLAGS=-Wall -Werror -fno-strict-aliasing -I$(top_srcdir) -I$(top_srcdir)/benchmark/include \
-pthread
+AM_CFLAGS += -fPIC -fPIE -pie -fstack-protector-strong -D_FORTIFY_SOURCE=2 \
+-O2 -ftrapv -Wl,-z,now -Wl,-s
#AUTOMAKE_OPTIONS = subdir-objects
@@ -33,8 +35,6 @@ uadk_tool_LDADD=-L../.libs -l:libwd.so.2 -l:libwd_crypto.so.2 \
-l:libwd_comp.so.2 -lnuma
endif
-uadk_tool_LDFLAGS=-Wl,-rpath,'/usr/local/lib',--enable-new-dtags
-
if WITH_ZLIB_FSE_DIR
AM_CFLAGS += -DZLIB_FSE
uadk_tool_LDADD+= $(with_zlib_fse_dir)/libfse.a
--
2.25.1