加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
glibc.spec 31.74 KB
一键复制 编辑 原始数据 按行查看 历史
dpd 提交于 2024-06-27 16:52 . loongarch64 architecture disable check
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989
%ifarch loongarch64
%bcond_with testsuite
%else
%bcond_without testsuite
%endif
%bcond_without benchtests
%bcond_with bootstrap
%bcond_without werror
%bcond_without valgrind
%if %{with bootstrap}
%undefine with_benchtests
%undefine with_werror
%undefine with_valgrind
%endif
# if we enable annobin plugin and enable its work, building of glibc will error with 'error: -D_FORTIFY_SOURCE not defined [-Werror]'
# if we enable annobin plugin and disale its work(like centos or fedora), we think it is meaningless
# so we disable annobin supports in whole building cycle directly.
%undefine _annotated_build
%undefine _auto_set_build_flags
%global __filter_GLIBC_PRIVATE 1
%global target %{_target_cpu}-%{_vendor}-linux
%bcond_without nscd
# debuginfo script relies debugedit does not change build id
%global _no_recompute_build_ids 1
%undefine _unique_build_ids
%global glibc_post_funcs %{expand:
function post_exec (msg, program, ...)
local pid = posix.fork ()
if pid == 0 then
posix.exec (program, ...)
io.stdout:write (msg)
assert (nil)
elseif pid > 0 then
posix.wait (pid)
end
end
function call_ldconfig ()
post_exec("Error: call to %{_prefix}/sbin/ldconfig failed.\n",
"%{_prefix}/sbin/ldconfig")
end
function update_gconv_modules_cache ()
local iconv_dir = "%{_libdir}/gconv"
local iconv_cache = iconv_dir .. "/gconv-modules.cache"
local iconv_modules = iconv_dir .. "/gconv-modules"
if posix.utime(iconv_modules) == 0 then
if posix.utime (iconv_cache) == 0 then
post_exec ("Error: call to %{_prefix}/sbin/iconvconfig failed.\n",
"%{_prefix}/sbin/iconvconfig",
"-o", iconv_cache,
"--nostdlib",
iconv_dir)
else
io.stdout:write ("Error: Missing " .. iconv_cache .. " file.\n")
end
end
end}
Summary: The GNU libc libraries
Name: glibc
Version: 2.38
Release: 14%{?dist}
License: LGPLv2+ and LGPLv2+ with exceptions and GPLv2+ and GPLv2+ with exceptions and BSD and Inner-Net and ISC and Public Domain and GFDL
URL: http://www.gnu.org/software/glibc/
Source0: https://ftp.gnu.org/gnu/glibc/%{name}-%{version}.tar.xz
Source1: bench.mk
Source2: glibc-bench-compare
# customize debuginfo
Source4: wrap-find-debuginfo.sh
# rpm -ql glibc-all-langpack.XXX.rpm | grep -E "\/usr\/share\/locale\/|\/usr\/lib\/locale\/" | awk -F"/" '{print $5}' | awk -F"_" '{print $1}' | sort | uniq | grep -v "locale-archive" > langpack.list
Source5: langpack.list
Source6: nscd.conf
# CVE-2023-4911
Patch0001: CVE-tunables-Terminate-if-end-of-input-is-reached-CVE-20.patch
Patch0002: CVE-2023-4806-getaddrinfo-Fix-use-after-free-in-getcanonname-CVE-2.patch
Patch0003: CVE-2023-5156-Fix-leak-in-getaddrinfo-introduced-by-the-fix-for-CV.patch
Patch0004: CVE-2023-4527-Stack-read-overflow-with-large-TCP-res.patch
Patch0005: CVE-2023-6246-syslog-Fix-heap-buffer-overflow-in-__vsyslog_interna.patch
Patch0006: CVE-2023-6779-syslog-Fix-heap-buffer-overflow-in-__vsyslog_interna.patch
Patch0007: CVE-2023-6780-syslog-Fix-integer-overflow-in-__vsyslog_internal-CV.patch
Patch0008: CVE-2024-2961-iconv-ISO-2022-CN-EXT-fix-out-of-bound-writes-when-w.patch
Patch0010: backport-libio-Fix-oversized-__io_vtables.patch
Patch0011: CVE-2024-33599-nscd-Stack-based-buffer-overflow-in-n.patch
Patch0012: CVE-2024-33600-nscd-Do-not-send-missing-not-found-re.patch
Patch0013: CVE-2024-33600-nscd-Avoid-null-pointer-crashes-after.patch
Patch0014: CVE-2024-33601-CVE-2024-33602-nscd-netgroup-Use-two-.patch
Patch3000: glibc-python3.patch
Patch3001: glibc-disable-werror-tst-realloc.patch
Patch3002: glibc-rh827510.patch
Patch3003: 3003-add-GB18030-2022-charmap-support.patch
Patch3004: LoongArch-Redefine-macro-LEAF-ENTRY.patch
Patch3005: LoongArch-Add-minuimum-binutils-required-version.patch
Patch3006: Loongarch-Add-ifunc-support-and-add-different-versio.patch
Patch3007: elf-Add-new-LoongArch-reloc-types-101-to-108-into-el.patch
Patch3008: LoongArch-elf-Add-new-LoongArch-reloc-types-109-into.patch
Patch3009: Loongarch-Add-ifunc-support-for-strchr-aligned-lsx-l.patch
Patch3010: Loongarch-Add-ifunc-support-for-memcpy-aligned-unali.patch
Patch3011: LoongArch-Add-ifunc-support-for-strnlen-aligned-lsx-.patch
Patch3012: LoongArch-Add-ifunc-support-for-strcmp-aligned-lsx.patch
Patch3013: LoongArch-Add-ifunc-support-for-strncmp-aligned-lsx.patch
Patch3014: LoongArch-Remove-support-code-for-old-linker-in-star.patch
Patch3015: LoongArch-Micro-optimize-LD_PCREL.patch
Patch3016: LoongArch-Add-ifunc-support-for-rawmemchr-aligned-ls.patch
Patch3017: LoongArch-Add-ifunc-support-for-memchr-aligned-lsx-l.patch
Patch3018: LoongArch-Add-ifunc-support-for-memrchr-lsx-lasx.patch
Patch3019: LoongArch-Add-ifunc-support-for-memset-aligned-unali.patch
Patch3020: LoongArch-Add-ifunc-support-for-memcmp-aligned-lsx-l.patch
Patch3021: LoongArch-Change-loongarch-to-LoongArch-in-comments.patch
Patch3022: LoongArch-Add-lasx-lsx-support-for-_dl_runtime_profi.patch
Patch3023: LoongArch-Replace-deprecated-v0-with-a0-to-eliminate.patch
Patch3024: LoongArch-Add-ifunc-support-for-strcpy-stpcpy-aligne.patch
Patch3025: LoongArch-Add-ifunc-support-for-strrchr-aligned-lsx-.patch
Patch3026: LoongArch-Change-to-put-magic-number-to-.rodata-sect.patch
Patch3027: LoongArch-Add-glibc.cpu.hwcap-support.patch
Patch3028: Revert-LoongArch-Add-glibc.cpu.hwcap-support.patch
Patch3029: LoongArch-Unify-Register-Names.patch
Patch3030: LoongArch-Update-hwcap.h-to-sync-with-LoongArch-kern.patch
Patch3031: linux-Sync-Linux-6.6-elf.h.patch
Patch3032: Decrease-value-of-arch_minimum_kernel-with-LoongArch.patch
Patch5000: 5000-one-china-principle.patch
Provides: ldconfig, rtld(GNU_HASH)
Provides: glibc-gconv-extra
Provides: /sbin/ldconfig
Provides: /usr/sbin/ldconfig
BuildRequires: glibc-devel procps-ng, util-linux, gawk, systemtap-sdt-devel
BuildRequires: audit-libs-devel >= 1.1.3, sed >= 3.95, libcap-devel, gettext, bison >= 2.7
BuildRequires: python3 python3-devel, gcc >= 7.2.1-6, make >= 4.0, binutils >= 2.30-17
%if %{without bootstrap}
BuildRequires: gd-devel libpng-devel zlib-devel
BuildRequires: libselinux-devel >= 1.33.4-3
%if %{with valgrind}
BuildRequires: valgrind
%endif
%if %{with testsuite}
BuildRequires: diffutils gcc-c++ libstdc++-static glibc-static libidn2 perl-interpreter
%endif
%endif
Requires: libgcc, glibc-common = %{version}-%{release}, basesystem
Requires: glibc-langpack = %{version}-%{release}
%description
The GNU C Library project provides the core libraries for the GNU
system and GNU/Linux systems, as well as many other systems that use
Linux as the kernel. These libraries provide critical APIs including
ISO C11, POSIX.1-2008, BSD, OS-specific APIs and more. These APIs
include such foundational facilities as open, read, write, malloc,
printf, getaddrinfo, dlopen, pthread_create, crypt, login, exit and more.
%package -n libnsl
Summary: Legacy support library for NIS
Requires: %{name} = %{version}-%{release}
%description -n libnsl
This package provides libnsl library for accessing NIS services.
If you want to use IPV6, try libnsl2.
%package devel
Summary: Object files for development using standard C libraries.
BuildRequires: kernel-headers >= 3.2
Requires: %{name} = %{version}-%{release}
Requires: libxcrypt-devel >= 4.0.0
Requires: kernel-headers >= 3.2
Provides: %{name}-headers = %{version}-%{release}
Provides: %{name}-static = %{version}-%{release}
%description devel
This package provides object and header files for developers who
use glibc libraries.
%package common
Summary: Common binaries and locale data for glibc
Requires: %{name} = %{version}-%{release}
Requires: tzdata >= 2003a
Provides: %{name}-langpack = %{version}-%{release}
Provides: %{name}-langpack-zh = %{version}-%{release}
Provides: %{name}-langpack-en = %{version}-%{release}
%description common
The glibc-common package includes common binaries for the GNU libc
libraries, as well as national language (locale) support.
%transfiletriggerin common -P 2000000 -p <lua> -- /lib /usr/lib /lib64 /usr/lib64
%glibc_post_funcs
call_ldconfig()
%end
%transfiletriggerpostun common -P 2000000 -p <lua> -- /lib /usr/lib /lib64 /usr/lib64
%glibc_post_funcs
call_ldconfig()
%end
%undefine __brp_ldconfig
%package locale-source
Summary: The sources for the locales
Requires: %{name} = %{version}-%{release}
Requires: %{name}-common = %{version}-%{release}
%description locale-source
This package provides sources of all locales in all-langpacks.
%package all-langpacks
Summary: All language packs for %{name}.
Requires: %{name} = %{version}-%{release}
Requires: %{name}-common = %{version}-%{release}
Provides: %{name}-langpack = %{version}-%{release}
%{lua:
lang_provides = {}
for line in io.lines(rpm.expand("%{SOURCE5}")) do
print(rpm.expand([[
Provides:%{name}-langpack-]]..line..[[ = %{version}-%{release}
]]))
end
}
%description all-langpacks
This package provides 'ALL' locales which can be used in GNU C library
internationally.
%package gconv-extra
Summary: All iconv converter modules for %{name}.
Requires: %{name} = %{version}-%{release}
Requires: %{name}-common = %{version}-%{release}
%description gconv-extra
This package providess all iconv converter modules built in GNU C library.
%if %{with nscd}
%package -n nscd
Summary: Name caching service daemon.
BuildRequires: systemd-rpm-macros
Requires: %{name} = %{version}-%{release}
Requires: libselinux >= 1.17.10
Requires: audit-libs >= 1.1.3
Requires: systemd
Requires(pre): shadow-utils, coreutils
Requires(postun): shadow-utils
%description -n nscd
The nscd package is able to daemon caches name service lookups and improve
the performance with LDAP.
%endif
%package nss
Summary: Name Service Switch (NSS) module using hash-indexed files
Requires: %{name} = %{version}-%{release}
Provides: nss_db = %{version}-%{release}
Provides: nss_hesiod = %{version}-%{release}
%description nss
This package provides the ability of name lookup with the help of db.
%package nss-devel
Summary: Development files for directly linking NSS service modules
Requires: %{name} = %{version}-%{release}
Requires: nss_db = %{version}-%{release}
Requires: nss_hesiod = %{version}-%{release}
%description nss-devel
This package provides object files to developers that need to use
nss.
%package utils
Summary: Development utilities from GNU C library
Requires: %{name} = %{version}-%{release}
%description utils
This package provides some tools which can be used when debugging.
%if %{with benchtests}
%package benchtests
Summary: Benchmarking binaries and scripts for %{name}
%description benchtests
This package provides some build-in benchmark testcases which can be run
on system.
%endif
%package source
Summary: source included %{_vendor} patch
BuildRequires: tar, xz
BuildArch: noarch
%description source
This package provides source included %{_vendor} patch
for cross toolchains
%prep
%autosetup -n %{name}-%{version} -p1
chmod +x benchtests/scripts/*.py scripts/pylint
find . -type f -size 0 -o -name "*.orig" -delete
touch `find . -name configure`
touch locale/programs/*-kw.h
tar acvf %{name}-%{version}-%{release}.tar.xz *
# rewriting the definition of __debug_install_post.
# reserve the debuginfo in ld.so
%{lua:
local wrapper = rpm.expand("%{SOURCE4}")
local sysroot = rpm.expand("%{buildroot}")
local original = rpm.expand("%{macrobody:__debug_install_post}")
-- Strip leading newline. It confuses the macro redefinition.
-- Avoid embedded newlines that confuse the macro definition.
original = original:match("^%s*(.-)%s*$"):gsub("\\\n", "")
rpm.define("__debug_install_post bash " .. wrapper
.. " " .. sysroot .. " " .. original)
}
%build
reference=" \
"-Wp,-D_GLIBCXX_ASSERTIONS" \
"-fasynchronous-unwind-tables" \
"-fstack-clash-protection" \
"-funwind-tables" \
"-m64" \
"-march=armv8-a+lse" \
"-march=armv8.1-a" \
"-march=haswell" \
"-march=x86-64" \
"-march=x86-64-v2" \
"-march=x86-64-v3" \
"-march=x86-64-v4" \
"-mcpu=power8" \
"-mcpu=power9" \
"-mbranch-protection=standard" \
"-mfpmath=sse" \
"-msse2" \
"-mstackrealign" \
"-mtune=generic" \
"-mtune=power8" \
"-mtune=power9" "
BuildFlags="-O2 -g"
for flag in $RPM_OPT_FLAGS $RPM_LD_FLAGS ; do
if echo "$reference" | grep -q -F " $flag " ; then
BuildFlags="$BuildFlags $flag"
fi
done
rm -rf build-%{target}
mkdir build-%{target}
pushd build-%{target}
%if 0%{?_annotated_build} > 0
# this will enable annobin plugin of gcc but it will not work.
BuildFlagsNonshared = "-fplugin=annobin -fplugin-arg-annobin-disable -Wa,--generate-missing-build-notes=yes"
%endif
../configure CC=gcc CXX=g++ CFLAGS="$BuildFlags" \
--prefix=%{_prefix} \
--with-headers=%{_prefix}/include \
--enable-kernel=3.2 \
--with-nonshared-cflags="${BuildFlagsNonshared}" \
--enable-bind-now \
--build=%{target} \
--enable-stack-protector=strong \
--enable-multi-arch \
--enable-systemtap \
%ifarch x86_64
--enable-cet \
%endif
%if %{without werror}
--disable-werror \
%endif
%if %{with bootstrap}
--without-selinux \
%endif
--disable-profile \
%ifarch aarch64
--enable-memory-tagging \
%endif
--disable-crypt \
%if %{without nscd}
--disable-build-nscd \
--disable-nscd
%endif
||
{ cat config.log; false; }
# in commit e47de5cb (Do not use --hash-style=both for building glibc shared objects),
# glibc upstream remove default --hash-style=both. We keep in spec to maintain compatibility.
# However, we have no commitment to maintain this operation permanently, we suggest all
# the user consider to switch to --hash-style=gnu
env LDFLAGS.so="-Wl,--hash-style=both" \
LDFLAGS-rtld="-Wl,--hash-style=both" \
%make_build -r ASFLAGS="-g -Wa,--generate-missing-build-notes=yes"
popd
%install
%ifarch riscv64
for d in %{buildroot}%{_libdir} %{buildroot}/%{_lib}; do
mkdir -p $d
(cd $d && ln -sf . lp64d)
done
%endif
pushd build-%{target}
%make_build install_root=%{buildroot} install
%make_build install_root=%{buildroot} \
install-locale-files -C ../localedata objdir=`pwd`
popd
hardlink %{buildroot}/usr/lib/locale
rm -f %{buildroot}/%{_libdir}/libNoVersion*
rm -f %{buildroot}/%{_lib}/libNoVersion*
rm -f %{buildroot}/%{_lib}/libnss1-*
rm -f %{buildroot}/%{_lib}/libnss-*.so.1
rm -f %{buildroot}/usr/sbin/sln
rm -f %{buildroot}/sbin/sln
mkdir -p %{buildroot}/var/cache/ldconfig
touch %{buildroot}/var/cache/ldconfig/aux-cache
%{buildroot}/sbin/ldconfig -N -r %{buildroot}
olddir=`pwd`
pushd %{buildroot}%{_prefix}/lib/locale
rm -f locale-archive
$olddir/build-%{target}/elf/ld.so \
--library-path $olddir/build-%{target}/ \
$olddir/build-%{target}/locale/localedef \
--alias-file=$olddir/intl/locale.alias \
--prefix %{buildroot} --add-to-archive \
eo *_*
ln locale-archive locale-archive.real
popd
%{find_lang} libc
%if %{with nscd}
install -m644 nscd/nscd.conf %{buildroot}/etc
mkdir -p %{buildroot}%{_tmpfilesdir}
install -m644 %{SOURCE6} %{buildroot}%{_tmpfilesdir}
mkdir -p %{buildroot}/lib/systemd/system
install -m 644 nscd/nscd.service %{buildroot}/lib/systemd/system
mkdir -p %{buildroot}/var/{db,run}/nscd
touch %{buildroot}/var/{db,run}/nscd/{passwd,group,hosts,services}
touch %{buildroot}/var/run/nscd/nscd.pid
%endif
touch %{buildroot}/etc/ld.so.cache
echo 'include ld.so.conf.d/*.conf' > %{buildroot}/etc/ld.so.conf
chmod 644 %{buildroot}/etc/ld.so.conf
mkdir -p %{buildroot}/etc/ld.so.conf.d
touch %{buildroot}/etc/gai.conf
touch %{buildroot}%{_libdir}/gconv/gconv-modules.cache
chmod 644 %{buildroot}%{_libdir}/gconv/gconv-modules.cache
rm -rf %{buildroot}%{_prefix}/share/zoneinfo
touch -r %{SOURCE0} %{buildroot}/etc/ld.so.conf
touch -r inet/etc.rpc %{buildroot}/etc/rpc
%if %{with benchtests}
pushd build-%{target}
make BENCH_DURATION=1 bench-build
popd
mkdir -p %{buildroot}%{_prefix}/libexec/glibc-benchtests
cp $(find build-%{target}/benchtests -type f -executable) %{buildroot}%{_prefix}/libexec/glibc-benchtests/
cp {%{SOURCE1},%{SOURCE2}} %{buildroot}%{_prefix}/libexec/glibc-benchtests/
cp benchtests/scripts/{benchout.schema.json,benchout.schema.json,compare_bench.py,import_bench.py,validate_benchout.py} \
%{buildroot}%{_prefix}/libexec/glibc-benchtests/
%endif
pushd locale
ln -s programs/*.gperf .
popd
pushd iconv
ln -s ../locale/programs/charmap-kw.gperf .
popd
mkdir -p %{buildroot}%{_libdir}
mv -f %{buildroot}/%{_lib}/lib{pcprofile,memusage}.so \
%{buildroot}%{_libdir}
strip -g %{buildroot}%{_libdir}/*.o
for i in %{buildroot}%{_prefix}/bin/{xtrace,memusage}; do
%if %{with bootstrap}
test -w $i || continue
%endif
sed -e 's#=/%{_lib}\/libpcprofile.so#=%{_libdir}/libpcprofile.so#' \
-e 's#=/%{_lib}/libmemusage.so#=%{_libdir}/libmemusage.so#' \
-e 's#='\''/\\\$LIB/libpcprofile.so#='\''%{_prefix}/\\$LIB/libpcprofile.so#' \
-e 's#='\''/\\\$LIB/libmemusage.so#='\''%{_prefix}/\\$LIB/libmemusage.so#' \
-i $i
done
{
find %{buildroot} \( -type f -o -type l \) \
\( \
-name etc -printf "%%%%config " -o \
-name gconv-modules.cache \
-printf "%%%%verify(not md5 size mtime) " -o \
-name gconv-modules* \
-printf "%%%%verify(not md5 size mtime) %%%%config(noreplace) " \
, \
! -path "*/lib/debug/*" -printf "/%%P\n" \)
find %{buildroot} -type d \
\( -path '*%{_prefix}/share/locale' -prune -o \
\( -path '*%{_prefix}/share/*' -o \
-path "*%{_prefix}/include/*" \
\) -printf "%%%%dir /%%P\n" \)
} | {
sed -e '\,.*/share/locale/\([^/_]\+\).*/LC_MESSAGES/.*\.mo,d' \
-e '\,.*/share/i18n/locales/.*,d' \
-e '\,.*/share/i18n/charmaps/.*,d' \
-e '\,.*/etc/\(localtime\|nsswitch.conf\|ld\.so\.conf\|ld\.so\.cache\|default\|rpc\|gai\.conf\),d' \
-e '\,.*/%{_libdir}/lib\(pcprofile\|memusage\)\.so,d' \
-e '\,.*/bin/\(memusage\|mtrace\|xtrace\|pcprofiledump\),d'
} | sort > master.filelist
chmod 0444 master.filelist
cat master.filelist \
| grep -v \
-e '%{_libdir}/lib.*_p.a' \
-e '%{_prefix}/include' \
-e '%{_libdir}/lib.*\.a' \
-e '%{_libdir}/.*\.o' \
-e '%{_libdir}/lib.*\.so' \
-e '%{_prefix}/bin' \
-e '%{_prefix}/lib/locale' \
-e '%{_prefix}/sbin/[^i]' \
-e '%{_prefix}/share' \
-e '/var/db/Makefile' \
-e '/libnss_.*\.so[0-9.]*$' \
-e 'glibc-benchtests' \
%if %{with nscd}
-e 'nscd' \
%endif
-e 'aux-cache' \
> glibc.filelist
for module in compat files dns; do
cat master.filelist \
| grep -E \
-e "/libnss_$module(\.so\.[0-9.]+|-[0-9.]+\.so)$" \
>> glibc.filelist
done
grep -e "libmemusage.so" -e "libpcprofile.so" master.filelist >> glibc.filelist
grep '%{_libdir}/lib.*\.a' master.filelist > devel.filelist
grep '%{_libdir}/.*\.o' < master.filelist >> devel.filelist
grep '%{_libdir}/lib.*\.so' < master.filelist >> devel.filelist
sed -i -e '\,libmemusage.so,d' \
-e '\,libpcprofile.so,d' \
-e '\,/libnss_[a-z]*\.so$,d' \
devel.filelist
grep '%{_prefix}/include' master.filelist >> devel.filelist
grep '%{_prefix}/bin' master.filelist >> common.filelist
grep '%{_prefix}/sbin' master.filelist \
| grep -v '%{_prefix}/sbin/iconvconfig' \
%if %{with nscd}
| grep -v 'nscd' \
%endif
>> common.filelist
grep '%{_prefix}/share' master.filelist \
| grep -v \
-e '%{_prefix}/share/info/libc.info.*' \
-e '%%dir %{prefix}/share/info' \
-e '%%dir %{prefix}/share' \
-e '%{_docdir}' \
>> common.filelist
cat > utils.filelist <<EOF
%if %{without bootstrap}
%{_prefix}/bin/memusage
%{_prefix}/bin/memusagestat
%endif
%{_prefix}/bin/mtrace
%{_prefix}/bin/pcprofiledump
%{_prefix}/bin/xtrace
EOF
grep -E "/libnss_(db|hesiod)\\.so\\.[0-9.]+\$" master.filelist > nss.filelist
grep -E "%{_prefix}/bin/makedb$" master.filelist >> nss.filelist
grep '/libnss_[a-z]*\.so$' master.filelist > nss-devel.filelist
%if %{with benchtests}
find build-%{target}/benchtests -type f -executable | grep -w -v '.build' | while read b; do
echo "%{_prefix}/libexec/glibc-benchtests/$(basename $b)"
done >> benchtests.filelist
echo "%{_prefix}/libexec/glibc-benchtests/$(basename %{SOURCE1})" >> benchtests.filelist
echo "%{_prefix}/libexec/glibc-benchtests/$(basename %{SOURCE2})" >> benchtests.filelist
echo "%{_prefix}/libexec/glibc-benchtests/benchout.schema.json" >> benchtests.filelist
echo "%{_prefix}/libexec/glibc-benchtests/compare_bench.py*" >> benchtests.filelist
echo "%{_prefix}/libexec/glibc-benchtests/import_bench.py*" >> benchtests.filelist
echo "%{_prefix}/libexec/glibc-benchtests/validate_benchout.py*" >> benchtests.filelist
%endif
echo '%{_prefix}/sbin/nscd' > nscd.filelist
mkdir -p %{buildroot}%{_usrsrc}/%{name}
cp -f %{name}-%{version}-%{release}.tar.xz %{buildroot}%{_usrsrc}/%{name}/
%check
%if %{with testsuite}
pushd build-%{target}
export TIMEOUTFACTOR=16
parent=$$
%make_build check |& tee build_check.log >&2
if ! grep -q '^Summary of test results:$' build_check.log || ! test -s tests.sum ; then
echo "FAILED: test suite build failed!" >& 2
exit 1
fi
set +x
grep -v ^PASS: tests.sum > build.tests.sum.not-passing || true
if test -s build.tests.sum.not-passing ; then
while read failed_code failed_test ; do
for suffix in out test-result ; do
if test -e "$failed_test.$suffix"; then
echo >&2
echo "=====$failed_code $failed_test.$suffix=====" >&2
cat -- "$failed_test.$suffix" >&2
echo >&2
fi
done
done <build.tests.sum.not-passing
fi
set -x
popd
PLTCMD='/^Relocation section .*\(\.rela\?\.plt\|\.rela\.IA_64\.pltoff\)/,/^$/p'
echo ====================PLT RELOCS LD.SO================
readelf -Wr %{buildroot}/%{_lib}/ld-*.so | sed -n -e "$PLTCMD"
echo ====================PLT RELOCS LIBC.SO==============
readelf -Wr %{buildroot}/%{_lib}/libc-*.so | sed -n -e "$PLTCMD"
echo ====================PLT RELOCS END==================
# run the dynamic loader.
ldso_path="$(find %{buildroot}/ -regextype posix-extended \
-regex '.*/ld(-.*|64|)\.so\.[0-9]+$' -type f | LC_ALL=C sort | head -n1)"
run_ldso="$ldso_path --library-path %{buildroot}/%{_lib}"
LD_SHOW_AUXV=1 $run_ldso /bin/true
%if 0%{?_enable_debug_packages}
# Finally, check if valgrind runs with the new glibc.
# We want to fail building if valgrind can not run with this glibc so
# that we can fix it before updating glibc.
%if %{with valgrind}
$run_ldso /usr/bin/valgrind --error-exitcode=1 \
$run_ldso /usr/bin/true
# true --help performs some memory allocations.
$run_ldso /usr/bin/valgrind --error-exitcode=1 \
$run_ldso /usr/bin/true --help >/dev/null
# with valgrind
%endif
# _enable_debug_packages
%endif
# with testsuite
%endif
%if %{with nscd}
%pre -n nscd
getent group nscd >/dev/null || /usr/sbin/groupadd -g 28 -r nscd
getent passwd nscd >/dev/null ||
/usr/sbin/useradd -M -o -r -d / -s /sbin/nologin \
-c "NSCD Daemon" -u 28 -g nscd nscd
%post -n nscd
%systemd_post nscd.service
%preun -n nscd
%systemd_preun nscd.service
%postun -n nscd
if test $1 = 0; then
/usr/sbin/userdel nscd > /dev/null 2>&1 || :
fi
%systemd_postun_with_restart nscd.service
%endif
%post -p <lua>
%glibc_post_funcs
-- (1) Remove multilib libraries from previous installs.
install_libs = { "anl", "BrokenLocale", "c", "dl", "m", "mvec",
"nss_compat", "nss_db", "nss_dns", "nss_files",
"nss_hesiod", "pthread", "resolv", "rt", "SegFault",
"thread_db", "util" }
remove_regexps = {}
for i = 1, #install_libs do
remove_regexps[#remove_regexps + 1] = ("lib" .. install_libs[i]
.. "%%-[2-9]%%.[0-9]+%%.so$")
remove_regexps[#remove_regexps + 1] = ("lib" .. install_libs[i]
.. "%%.so%%.[0-9]+$")
end
remove_regexps[#install_libs + 1] = "libthread_db%%-1%%.0%%.so"
remove_regexps[#install_libs + 2] = "libSegFault%%.so"
local remove_dirs = { "%{_libdir}/i686",
"%{_libdir}/i686/nosegneg",
"%{_libdir}/power6",
"%{_libdir}/power7",
"%{_libdir}/power8",
"%{_libdir}/power9",
}
repeat
local iter = posix.files("%{_libdir}/glibc-hwcaps")
if iter ~= nil then
for entry in iter do
if entry ~= "." and entry ~= ".." then
local path = "%{_libdir}/glibc-hwcaps/" .. entry
if posix.access(path .. "/.", "x") then
remove_dirs[#remove_dirs + 1] = path
end
end
end
end
until true
for _, rdir in ipairs (remove_dirs) do
if posix.access (rdir) then
local remove_files = posix.files (rdir)
for rfile in remove_files do
for _, rregexp in ipairs (remove_regexps) do
local dso = string.match (rfile, rregexp)
if (dso ~= nil) then
os.remove (rdir .. '/' .. rfile)
end
end
end
end
end
-- (2) Update /etc/ld.so.conf
local ldsoconf = "/etc/ld.so.conf"
local ldsoconf_tmp = "/etc/glibc_post_upgrade.ld.so.conf"
if posix.access (ldsoconf) then
local have_include = false
for line in io.lines (ldsoconf) do
if string.match (line, "^include ld.so.conf.d/%%*%%.conf$") ~= nil then
have_include = true
end
end
if not have_include then
local tmp_fd = io.open (ldsoconf_tmp, "w")
if tmp_fd ~= nil then
tmp_fd:write ("include ld.so.conf.d/*.conf\n")
for line in io.lines (ldsoconf) do
tmp_fd:write (line .. "\n")
end
tmp_fd:close ()
local res = os.rename (ldsoconf_tmp, ldsoconf)
if res == nil then
io.stdout:write ("Error: Unable to update configuration file (rename).\n")
end
else
io.stdout:write ("Error: Unable to update configuration file (open).\n")
end
end
end
-- (3) Rebuild ld.so.cache early.
call_ldconfig()
-- (4) Update gconv modules cache.
update_gconv_modules_cache()
-- (5) On upgrades, restart systemd if installed. "systemctl -q" does
if tonumber(arg[2]) >= 2
and posix.access("%{_prefix}/bin/systemctl", "x")
then
local pid = posix.fork()
if pid == 0 then
posix.redirect2null(2)
posix.exec("%{_prefix}/bin/systemctl", "daemon-reexec")
elseif pid > 0 then
posix.wait(pid)
end
end
%posttrans all-langpacks -e -p <lua>
local archive_path = "%{_prefix}/lib/locale/locale-archive"
local real_path = "%{_prefix}/lib/locale/locale-archive.real"
local stat_archive = posix.stat(archive_path)
local stat_real = posix.stat(real_path)
if stat_archive ~= nil and stat_real ~= nil
and (stat_archive.ino ~= stat_real.ino
or stat_archive.dev ~= stat_real.dev) then
posix.unlink(archive_path)
stat_archive = nil
end
if stat_archive == nil then
posix.link(real_path, archive_path)
end
local save_path = archive_path .. ".rpmsave"
if posix.access(save_path) then
posix.unlink(save_path)
end
%postun -p <lua>
%glibc_post_funcs
update_gconv_modules_cache ()
%files -f glibc.filelist
%license COPYING COPYING.LIB LICENSES
%dir %{_prefix}/%{_lib}/audit
%verify(not md5 size mtime) %config(noreplace) /etc/ld.so.conf
%verify(not md5 size mtime) %config(noreplace) /etc/rpc
%dir /etc/ld.so.conf.d
%dir %{_prefix}/libexec/getconf
%dir %{_libdir}/gconv
%dir %{_libdir}/gconv/gconv-modules.d
%dir %attr(0700,root,root) /var/cache/ldconfig
%attr(0600,root,root) %verify(not md5 size mtime) %ghost %config(missingok,noreplace) /var/cache/ldconfig/aux-cache
%attr(0644,root,root) %verify(not md5 size mtime) %ghost %config(missingok,noreplace) /etc/ld.so.cache
%attr(0644,root,root) %verify(not md5 size mtime) %ghost %config(missingok,noreplace) /etc/gai.conf
%files -f common.filelist common
%dir %{_prefix}/lib/locale
%dir %{_prefix}/lib/locale/C.utf8
%{_prefix}/lib/locale/C.utf8/*
%{_prefix}/lib/locale/zh*
%{_prefix}/lib/locale/en*
%{_prefix}/share/locale/en*
%{_prefix}/share/locale/zh*
%files -f libc.lang all-langpacks
%{_prefix}/lib/locale
%{_prefix}/lib/locale/locale-archive
%{_prefix}/lib/locale/locale-archive.real
%exclude %{_prefix}/lib/locale/C.utf8
%exclude %{_prefix}/lib/locale/zh*
%exclude %{_prefix}/lib/locale/en*
%exclude %{_prefix}/share/locale/zh*
%exclude %{_prefix}/share/locale/en*
%files locale-source
%dir %{_prefix}/share/i18n/locales
%{_prefix}/share/i18n/locales/*
%dir %{_prefix}/share/i18n/charmaps
%{_prefix}/share/i18n/charmaps/*
%files -f devel.filelist devel
%files -f utils.filelist utils
%if %{with nscd}
%files -f nscd.filelist -n nscd
%config(noreplace) /etc/nscd.conf
%dir %attr(0755,root,root) /var/run/nscd
%dir %attr(0755,root,root) /var/db/nscd
/lib/systemd/system/nscd.service
%{_tmpfilesdir}/nscd.conf
%attr(0644,root,root) %verify(not md5 size mtime) %ghost %config(missingok,noreplace) /var/run/nscd/nscd.pid
%attr(0600,root,root) %verify(not md5 size mtime) %ghost %config(missingok,noreplace) /var/run/nscd/passwd
%attr(0600,root,root) %verify(not md5 size mtime) %ghost %config(missingok,noreplace) /var/run/nscd/group
%attr(0600,root,root) %verify(not md5 size mtime) %ghost %config(missingok,noreplace) /var/run/nscd/hosts
%attr(0600,root,root) %verify(not md5 size mtime) %ghost %config(missingok,noreplace) /var/run/nscd/services
%attr(0600,root,root) %verify(not md5 size mtime) %ghost %config(missingok,noreplace) /var/db/nscd/passwd
%attr(0600,root,root) %verify(not md5 size mtime) %ghost %config(missingok,noreplace) /var/db/nscd/group
%attr(0600,root,root) %verify(not md5 size mtime) %ghost %config(missingok,noreplace) /var/db/nscd/hosts
%attr(0600,root,root) %verify(not md5 size mtime) %ghost %config(missingok,noreplace) /var/db/nscd/services
%ghost %config(missingok,noreplace) /etc/sysconfig/nscd
%endif
%files -f nss.filelist nss
/var/db/Makefile
%files -f nss-devel.filelist nss-devel
%if %{with benchtests}
%files -f benchtests.filelist benchtests
%endif
%files source
%{_usrsrc}/%{name}/%{name}-%{version}-%{release}.tar.xz
%changelog
* Thu Jun 27 2024 <doupengda@loongson.cn> - 2.38-14
- [Type] other
- [DESC] loongarch64 architecture disable check
* Mon Jun 17 2024 Rebuild Robot <rebot@opencloudos.org> - 2.38-13
- [Type] bugfix
- [DESC] Rebuilt for gd
* Fri May 31 2024 Shuo Wang <abushwang@tencent.com> - 2.38-12
- provides a new subpackage included patched source for cross toolchains
* Mon Apr 29 2024 Shuo Wang <abushwang@tencent.com> - 2.38-11
- backport patch to fix CVE-2024-33599 - CVE-2024-33601
- These patch fix buffers and null pointer crashes problem in netgroup
* Thu Apr 18 2024 Shuo Wang <abushwang@tencent.com> - 2.38-10
- backport patch to fix gcc --static too large
* Thu Apr 18 2024 Shuo Wang <abushwang@tencent.com> - 2.38-9
- add some macro for condition build
* Thu Apr 18 2024 Shuo Wang <abushwang@tencent.com> - 2.38-8
- backport patch to fix CVE-2024-2961
- fix out-of-bound writes when writing escape sequence
* Fri Mar 22 2024 Shuo Wang <abushwang@tencent.com> - 2.38-7
- fix lua error message in mock build
* Wed Mar 13 2024 Peng Fan <fanpeng@loongson.cn> - 2.38-6
- LoongArch: sync patch from glibc upstream
- Reduced kernel version requirements
* Thu Feb 1 2024 Shuo Wang <abushwang@tencent.com> - 2.38-5
- backport patch to fix CVE-2023-6246, CVE-2023-6779, CVE-2023-6780
- Fix heap buffer overflow for syslog
* Wed Oct 18 2023 Shuo Wang <abushwang@tencent.com> - 2.38-4
- backport patch to fix CVE-2023-4806 CVE-2023-5156 CVE-2023-4527
* Mon Oct 9 2023 Shuo Wang <abushwang@tencent.com> - 2.38-3
- backport patch to fix CVE-2023-4911
* Fri Sep 08 2023 OpenCloudOS Release Engineering <releng@opencloudos.tech> - 2.38-2
- Rebuilt for OpenCloudOS Stream 23.09
* Mon Aug 28 2023 Shuo Wang <abushwang@tencent.com> - 2.38-1
- update to 2.38
* Thu Aug 10 2023 Shuo Wang <abushwang@tencent.com> - 2.37-3
- fix CVE-2023-25139
* Fri Aug 04 2023 Xin Cheng <denisecheng@tencent.com> - 2.37-2
- add GB18030-2022 charmap
* Mon Jul 24 2023 Shuo Wang <abushwang@tencent.com> - 2.37-1
- update to 2.37
* Fri Apr 28 2023 OpenCloudOS Release Engineering <releng@opencloudos.tech> - 2.35-7
- Rebuilt for OpenCloudOS Stream 23.05
* Thu Apr 20 2023 cunshunxia <cunshunxia@tencent.com> - 2.35-6
- restore nscd.
* Fri Mar 31 2023 OpenCloudOS Release Engineering <releng@opencloudos.tech> - 2.35-5
- Rebuilt for OpenCloudOS Stream 23
* Thu Mar 9 2023 Shuo Wang <abushwang@tencent.com> - 2.35-4
- backport patch to fix shm_open errno no meet POSIX
* Mon Oct 10 2022 Yi Lin <nilusyi@tencent.com> - 2.35-3
- reserve debug symbol in ld.so
* Sat Oct 08 2022 Zhao Zhen <jeremiazhao@tencent.com> - 2.35-2
- disabled annobin to avoid compiling error
* Mon May 30 2022 cunshunxia <cunshunxia@tencent.com> - 2.35-1
- initial build
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化