# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
+%if 0%{?run_tests}
+%define glibc_run_tests 1
+%endif
+
+# Enable this when testing on device to:
+# 1. Enable macro to turn on testsuite building ('glibc_run_tests 1')
+# 2. Keep 'build-dir/' folder in build stage as we do not want to rebuild all
+# glibc again on device after invoking rpmbuild --short-circuit -bc ...
+# 3. Skip configure and make commands and go directly to 'make check'
+%if 0%{?run_tests_on_device}
+%define glibc_run_tests 1
+%define glibc_keep_build_dir 1
+%define glibc_skip_configure 1
+%define glibc_skip_make 1
+%endif
+
+# Exit right after 'make ..' step to keep all object files produced by glibc build
+%if 0%{?exit_on_make_finish}
+%define glibc_exit_on_make_finish 1
+%endif
+
+%if 0%{?dump_configure}
+%define glibc_dump_configure 1
+%endif
+
# This will avoid building some parts of glibc
%define asan_arch x86_64 armv7l aarch64
%bcond_with fast_build
BuildRequires: gcc-c++
BuildRequires: gettext-tools
BuildRequires: libstdc++-devel
+BuildRequires: bison
+BuildRequires: python3-base
%{?asan:
%ifarch %asan_arch
#BuildRequires: python
BuildRequires: glibc-devel-static
%endif
}
+%if 0%{?glibc_dump_configure}
+BuildRequires: configure-dumper
+%endif
#BuildRequires: pkgconfig(systemd)
%define _filter_GLIBC_PRIVATE 1
%if %_target_cpu == "i686"
Provides: ld-linux.so.3
Provides: ld-linux.so.3(GLIBC_2.4)
%endif
-Version: 2.24
+Version: 2.30
Release: 0
-%define glibc_major_version 2.24
-%define git_id 4e42b5b8f89f
+%define glibc_major_version %{version}
+%define git_id 0a8262a1b2
Url: http://www.gnu.org/software/libc/libc.html
Source: glibc-%{version}.tar.xz
Source8: glibc_post_upgrade.c
Source9: glibc.rpmlintrc
Source10: baselibs.conf
-# For systemd
+# For systemd
Source1001: glibc.manifest
Requires(pre): filesystem
is no gurantee that they work for you, you should try to get newer
versions of your software.
+%package testresults
+Summary: Testsuite results
+License: LGPL-2.1+
+Group: Development/Languages
+%description testresults
+Results from running the glibc testsuites.
+
%{?asan:
%ifarch %asan_arch
%package asan
%endif
}
+%{?glibc_dump_configure:
+%package configure-dump
+Summary: GNU Glibc configure dump
+License: GPL-3.0+
+Group: Development/Languages
+%description configure-dump
+This package contains dump of configure variables of Glibc
+}
+
%prep
-%setup -n glibc-%{version} -q
+%setup -n glibc-%{version} -q
cp %{SOURCE1001} .
%build
#
BuildFlags=$(echo %{optflags} | sed -e "s/-Wp,-D_FORTIFY_SOURCE=2//g" | sed -e "s/-ffast-math//" | sed -e "s/atom/i686/g" | sed -e "s/-fexceptions//" | sed -e "s/-fno-omit-frame-pointer//" )
BuildFlags="$BuildFlags -O2 -g -U_FORTIFY_SOURCE"
-BuildFlags="$(echo $BuildFlags | sed -e 's#-fstack-protector##' -e 's#-ffortify=[0-9]*##')"
+BuildFlags="$(echo $BuildFlags | sed -e 's#-ffortify=[0-9]*##')"
+BuildFlags="$(echo $BuildFlags | sed -e 's#-fstack-protector-strong##')"
+BuildFlags="$(echo $BuildFlags | sed -e 's#-fstack-protector##')"
BuildFlags="$(echo $BuildFlags | sed -e 's/-Wa,-mimplicit-it=thumb//g' | sed -e 's/-mthumb//g')"
# Turn off all -Wformat enable flags as there are glibc tests that explicitly
# append -Wno-format and with enabled Wformat options that produced warnings
# that turns into errors. Remove -Wformat=1|2 or -Wformat-..-arg
BuildFlags="$(echo $BuildFlags | sed -re 's/-Wformat((=[1-2])|((-\w+)+))?(\s|$)//g')"
+%ifarch %arm
+# Support DA build with armv8 cpu in 32bit mode: prevent Werror on sqrt function
+(echo ${BuildFlags} | grep '\-march=armv8') && BuildFlags="${BuildFlags} -Wno-error=unused-variable"
+%endif
+
BuildCC="%__cc"
BuildCCplus="%__cxx"
add_ons=",libidn"
BuildFlags="$BuildFlags -g"
+
+%ifarch %arm
+# Glibc must have both functions' implementations
+BuildFlags="$BuildFlags -U_LARGEFILE_SOURCE -U_LARGEFILE64_SOURCE -U_FILE_OFFSET_BITS"
+%endif
%if %{disable_assert}
BuildFlags="$BuildFlags -DNDEBUG=1"
%endif
local dirname="$1"; shift
local cflags="$1"; shift
local addons="$1"; shift
+ %{!?glibc_keep_build_dir:
+ rm -rf "cc-$dirname"
+ }
mkdir "cc-$dirname"
cd "cc-$dirname"
conf_cflags="$cflags -funwind-tables -fPIC"
- %{?asan: conf_cflags="$conf_cflags -DASAN_INIT_FIRST "}
-
+ %{?asan: conf_cflags="$conf_cflags -DASAN_INIT_FIRST"}
+ %{?glibc_dump_configure:patch_configure.pl ..}
profile="--disable-profile"
%if %{build_profile}
if [ "$dirname" = "base" ] ; then
profile="--enable-profile"
fi
%endif
+%{!?glibc_skip_configure:
CFLAGS="$conf_cflags" BUILD_CFLAGS="$conf_cflags" \
CC="$BuildCC" CXX="$BuildCCplus" ../configure \
--prefix=%{_prefix} \
%ifnarch %{multiarcharches}
--disable-multi-arch \
%endif
-%ifarch %{ix86} x86_64
+%ifarch %{ix86} x86_64
--disable-mathvec \
%endif
--enable-kernel=%{enablekernel} \
--enable-bind-now --enable-obsolete-rpc \
--disable-nscd \
- libc_cv_pie_default=yes
- # explicitly set CFLAGS to use the full CFLAGS (not the reduced one for configure)
- make %{?_smp_mflags} #CFLAGS="$cflags" BUILD_CFLAGS="$cflags"
+ --disable-experimental-malloc \
+ libc_cv_cc_pie_default=yes
+ }
+%{!?glibc_skip_make:
+ make %{?_smp_mflags}
+ %{?glibc_dump_configure:
+ dump_configure.pl .. . \
+ --project glibc \
+ --project-version %{version} \
+ --out_db glibc-%{version}-%{release}-%_project-%_repository.db
+ }
+ %{?glibc_exit_on_make_finish:
+ exit 1
+ }
cd ..
+ }
}
configure_flags="--prefix=/usr --without-cvs --without-selinux --enable-stackguard-randomization --enable-obsolete-rpc --disable-mathvec"
unset CXXFLAGS
unset CFLAGS
unset LDFLAGS
+%ifarch %arm
+ # Glibc must have both functions' implementations
+ CPPFLAGS="-U_LARGEFILE_SOURCE -U_LARGEFILE64_SOURCE -U_FILE_OFFSET_BITS"
+%endif
+
#chmod +x $HERE/asan-glibc-gcc-wrapper.py
#build static wrapper, because we don't want asan to intercept allocators
g++ -o gcc-wrapper gcc-wrapper.cc -O3 -funroll-loops -fno-unwind-tables -fno-asynchronous-unwind-tables -fno-exceptions -static
mkdir -p $ASAN_BUILD
cd $ASAN_BUILD
# CC=$HERE/asan-glibc-gcc-wrapper.py $GLIBC/configure $configure_flags
+ CPPFLAGS=$CPPFLAGS \
CC=$HERE/gcc-wrapper $GLIBC/configure $configure_flags
# Quick build - builds only libraries, but does not create symlinks.
'-DREMOVE_TLS_DIRS' '-DREMOVE_PPC_OPTIMIZE_POWER5' \
'-DLIBDIR="/%{_lib}"' '-DGCONV_MODULES_DIR="%{_libdir}/gconv"'
+#
+# Build testsuite
+#
+# #check sections could be redefined/disabled, so keep this inside #build
+
+%{?glibc_run_tests:
+ export LD_AS_NEEDED=0
+ (make %{?_smp_mflags} -C cc-base check || true) 2>&1 | tee check.log
+}
+
#######################################################################
###
# Install base glibc
make %{?_smp_mflags} install_root=%{buildroot} install -C cc-base
+%{?glibc_dump_configure:
+ install -D -m 0644 cc-base/glibc-%{version}-%{release}-%_project-%_repository.db %{buildroot}%{_datadir}/glibc-%{version}-%{release}-%_project-%_repository.db
+}
+
install_optimized_variant() {
local dirname="$1"; shift
local subdir="$1"; shift
%endif
}
+%{?glibc_run_tests:
+ mkdir testresults
+ cp --parents $(find cc-base -name "*tests.sum") testresults/
+ cp check.log testresults/
+ chmod 644 $(find testresults/ -type f)
+}
+
%post -p %{_sbindir}/glibc_post_upgrade
%postun -p /sbin/ldconfig
/%{_lib}/libanl.so.1
/%{_lib}/libc-%{glibc_major_version}.so
/%{_lib}/libc.so.6*
-/%{_lib}/libcidn-%{glibc_major_version}.so
-/%{_lib}/libcidn.so.1
/%{_lib}/libcrypt-%{glibc_major_version}.so
/%{_lib}/libcrypt.so.1
/%{_lib}/libdl-%{glibc_major_version}.so
/%{_lib}/libnss_optfiles.so.2
/%{_lib}/libnss_hesiod-%{glibc_major_version}.so
/%{_lib}/libnss_hesiod.so.2
-/%{_lib}/libnss_nis-%{glibc_major_version}.so
-/%{_lib}/libnss_nis.so.2
-/%{_lib}/libnss_nisplus-%{glibc_major_version}.so
-/%{_lib}/libnss_nisplus.so.2
/%{_lib}/libpthread-%{glibc_major_version}.so
/%{_lib}/libpthread.so.0
/%{_lib}/libthread_db-1.0.so
%files devel
%manifest %{name}.manifest
%defattr(-,root,root)
-%license COPYING COPYING.LIB
-%doc NEWS README BUGS CONFORMANCE
+%license COPYING COPYING.LIB
+%doc NEWS README
%{_bindir}/rpcgen
%{_includedir}/*
%{_libdir}/*.o
# These static libraries are needed even for shared builds
%{_libdir}/libc_nonshared.a
%{_libdir}/libg.a
-%{_libdir}/libieee.a
%ifarch ppc ppc64 s390 s390x sparc sparcv8 sparcv9 sparcv9v
# This is not built on sparc64.
%{_libdir}/libnldbl_nonshared.a
%endif
%{_libdir}/libmcheck.a
-%{_libdir}/libpthread_nonshared.a
%{_libdir}/librpcsvc.a
%files devel-static
%{_libdir}/libcrypt.a
%{_libdir}/libdl.a
%{_libdir}/libm.a
-%{_libdir}/libnsl.a
%{_libdir}/libpthread.a
%{_libdir}/libresolv.a
%{_libdir}/librt.a
%{_libdir}/libcrypt_p.a
%{_libdir}/libpthread_p.a
%{_libdir}/libresolv_p.a
-%{_libdir}/libnsl_p.a
%{_libdir}/librt_p.a
%{_libdir}/librpcsvc_p.a
%{_libdir}/libutil_p.a
%{_bindir}/makedb
/var/db/Makefile
+%{?glibc_run_tests:
+%files testresults
+%defattr(-,root,root)
+%doc testresults/check.log
+%doc testresults/*
+}
+
+%{?glibc_dump_configure:
+%files configure-dump
+%manifest glibc.manifest
+%{_datadir}/glibc-%{version}-%{release}-%_project-%_repository.db
+}
%docs_package