diff --git a/glibc.spec b/glibc.spec index 152b6246776f6cc7a5d5a40d02d0e7c9a46e3d25..842e8010d129e653dc29f490c37a71bab98f5da0 100644 --- a/glibc.spec +++ b/glibc.spec @@ -66,7 +66,7 @@ ############################################################################## Name: glibc Version: 2.34 -Release: 120 +Release: 121 Summary: The GNU libc libraries License: %{all_license} URL: http://www.gnu.org/software/glibc/ @@ -302,6 +302,7 @@ Patch9035: 0003-elf-ld.so-remove-_mmap_hole-when-ld.so-mmap-PT_LOAD-.patch Patch9036: elf-ld.so-add-MAP_NORESERVE-flag-for-the-first-mmap-2MB-contig.patch Patch9037: elf-ld.so-prohibit-multiple-i-options-and-do-not-allow-i-speci.patch Patch9038: elf-ld.so-Consider-maybe-existing-hole-between-PT_LO.patch +Patch9039: sysboost-Retain-relocation-information-of-libc.patch Provides: ldconfig rtld(GNU_HASH) bundled(gnulib) @@ -576,12 +577,11 @@ To keep older applications compatible, glibc-compat-2.17 provides libpthread_non ############################################################################## # glibc reloc sub-package ############################################################################## -%package reloc +%package relocation Summary: Relocations for %{name} Requires: %{name} = %{version}-%{release} -BuildRequires: sysboost-devel -%description reloc +%description relocation This package contains relocations for %{name}. ############################################################################## @@ -648,7 +648,8 @@ builddir=build-%{target} rm -rf $builddir mkdir $builddir pushd $builddir -../configure CC="%GCC" CXX="%GXX" CFLAGS="$BuildFlags" LDFLAGS="-Wl,--emit-relocs" \ +echo "$LDFLAGS" +../configure CC="%GCC" CXX="%GXX" CFLAGS="$BuildFlags" \ --prefix=%{_prefix} \ --with-headers=%{_prefix}/include $EnableKernel \ --with-nonshared-cflags=-Wp,-D_FORTIFY_SOURCE=2 \ @@ -684,6 +685,8 @@ pushd $builddir { cat config.log; false; } make %{?_smp_mflags} -O -r %{glibc_make_flags} +cp libc.so.6 libc.so.6.relocation +mv -f $RPM_BUILD_DIR/%{name}-%{version}/elf/ld-relocation elf/ld.so.relocation popd ############################################################################## @@ -876,6 +879,11 @@ for i in $RPM_BUILD_ROOT%{_prefix}/bin/{xtrace,memusage}; do -i $i done +mkdir -p ${RPM_BUILD_ROOT}/usr/lib/relocation/%{_libdir} +mkdir -p ${RPM_BUILD_ROOT}/usr/lib/relocation/lib64/ +install -p -m 400 ${RPM_BUILD_DIR}/%{name}-%{version}/build-%{target}/libc.so.6.relocation ${RPM_BUILD_ROOT}/usr/lib/relocation/%{_libdir} +install -p -m 400 ${RPM_BUILD_DIR}/%{name}-%{version}/build-%{target}/elf/ld.so.relocation ${RPM_BUILD_ROOT}/usr/lib/relocation/lib64/ + touch master.filelist touch glibc.filelist touch common.filelist @@ -1062,13 +1070,6 @@ echo "%{_prefix}/libexec/glibc-benchtests/validate_benchout.py*" >> benchtests.f echo "%{_libdir}/libpthread_nonshared.a" >> compat-2.17.filelist %endif -pushd build-%{target} -objreloc ./libc.so -objreloc ./elf/ld.so -install -p -m 755 ./libc.so.relocation $RPM_BUILD_ROOT%{_libdir} -install -p -m 755 ./elf/ld.so.relocation $RPM_BUILD_ROOT%{_libdir} -popd - reliantlib="" function findReliantLib() @@ -1251,7 +1252,7 @@ install_libs = { "anl", "BrokenLocale", "c", "dl", "m", "mvec", -- We are going to remove these libraries. Generally speaking we remove -- all core libraries in the multilib directory. --- We employ a tight match where X.Y is in [2.0,9.9*], so we would +-- We employ a tight match where X.Y is in [2.0,9.9*], so we would -- match "libc-2.0.so" and so on up to "libc-9.9*". remove_regexps = {} for i = 1, #install_libs do @@ -1411,8 +1412,6 @@ fi %attr(0644,root,root) %verify(not md5 size mtime) %ghost %config(missingok,noreplace) /etc/gai.conf %{!?_licensedir:%global license %%doc} %license COPYING COPYING.LIB LICENSES -%exclude %{_libdir}/libc.so.relocation -%exclude %{_libdir}/ld.so.relocation %files -f common.filelist common %dir %{_prefix}/lib/locale @@ -1437,8 +1436,6 @@ fi %attr(0644,root,root) %{_prefix}/lib/locale/locale-archive.update %files -f devel.filelist devel -%exclude %{_libdir}/libc.so.relocation -%exclude %{_libdir}/ld.so.relocation %files -f nscd.filelist -n nscd %config(noreplace) /etc/nscd.conf @@ -1488,11 +1485,14 @@ fi %files -f compat-2.17.filelist compat-2.17 %endif -%files reloc -%{_libdir}/libc.so.relocation -%{_libdir}/ld.so.relocation +%files relocation +/usr/lib/relocation/%{_libdir}/libc.so.6.relocation +/usr/lib/relocation/lib64/ld.so.relocation %changelog +* Tue May 16 2023 liutie - 2.34-121 +- Retain relocation information for sysboost. But adding LDFLAGS to configure cannot achieve this goal. So I need to modify Makerules. + * Mon May 8 2023 liutie - 2.34-120 - malloc: libc.so: create reloc for sysboost - malloc: elf/ld.so: create reloc for sysboost diff --git a/sysboost-Retain-relocation-information-of-libc.patch b/sysboost-Retain-relocation-information-of-libc.patch new file mode 100644 index 0000000000000000000000000000000000000000..756a80e107481002261ab65c0c6c96d22041d0af --- /dev/null +++ b/sysboost-Retain-relocation-information-of-libc.patch @@ -0,0 +1,51 @@ +From a38371eaf052ffe7dc02dfab337d225c0318c965 Mon Sep 17 00:00:00 2001 +From: root +Date: Mon, 29 May 2023 20:36:44 +0800 +Subject: [PATCH] Retain relocation information for sysboost. But adding + +--- + Makerules | 4 ++-- + elf/Makefile | 3 ++- + 2 files changed, 4 insertions(+), 3 deletions(-) + +diff --git a/Makerules b/Makerules +index 596fa683..cf2c980d 100644 +--- a/Makerules ++++ b/Makerules +@@ -537,7 +537,7 @@ lib%.so: lib%_pic.a $(+preinit) $(+postinit) $(link-libc-deps) + $(call after-link,$@) + + define build-shlib-helper +-$(LINK.o) -shared -static-libgcc -Wl,-O1 $(sysdep-LDFLAGS) \ ++$(LINK.o) -shared -static-libgcc -Wl,-O1 $(sysdep-LDFLAGS) -Wl,--emit-relocs \ + $(if $($(@F)-no-z-defs)$(no-z-defs),,-Wl,-z,defs) $(rtld-LDFLAGS) \ + $(extra-B-$(@F:lib%.so=%).so) -B$(csu-objpfx) \ + $(extra-B-$(@F:lib%.so=%).so) $(load-map-file) \ +@@ -554,7 +554,7 @@ else + # binutils only position loadable notes into the first page for binaries, + # not for shared objects + $(common-objpfx)shlib.lds: $(common-objpfx)config.make $(..)Makerules +- $(LINK.o) -shared -Wl,-O1 \ ++ $(LINK.o) -shared -Wl,-O1 -Wl,--emit-relocs \ + -nostdlib -nostartfiles \ + $(sysdep-LDFLAGS) $(rtld-LDFLAGS) $(LDFLAGS.so) \ + -Wl,--verbose 2>/dev/null | \ +diff --git a/elf/Makefile b/elf/Makefile +index d05f4105..61747a00 100644 +--- a/elf/Makefile ++++ b/elf/Makefile +@@ -602,10 +602,11 @@ $(objpfx)ld.so: $(objpfx)librtld.os $(ld-map) + # Link into a temporary file so that we don't touch $@ at all + # if the sanity check below fails. + $(LINK.o) -nostdlib -nostartfiles -shared -o $@.new \ +- $(LDFLAGS-rtld) -Wl,-z,defs $(z-now-$(bind-now)) \ ++ $(LDFLAGS-rtld) -Wl,--emit-relocs -Wl,-z,defs $(z-now-$(bind-now)) \ + $(filter-out $(map-file),$^) $(load-map-file) \ + -Wl,-soname=$(rtld-installed-name) \ + -Wl,-defsym=_begin=0 ++ cp $@.new ld-relocation + $(call after-link,$@.new) + $(READELF) -s $@.new \ + | $(AWK) '($$7 ~ /^UND(|EF)$$/ && $$1 != "0:" && $$4 != "REGISTER") { print; p=1 } END { exit p != 0 }' +-- +2.33.0