Inherit as many flags as possible from redhat-rpm-config
This commit is contained in:
parent
ee109af432
commit
081ef32d63
131
glibc.spec
131
glibc.spec
|
@ -791,98 +791,38 @@ df
|
||||||
GCC=gcc
|
GCC=gcc
|
||||||
GXX=g++
|
GXX=g++
|
||||||
|
|
||||||
##############################################################################
|
# True if the compiler flag in the first argument is listed in
|
||||||
# %%build - x86 options.
|
# redhat-rpm-config.
|
||||||
##############################################################################
|
rpm_has_compiler_flag ()
|
||||||
# On x86 we build for the specific target cpu rpm is using.
|
{
|
||||||
%ifarch %{ix86}
|
echo " $RPM_OPT_FLAGS $RPM_LD_FLAGS " | grep -q -F " $1 "
|
||||||
BuildFlags="-march=%{_target_cpu} -mtune=generic"
|
}
|
||||||
%endif
|
|
||||||
# We don't support building for i386. The generic i386 architecture lacks the
|
|
||||||
# atomic primitives required for NPTL support. However, when a user asks to
|
|
||||||
# build for i386 we interpret that as "for whatever works on x86" and we
|
|
||||||
# select i686. Thus we treat i386 as an alias for i686.
|
|
||||||
%ifarch i386 i686
|
|
||||||
BuildFlags="-march=i686 -mtune=generic"
|
|
||||||
%endif
|
|
||||||
%ifarch i486 i586
|
|
||||||
BuildFlags="$BuildFlags -mno-tls-direct-seg-refs"
|
|
||||||
%endif
|
|
||||||
%ifarch x86_64
|
|
||||||
BuildFlags="-mtune=generic"
|
|
||||||
%endif
|
|
||||||
|
|
||||||
##############################################################################
|
# Propagates the listed flags to BuildFlags if supplied by redhat-rpm-config.
|
||||||
# %%build - s390 options.
|
BuildFlags="-O2 -g"
|
||||||
##############################################################################
|
rpm_inherit_flags ()
|
||||||
# The default is to tune for z13 (newer hardware), but build for zEC12.
|
{
|
||||||
%ifarch s390x
|
local flag
|
||||||
BuildFlags="-march=zEC12 -mtune=z13"
|
for flag in "$@" ; do
|
||||||
%endif
|
if rpm_has_compiler_flag "$flag" ; then
|
||||||
%ifarch s390
|
BuildFlags="$BuildFlags $flag"
|
||||||
BuildFlags="-march=zEC12 -mtune=z13"
|
fi
|
||||||
GCC="$GCC -m31"
|
done
|
||||||
GXX="$GXX -m31"
|
}
|
||||||
%endif
|
|
||||||
|
|
||||||
##############################################################################
|
# Propgate select compiler flags from redhat-rpm-config. These flags
|
||||||
# %%build - SPARC options.
|
# are target-dependent, so we use only those which are specified in
|
||||||
##############################################################################
|
# redhat-rpm-config. We do not replicate the -march=/-mtune=
|
||||||
%ifarch sparc
|
# selection here because these match the defaults compiled into GCC.
|
||||||
BuildFlags="-fcall-used-g6"
|
# We keep the -m32/-m32/-m64 flags to support multilib builds.
|
||||||
GCC="$GCC -m32"
|
|
||||||
GXX="$GXX -m32"
|
|
||||||
%endif
|
|
||||||
%ifarch sparcv9
|
|
||||||
BuildFlags="-mcpu=ultrasparc -fcall-used-g6"
|
|
||||||
GCC="$GCC -m32"
|
|
||||||
GXX="$GXX -m32"
|
|
||||||
%endif
|
|
||||||
%ifarch sparcv9v
|
|
||||||
BuildFlags="-mcpu=niagara -fcall-used-g6"
|
|
||||||
GCC="$GCC -m32"
|
|
||||||
GXX="$GXX -m32"
|
|
||||||
%endif
|
|
||||||
%ifarch sparc64
|
|
||||||
BuildFlags="-mcpu=ultrasparc -mvis -fcall-used-g6"
|
|
||||||
GCC="$GCC -m64"
|
|
||||||
GXX="$GXX -m64"
|
|
||||||
%endif
|
|
||||||
%ifarch sparc64v
|
|
||||||
BuildFlags="-mcpu=niagara -mvis -fcall-used-g6"
|
|
||||||
GCC="$GCC -m64"
|
|
||||||
GXX="$GXX -m64"
|
|
||||||
%endif
|
|
||||||
|
|
||||||
##############################################################################
|
rpm_inherit_flags \
|
||||||
# %%build - POWER options.
|
"-fasynchronous-unwind-tables" \
|
||||||
##############################################################################
|
"-fstack-clash-protection" \
|
||||||
%ifarch %{power64}
|
"-funwind-tables" \
|
||||||
BuildFlags=""
|
"-m31" \
|
||||||
GCC="$GCC -m64"
|
"-m32" \
|
||||||
GXX="$GXX -m64"
|
"-m64" \
|
||||||
%ifarch ppc64p7
|
|
||||||
GCC="$GCC -mcpu=power7 -mtune=power7"
|
|
||||||
GXX="$GXX -mcpu=power7 -mtune=power7"
|
|
||||||
core_with_options="--with-cpu=power7"
|
|
||||||
%endif
|
|
||||||
%ifarch ppc64le
|
|
||||||
GCC="$GCC -mcpu=power8 -mtune=power8"
|
|
||||||
GXX="$GXX -mcpu=power8 -mtune=power8"
|
|
||||||
core_with_options="--with-cpu=power8"
|
|
||||||
%endif
|
|
||||||
%endif
|
|
||||||
|
|
||||||
##############################################################################
|
|
||||||
# %%build - MIPS options.
|
|
||||||
##############################################################################
|
|
||||||
%ifarch mips mipsel
|
|
||||||
BuildFlags="-march=mips32r2 -mfpxx"
|
|
||||||
%endif
|
|
||||||
%ifarch mips64 mips64el
|
|
||||||
# Without -mrelax-pic-calls ld.so segfaults when built with -O3
|
|
||||||
BuildFlags="-march=mips64r2 -mabi=64 -mrelax-pic-calls"
|
|
||||||
%endif
|
|
||||||
|
|
||||||
##############################################################################
|
##############################################################################
|
||||||
# %%build - Generic options.
|
# %%build - Generic options.
|
||||||
|
@ -901,19 +841,12 @@ echo "$GCC" > Gcc
|
||||||
##############################################################################
|
##############################################################################
|
||||||
build()
|
build()
|
||||||
{
|
{
|
||||||
builddir=build-%{target}${1:+-$1}
|
local builddir=build-%{target}${1:+-$1}
|
||||||
${1+shift}
|
${1+shift}
|
||||||
rm -rf $builddir
|
rm -rf $builddir
|
||||||
mkdir $builddir
|
mkdir $builddir
|
||||||
pushd $builddir
|
pushd $builddir
|
||||||
build_CFLAGS="$BuildFlags -g -O2 $*"
|
../configure CC="$GCC" CXX="$GXX" CFLAGS="$BuildFlags $*" \
|
||||||
%ifnarch %{arm} riscv64
|
|
||||||
build_CFLAGS="$build_CFLAGS -fstack-clash-protection"
|
|
||||||
%endif
|
|
||||||
# Some configure checks can spuriously fail for some architectures if
|
|
||||||
# unwind info is present
|
|
||||||
configure_CFLAGS="$build_CFLAGS -fno-asynchronous-unwind-tables"
|
|
||||||
../configure CC="$GCC" CXX="$GXX" CFLAGS="$configure_CFLAGS" \
|
|
||||||
--prefix=%{_prefix} \
|
--prefix=%{_prefix} \
|
||||||
--with-headers=%{_prefix}/include $EnableKernel \
|
--with-headers=%{_prefix}/include $EnableKernel \
|
||||||
--enable-bind-now \
|
--enable-bind-now \
|
||||||
|
@ -938,7 +871,7 @@ build()
|
||||||
--disable-nss-crypt ||
|
--disable-nss-crypt ||
|
||||||
{ cat config.log; false; }
|
{ cat config.log; false; }
|
||||||
|
|
||||||
make %{?_smp_mflags} -O -r CFLAGS="$build_CFLAGS"
|
make %{?_smp_mflags} -O -r
|
||||||
popd
|
popd
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue