SHA256
3
0
forked from pool/glibc

Accepting request 864620 from home:Andreas_Schwab:Factory

- Remove support for %optimize_power
- Move to power4 baseline on ppc

OBS-URL: https://build.opensuse.org/request/show/864620
OBS-URL: https://build.opensuse.org/package/show/Base:System/glibc?expand=0&rev=576
This commit is contained in:
Andreas Schwab 2021-01-20 10:10:56 +00:00 committed by Git OBS Bridge
parent 71ba03d4de
commit 5f38c0099e
2 changed files with 47 additions and 216 deletions

View File

@ -1,3 +1,9 @@
-------------------------------------------------------------------
Tue Jan 19 13:52:09 UTC 2021 - Andreas Schwab <schwab@suse.de>
- Remove support for %optimize_power
- Move to power4 baseline on ppc
------------------------------------------------------------------- -------------------------------------------------------------------
Tue Dec 15 16:41:29 UTC 2020 - Andreas Schwab <schwab@suse.de> Tue Dec 15 16:41:29 UTC 2020 - Andreas Schwab <schwab@suse.de>

View File

@ -1,7 +1,7 @@
# #
# spec file for package glibc # spec file for package glibc
# #
# Copyright (c) 2020 SUSE LLC # Copyright (c) 2021 SUSE LLC
# #
# All modifications and additions to the file contributed by third parties # All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed # remain the property of their copyright owners, unless otherwise agreed
@ -109,29 +109,6 @@ BuildArch: i686
%define disable_assert 0 %define disable_assert 0
%define enable_stackguard_randomization 1 %define enable_stackguard_randomization 1
%ifarch ppc ppc64
%define optimize_power 1
%ifarch ppc
%define powerpc_optimize_base %{nil}
%define powerpc_optimize_tune power3
%define powerpc_optimize_cpu_power4 1
%else
%define powerpc_optimize_base %{nil}
%define powerpc_optimize_tune power5
%define powerpc_optimize_cpu_power4 0
%endif
# We are not building Power CPU specific optimizations for openSUSE.
%define powerpc_optimize_cpu_power6 0
%define powerpc_optimize_cpu_power7 0
%define powerpc_optimize_cpu_cell 0
%else
%define optimize_power 0
%define powerpc_optimize_base %{nil}
%define powerpc_optimize_cpu_power4 0
%define powerpc_optimize_cpu_power6 0
%define powerpc_optimize_cpu_power7 0
%define powerpc_optimize_cpu_cell 0
%endif
# glibc requires at least kernel 3.2 # glibc requires at least kernel 3.2
%define enablekernel 3.2 %define enablekernel 3.2
# some architectures need a newer kernel # some architectures need a newer kernel
@ -509,26 +486,6 @@ makedb: A program to create a database for nss
%patch3000 %patch3000
#
# Inconsistency detected by ld.so: dl-close.c: 719: _dl_close: Assertion `map->l_init_called' failed!
#
# Glibc 2.8 introduced the HP_TIMING element to the rtld_global_ro struct # definition.
# If the base is built without power4 the loader won't have this element in
# the struct whereas the power4/5/6/... libc will, so there will be a disconnect
# between the size of the rtld_global_ro struct between the two and dl_close
# ends up getting called incorrectly when it's actually attempting to call a
# resolver function. This is because the GLRO() macro simply attempts to
# compute an offset and gets the wrong one.
# Building the base glibc with --with-cpu=power4 solves this problem.
# But: ppc32 can not default to -mcpu=power4 because it would emit instructions
# which are not available on G3, G4 etc.
#
# We simply remove the power4 files, and build the base glibc for a generic powerpc cpu
# Additional cputuned libs can now be used on powerpc32
#
rm -fv sysdeps/powerpc/powerpc32/power4/hp-timing.c sysdeps/powerpc/powerpc32/power4/hp-timing.h
find . -name configure | xargs touch
%build %build
# Disable LTO due to a usage of top-level assembler that # Disable LTO due to a usage of top-level assembler that
# causes LTO issues (boo#1138807). # causes LTO issues (boo#1138807).
@ -597,6 +554,7 @@ BuildCCplus="%__cxx"
%endif %endif
%ifarch ppc ppc64 %ifarch ppc ppc64
BuildFlags="$(echo $BuildFlags | sed 's#-mminimal-toc##')" BuildFlags="$(echo $BuildFlags | sed 's#-mminimal-toc##')"
BuildFlags+=" -mtune=power5"
%endif %endif
%ifarch ppc64 %ifarch ppc64
BuildCC="$BuildCC -m64" BuildCC="$BuildCC -m64"
@ -617,33 +575,31 @@ BuildCCplus="%__cxx"
%define enable_stackguard_randomization 0 %define enable_stackguard_randomization 0
%endif %endif
configure_and_build_glibc() { #
local dirname="$1"; shift # Build base glibc
local cflags="$1"; shift #
mkdir "cc-$dirname" mkdir cc-base
cd "cc-$dirname" cd cc-base
%ifarch %arm aarch64 %ifarch %arm aarch64
# remove asynchronous-unwind-tables during configure as it causes # remove asynchronous-unwind-tables during configure as it causes
# some checks to fail spuriously on arm # some checks to fail spuriously on arm
conf_cflags="${cflags/-fasynchronous-unwind-tables/}" conf_cflags="${BuildFlags/-fasynchronous-unwind-tables/}"
conf_cflags="${conf_cflags/-funwind-tables/}" conf_cflags="${conf_cflags/-funwind-tables/}"
%else %else
conf_cflags="$cflags" conf_cflags="$BuildFlags"
%endif %endif
profile="--disable-profile"
%if %{build_profile} %if %{build_profile}
if [ "$dirname" = "base" ] ; then profile="--enable-profile"
profile="--enable-profile" %else
fi profile="--disable-profile"
%endif %endif
../configure \ ../configure \
CFLAGS="$conf_cflags" BUILD_CFLAGS="$conf_cflags" \ CFLAGS="$conf_cflags" BUILD_CFLAGS="$conf_cflags" \
CC="$BuildCC" CXX="$BuildCCplus" \ CC="$BuildCC" CXX="$BuildCCplus" \
--prefix=%{_prefix} \ --prefix=%{_prefix} \
--libexecdir=%{_libexecdir} --infodir=%{_infodir} \ --libexecdir=%{_libexecdir} --infodir=%{_infodir} \
$profile \ $profile \
"$@" \
--build=%{target} --host=%{target} \ --build=%{target} --host=%{target} \
%ifarch armv7hl ppc ppc64 ppc64le i686 x86_64 sparc sparc64 s390 s390x %ifarch armv7hl ppc ppc64 ppc64le i686 x86_64 sparc sparc64 s390 s390x
--enable-multi-arch \ --enable-multi-arch \
@ -651,6 +607,9 @@ configure_and_build_glibc() {
%ifarch mipsel %ifarch mipsel
--without-fp \ --without-fp \
%endif %endif
%ifarch ppc
--with-cpu=power4 \
%endif
%ifarch ppc64p7 %ifarch ppc64p7
--with-cpu=power7 \ --with-cpu=power7 \
%endif %endif
@ -670,53 +629,9 @@ configure_and_build_glibc() {
--enable-systemtap \ --enable-systemtap \
--disable-timezone-tools \ --disable-timezone-tools \
--disable-crypt --disable-crypt
# explicitly set CFLAGS to use the full CFLAGS (not the reduced one for configure) # explicitly set CFLAGS to use the full CFLAGS (not the reduced one for configure)
make %{?_smp_mflags} CFLAGS="$cflags" BUILD_CFLAGS="$cflags" make %{?_smp_mflags} CFLAGS="$BuildFlags" BUILD_CFLAGS="$BuildFlags"
cd .. cd ..
}
%if !%{optimize_power}
#
# Build base glibc
#
configure_and_build_glibc base "$BuildFlags"
%else
#
# Build POWER-optimized glibc
#
# First, base build:
pBuildFlags="$BuildFlags -mtune=%{powerpc_optimize_tune}"
%if "%{powerpc_optimize_base}" != ""
pBuildFlags+=" -mcpu=%{powerpc_optimize_base}"
%endif
%if "%{powerpc_optimize_base}" != ""
configure_and_build_glibc base "$pBuildFlags" --with-cpu=%{powerpc_optimize_base}
%else
# Use no default CPU
configure_and_build_glibc base "$pBuildFlags"
%endif
%if %{build_variants}
# Then other power variants:
for pcpu in \
%if %{powerpc_optimize_cpu_power4}
power4 \
%endif
%if %{powerpc_optimize_cpu_power6}
power6 \
%endif
%if %{powerpc_optimize_cpu_power7}
power7 \
%endif
; do
configure_and_build_glibc $pcpu "$BuildFlags -mcpu=$pcpu" \
--with-cpu=$pcpu
done
# Eventually, special Cell variant:
%if %{powerpc_optimize_cpu_cell}
configure_and_build_glibc ppc-cell-be "$BuildFlags -mcpu=cell"
%endif
%endif
%endif
# #
# Build html documentation # Build html documentation
@ -786,62 +701,8 @@ export STRIP_KEEP_SYMTAB=*.so*
# Install base glibc # Install base glibc
make %{?_smp_mflags} install_root=%{buildroot} install -C cc-base make %{?_smp_mflags} install_root=%{buildroot} install -C cc-base
install_optimized_variant() {
local dirname="$1"; shift
local subdir="$1"; shift
local subdir_up="$1"; shift
cd "cc-$dirname"
destdir=$RPM_BUILD_ROOT/%{_lib}/$subdir
mkdir -p $destdir
# Don't run a complete make install, we know which libraries
# we want
for lib in libc math/libm nptl/libpthread rt/librt nptl_db/libthread_db
do
libbase=${lib#*/}
libbaseso=$(basename $RPM_BUILD_ROOT/%{_lib}/${libbase}-*.so)
# Only install if different from base lib
if cmp -s ${lib}.so ../cc-base/${lib}.so; then
ln -sf $subdir_up/$libbaseso $destdir/$libbaseso
else
cp -a ${lib}.so $destdir/$libbaseso
fi
done
cd ..
cc-base/elf/ldconfig -vn $destdir
}
# Install power-optimized glibc
%if %{optimize_power}
%if %{powerpc_optimize_cpu_power4}
install_optimized_variant power4 power4 ".."
%endif
%if %{powerpc_optimize_cpu_power6}
install_optimized_variant power6 power6 ".."
%endif
%if %{powerpc_optimize_cpu_power7}
install_optimized_variant power7 power7 ".."
%endif
%if %{powerpc_optimize_cpu_cell}
install_optimized_variant ppc-cell-be ppc-cell-be ".."
%endif
%if %{powerpc_optimize_cpu_power6}
# power6 is compatible with power6x
# doing a directory symlink doesnt work, ldconfig follows them and accepts only the first real dir
if test -d %{buildroot}/%{_lib}/power6; then
mkdir -p %{buildroot}/%{_lib}/power6x
for i in %{buildroot}/%{_lib}/power6/*.so; do
b=$(basename $i)
ln -vs ../power6/$b %{buildroot}/%{_lib}/power6x/$b
done
cc-base/elf/ldconfig -vn %{buildroot}/%{_lib}/power6x
fi
%endif
%endif
# Install locales # Install locales
%if %{build_locales} %if %{build_locales}
# XXX Do not install locales in parallel!
cd cc-base cd cc-base
# localedef creates hardlinks to other locales if possible # localedef creates hardlinks to other locales if possible
# this will not work if we generate them in parallel. # this will not work if we generate them in parallel.
@ -1042,19 +903,11 @@ remove_dirs = {
"/%{_lib}/i686/", "/%{_lib}/i686/",
%endif %endif
%ifarch ppc ppc64 %ifarch ppc ppc64
%if !%{powerpc_optimize_cpu_power4}
"/%{_lib}/power4/", "/%{_lib}/ppc970/", "/%{_lib}/power4/", "/%{_lib}/ppc970/",
%endif
"/%{_lib}/power5/", "/%{_lib}/power5+/", "/%{_lib}/power5/", "/%{_lib}/power5+/",
%if !%{powerpc_optimize_cpu_power6}
"/%{_lib}/power6/", "/%{_lib}/power6x/", "/%{_lib}/power6/", "/%{_lib}/power6x/",
%endif
%if !%{powerpc_optimize_cpu_power7}
"/%{_lib}/power7/", "/%{_lib}/power7/",
%endif
%if !%{powerpc_optimize_cpu_cell}
"/%{_lib}/ppc-cell-be/", "/%{_lib}/ppc-cell-be/",
%endif
%endif %endif
"/%{_lib}/tls/" "/%{_lib}/tls/"
} }
@ -1218,34 +1071,6 @@ exit 0
/%{_lib}/libthread_db.so.1 /%{_lib}/libthread_db.so.1
/%{_lib}/libutil-%{libversion}.so /%{_lib}/libutil-%{libversion}.so
/%{_lib}/libutil.so.1 /%{_lib}/libutil.so.1
%define optimized_libs() \
%dir %attr(0755,root,root) /%{_lib}/%1\
/%{_lib}/%1/libc-%{libversion}.so\
/%{_lib}/%1/libc.so.6*\
/%{_lib}/%1/libm-%{libversion}.so\
/%{_lib}/%1/libm.so.6*\
/%{_lib}/%1/libpthread-%{libversion}.so\
/%{_lib}/%1/libpthread.so.0\
/%{_lib}/%1/librt-%{libversion}.so\
/%{_lib}/%1/librt.so.1\
/%{_lib}/%1/libthread_db-1.0.so\
/%{_lib}/%1/libthread_db.so.1
%if %{optimize_power}
%if %{powerpc_optimize_cpu_power4}
%{optimized_libs power4}
%endif
%if %{powerpc_optimize_cpu_power6}
%{optimized_libs power6}
%{optimized_libs power6x}
%endif
%if %{powerpc_optimize_cpu_power7}
%{optimized_libs power7}
%endif
%if %{powerpc_optimize_cpu_cell}
%{optimized_libs ppc-cell-be}
%endif
%endif
%dir %attr(0700,root,root) /var/cache/ldconfig %dir %attr(0700,root,root) /var/cache/ldconfig
/sbin/ldconfig /sbin/ldconfig
%{_bindir}/gencat %{_bindir}/gencat