安全编译记录

主要选项为:

ASLR(级别为2),栈保护(-fstack-protector-all/-fstack-protector-strong)、堆栈不可执行(-Wl,-z,noexecstack)、GOT表保护(-Wl,-z,relro),
地址无关代码/地址无关可执行(-fPIC/-fPIE -pie),立即加载(-Wl,-z,now),strip,
并禁用动态库搜索路径(-Wl,--disable-new-dtags,--rpath/-Wl,--enable-new-dtags,--rpath)
-pipe -rdynamic \
           -Wall -Wextra -Wno-trigraphs -Wmissing-include-dirs \
           -Wformat-security -Wfloat-equal \
           -Wswitch-default -Wswitch-enum \
           -Wcast-qual -Wcast-align -Wpacked \
           -Wmissing-field-initializers -Wshadow \
           -Wpointer-arith -Wstack-protector \
           -fno-strict-aliasing -fno-common \
           -Wno-unused-function
-Werror-implicit-function-declaration \
           -Wbad-function-cast

 

posted @ 2022-06-07 10:37  codestacklinuxer  阅读(39)  评论(0)    收藏  举报