add safe compile options

This commit is contained in:
shenwei41 2022-08-09 17:00:57 +08:00
parent 90314fb6d2
commit a9cc56f1a0
3 changed files with 4 additions and 0 deletions

View File

@ -7,6 +7,7 @@ elseif(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
else()
set(grpc_CXXFLAGS "-fstack-protector-all -Wno-maybe-uninitialized -Wno-unused-parameter -D_FORTIFY_SOURCE=2 -O2 \
-Dgrpc=mindspore_grpc -Dgrpc_impl=mindspore_grpc_impl -Dgrpc_core=mindspore_grpc_core")
set(grpc_CFLAGS "-fstack-protector-all -D_FORTIFY_SOURCE=2 -O2")
if(NOT ENABLE_GLIBCXX)
set(grpc_CXXFLAGS "${grpc_CXXFLAGS} -D_GLIBCXX_USE_CXX11_ABI=0")
endif()

View File

@ -82,6 +82,7 @@ file(GLOB DEBUG_SYM
file(GLOB DEBUG_STRIP_SYM
${MS_PACK_ROOT_DIR}/mindspore/*.so
${MS_PACK_ROOT_DIR}/mindspore/lib/*.so*
${MS_PACK_ROOT_DIR}/mindspore/bin/*
)
list(REMOVE_ITEM DEBUG_STRIP_SYM ${MS_PACK_ROOT_DIR}/mindspore/lib/libmindspore_aicpu_kernels.so)

View File

@ -44,6 +44,8 @@ else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,-rpath,$ORIGIN:$ORIGIN/..:$ORIGIN/../lib")
endif()
set(CMAKE_CXX_FLAGS "-fPIE ${CMAKE_CXX_FLAGS}")
if(ENABLE_CACHE)
ms_grpc_generate(CACHE_GRPC_SRCS CACHE_GRPC_HDRS cache_grpc.proto)
target_sources(engine-cache-client PUBLIC ${CACHE_GRPC_SRCS}