!65 [sync] PR-64: gcc 支持安全编译选项

From: @openeuler-sync-bot
Reviewed-by: @haijianzhang
Signed-off-by: @haijianzhang
This commit is contained in:
openeuler-ci-bot 2021-03-27 15:55:44 +08:00 committed by Gitee
commit 4fbd6a9091

View File

@ -37,7 +37,7 @@
Summary: Various compilers (C, C++, Objective-C, Java, ...)
Name: gcc
Version: 7.3.0
Release: %{DATE}.36
Release: %{DATE}.37
License: GPLv3+ and GPLv3+ with exceptions and GPLv2+ with exceptions and LGPLv2+ and BSD
Group: Development/Languages
#Source0: hcc-aarch64-linux-release.tar.bz2
@ -614,7 +614,7 @@ export GCJ_PROPERTIES=jdt.compiler.useSingleThread=true
mkdir fastjar-%{fastjar_ver}/obj-%{gcc_target_platform}
cd fastjar-%{fastjar_ver}/obj-%{gcc_target_platform}
../configure CFLAGS="%{optflags}" --prefix=%{_prefix} --mandir=%{_mandir} --infodir=%{_infodir}
make -j100
make %{?_smp_mflags}
export PATH=`pwd`${PATH:+:$PATH}
cd ../../
%endif
@ -663,8 +663,8 @@ cd isl-build
../../isl-%{isl_version}/configure --disable-shared \
CC=/usr/bin/gcc CXX=/usr/bin/g++ \
CFLAGS="${CFLAGS:-%optflags} $ISL_FLAG_PIC" --prefix=`cd ..; pwd`/isl-install
make -j100
make -j100 install
make %{?_smp_mflags}
make %{?_smp_mflags} install
cd ..
mkdir cloog-build cloog-install
@ -685,8 +685,8 @@ cd -
--prefix=`cd ..; pwd`/cloog-install
sed -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' libtool
sed -i 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool
make -j100
make -j100 install
make %{?_smp_mflags}
make %{?_smp_mflags} install
cd ../cloog-install/lib
ln -sf libcloog-isl.so.4 libcloog-isl.so
ln -sf libcloog-isl.so.4 libcloog.so
@ -695,8 +695,7 @@ cd ../..
#test don't build
%if 1
CC=gcc
OPT_FLAGS=`echo %{optflags}|sed -e 's/\(-Wp,\)\?-D_FORTIFY_SOURCE=[12]//g'`
OPT_FLAGS=`echo $OPT_FLAGS|sed -e 's/-m64//g;s/-m32//g;s/-m31//g'`
OPT_FLAGS=`echo ${optflags}|sed -e 's/-m64//g;s/-m32//g;s/-m31//g'`
OPT_FLAGS=`echo $OPT_FLAGS|sed -e 's/-mfpmath=sse/-mfpmath=sse -msse2/g'`
OPT_FLAGS=`echo $OPT_FLAGS|sed -e 's/-Werror=format-security/ /g'`
OPT_FLAGS=`echo $OPT_FLAGS|sed -e 's/ -pipe / /g'`
@ -742,7 +741,7 @@ enablelada=,ada
%if %{build_go}
enablelgo=,go
%endif
OPT_FLAGS="$OPT_FLAGS -fPIE -Wl,-z,relro,-z,now"
OPT_FLAGS="$OPT_FLAGS -O2 -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector-strong -fPIE -Wl,-z,relro,-z,now"
OPT_LDFLAGS="$OPT_LDFLAGS -Wl,-z,relro,-z,now"
export extra_ldflags_libobjc="-Wl,-z,relro,-z,now"
export FCFLAGS="$OPT_FLAGS"
@ -792,7 +791,7 @@ perl -pi -e 's/head3/head2/' ../contrib/texi2pod.pl
for i in ../gcc/doc/*.texi; do
cp -a $i $i.orig; sed 's/ftable/table/' $i.orig > $i
done
make -j100 -C gcc generated-manpages
make %{?_smp_mflags} -C gcc generated-manpages
for i in ../gcc/doc/*.texi; do mv -f $i.orig $i; done
# Make generated doxygen pages.
@ -886,12 +885,12 @@ export PATH=`pwd`/java_hacks${PATH:+:$PATH}
TARGET_PLATFORM=%{gcc_target_platform}
# There are some MP bugs in libstdc++ Makefiles
make -j100 -C %{gcc_target_platform}/libstdc++-v3
make %{?_smp_mflags} -C %{gcc_target_platform}/libstdc++-v3
make -j100 prefix=%{buildroot}%{_prefix} mandir=%{buildroot}%{_mandir} \
make %{?_smp_mflags} prefix=%{buildroot}%{_prefix} mandir=%{buildroot}%{_mandir} \
infodir=%{buildroot}%{_infodir} install
%if %{build_java}
make -j100 DESTDIR=%{buildroot} -C %{gcc_target_platform}/libjava install-src.zip
make %{?_smp_mflags} DESTDIR=%{buildroot} -C %{gcc_target_platform}/libjava install-src.zip
%endif
%if %{build_ada}
chmod 644 %{buildroot}%{_infodir}/gnat*
@ -1082,7 +1081,7 @@ fi
%if %{build_java}
pushd ../fastjar-%{fastjar_ver}/obj-%{gcc_target_platform}
make -j100 install DESTDIR=%{buildroot}
make %{?_smp_mflags} install DESTDIR=%{buildroot}
popd
if [ "%{_lib}" != "lib" ]; then
@ -3285,6 +3284,12 @@ fi
%changelog
* Wed Mar 17 2021 tianwei <tianwei12@huawei.com> - 7.3.0-20210203.37
- Type:bugfix
- ID:NA
- SUG:NA
- DESC:add SP and FS for x86, replace -j100 with %{?_smp_mflags}
* Wed Feb 03 2021 eastb233 <xiezhiheng@huawei.com> - 7.3.0-20210203.36
- gcc.spec: Add libubsan, libubsan-static, liblsan, liblsan-static rpm packages