1 Star 0 Fork 23

木得感情的openEuler机器人/gcc_secure

forked from src-openEuler/gcc_secure 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
openeuler_gcc_secure_wrapper 1.60 KB
一键复制 编辑 原始数据 按行查看 历史
木得感情的openEuler机器人 提交于 2021-07-22 15:03 +08:00 . reorg gcc_secure
#!/bin/sh
gcc_secure_exclude=`rpm --eval %{gcc_secure_exclude}`
if ! cat /.build.command | egrep "$gcc_secure_exclude" &>/dev/null; then
sec_opt='-fPIC -D_FORTIFY_SOURCE=2 -O2 -Wl,-z,relro -Wl,-z,now -Wl,-z,noexecstack -Wtrampolines -fsigned-char'
fs_opt=''
if [[ "$@" =~ "-O0" ]]; then
#openjdk set O0 can not use FS
sec_opt=`echo $sec_opt | sed 's/ -D_FORTIFY_SOURCE=2 -O2 / /'`
fi
if [ -d '/home/abuild/rpmbuild/SOURCES' ]; then
configfile=/home/abuild/rpmbuild/SOURCES/config_for_secure
else
configfile=/root/rpmbuild/SOURCES/config_for_secure
fi
if [ -f $configfile ]; then
rpm_name=`cat $configfile| grep rpm_name| awk -F: '{print $NF}'`
sec_opt=`cat $configfile| grep sec_opt| awk -F: '{print $NF}'`
fs_opt=`cat $configfile| grep fs_opt| awk -F: '{print $NF}'`
fi
if [[ x$rpm_name = "xnumactl" ]] && [[ "$@" =~ "-march=x86-64" ]];then
#numactl i686 use asm can't add -fPIC
sec_opt=`echo $sec_opt | sed 's/-fPIC / /'`
fi
if [[ x$rpm_name = "xglibc" ]] || [[ x$rpm_name = "xcompat-glibc" ]];then
#glibc supply fs define, can not add fs for glibc self
/usr/bin/gcc_normal $sec_opt "$@" $fs_opt --specs=/usr/share/gcc_secure/openeuler_gcc_secure.opt.pie --specs=/usr/share/gcc_secure/openeuler_gcc_secure.opt.ld
else
/usr/bin/gcc_normal $sec_opt "$@" $fs_opt --specs=/usr/share/gcc_secure/openeuler_gcc_secure.opt.pie --specs=/usr/share/gcc_secure/openeuler_gcc_secure.opt.ld --specs=/usr/share/gcc_secure/openeuler_gcc_secure.opt.fs
fi
else
/usr/bin/gcc_normal "$@"
fi
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/shinwell_hu/gcc_secure.git
git@gitee.com:shinwell_hu/gcc_secure.git
shinwell_hu
gcc_secure
gcc_secure
master

搜索帮助