chore: Update compiler flags for security enhancements#84
Merged
deepin-bot[bot] merged 2 commits intolinuxdeepin:masterfrom Jan 7, 2026
Merged
chore: Update compiler flags for security enhancements#84deepin-bot[bot] merged 2 commits intolinuxdeepin:masterfrom
deepin-bot[bot] merged 2 commits intolinuxdeepin:masterfrom
Conversation
As title Log: Update compiler flags for security enhancements Bug: https://pms.uniontech.com/bug-view-339563.html
Add the -fPIE parameter via CMAKE_POSITION_INDEPENDENT_CODE. Add the -pie parameter via target_link_options. Log: Update compiler flags for security enhancements Bug: https://pms.uniontech.com/bug-view-339563.html
deepin pr auto review我来对这个CMakeLists.txt的修改进行审查:
改进建议:
function(set_security_flags target)
if(NOT ${CMAKE_SYSTEM_PROCESSOR} MATCHES "sw_64")
target_compile_options(${target} PRIVATE -Wall -Wl,--as-need -fPIE)
target_link_options(${target} PRIVATE -pie -Wl,-z,relro -Wl,-z,now)
endif()
endfunction()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fstack-protector-strong")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-z,noexecstack")
if(NOT CMAKE_SYSTEM_PROCESSOR MATCHES "sw_64")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wl,--as-need -fPIE -Wno-error=incompatible-pointer-types")总体来说,这是一个很好的安全性改进,主要增加了ASLR、PIE和RELRO等安全特性,有助于提高程序的安全性。代码组织清晰,注释充分,易于理解和维护。 |
lzwind
approved these changes
Jan 7, 2026
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: lzwind, wangrong1069 The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Contributor
Author
|
/merge |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.