1 Star 0 Fork 41

tzing_t/grpc

forked from src-openEuler/grpc 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
add-secure-compile-option-in-Makefile.patch 1.40 KB
一键复制 编辑 原始数据 按行查看 历史
sherlock2010 提交于 2022-10-20 09:01 . add some secure compilation options
From:bitcoffee<[email protected]>
Reason:add-secure-compile-option-in-Makefile
base on author:zhuchunyi commit:b00721fa
diff -urN grpc/CMakeLists.txt grpc_new/CMakeLists.txt
--- grpc/CMakeLists.txt 2020-08-24 09:14:14.361862041 +0800
+++ grpc_new/CMakeLists.txt 2020-08-27 15:36:51.498277936 +0800
@@ -225,6 +226,9 @@
endif()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${_gRPC_C_CXX_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${_gRPC_C_CXX_FLAGS}")
+set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wl,-z,relro -Wl,-z,now -fPIE -fPIC -fstack-protector-strong -Wp,-D_FORTIFY_SOURCE=2 -O2")
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,-z,relro -Wl,-z,now -fPIE -fPIC -fstack-protector-strong -Wp,-D_FORTIFY_SOURCE=2 -O2")
+set(_gRPC_ALLTARGETS_LIBRARYIES "${_gRPC_ALLTARGETS_LIBRARYIES} -Wl,-z,relro -Wl,-z,now -pie")
if(gRPC_USE_PROTO_LITE)
set(_gRPC_PROTOBUF_LIBRARY_NAME "libprotobuf-lite")
diff --git a/Makefile b/Makefile
index 6ede6e34d2..d6190ecde4 100644
--- a/Makefile
+++ b/Makefile
@@ -478,6 +478,10 @@ LDFLAGS += $(EXTRA_LDFLAGS)
DEFINES += $(EXTRA_DEFINES)
LDLIBS += $(EXTRA_LDLIBS)
+CFLAGS += -Wl,-z,relro -Wl,-z,now -fPIE -fPIC -fstack-protector-strong -Wp,-D_FORTIFY_SOURCE=2 -O2
+CPPFLAGS += -Wl,-z,relro -Wl,-z,now -fPIE -fPIC -fstack-protector-strong -Wp,-D_FORTIFY_SOURCE=2 -O2
+LDFLAGS += -Wl,-z,relro -Wl,-z,now -pie
+
HOST_CPPFLAGS += $(CPPFLAGS)
HOST_CFLAGS += $(CFLAGS)
HOST_CXXFLAGS += $(CXXFLAGS)
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/tzing_t/grpc.git
[email protected]:tzing_t/grpc.git
tzing_t
grpc
grpc
master

搜索帮助