rpm-build/scripts
Gleb Fotengauer-Malinovskiy 051d1fee67 scripts/provided_symbols: use elfutils' readelf instead of binutils' one
This script is designed to ignore lines that don't follow the expected
format, but it is widely known that the output format of readelf utility
from the binutils project can be quite unreliable.  The output format
may vary on certain architectures and ELFs created with certain build
tools may contain symbols with peculiar bits that affect the output.

Here is a couple of examples illustrating these issues:
* On PowerPC, ELF symbols frequently include the localentry bit.
  For instance:
$ readelf --wide --dyn-syms /lib64/libcrypto.so.1.1  | grep ASN1_VISIBLESTRING_new
   157: 00000000000938c0    60 FUNC    GLOBAL DEFAULT [<localentry>: 8]    11 ASN1_VISIBLESTRING_new@@OPENSSL_1_1_0
* On x86_64, a proprietary blob /usr/lib64/libjcPKCS11ds.so (distributed
  as an ELF) and on armh /usr/lib/libLLVM-16.so, contain symbols with
  OS-specific bits:
$ readelf --wide --dyn-syms /usr/lib64/libjcPKCS11ds.so | grep _ZNSt7collateIwE2idE
  2572: 00000000002df9c8     8 OBJECT  <OS specific>: 10 DEFAULT   26 _ZNSt7collateIwE2idE
$ readelf --wide --dyn-syms /usr/lib/libLLVM-16.so | grep _ZN4llvm13AllAnalysesOnINS_6ModuleEE6SetKeyE
 45060: 05af0478     8 OBJECT  <OS specific>: 10 DEFAULT   26 _ZN4llvm13AllAnalysesOnINS_6ModuleEE6SetKeyE@@LLVM_16

The issue related to PowerPC localentry bits was resolved in the commit
4f4a1d146 ("lib.prov, lib.req: enhance ProvidedSymbols") a long time
ago.  The issue related to OS-specific bits was discovered recently [1].

Instead of attempting to resolve the output issues of binutils' readelf
utility concerning OS-specific bits, it is more convenient to use
readelf from elfutils.  It has more reliable output (including the
handling of the cases described earlier) and is extensively utilized
within the project anyway.

[1] https://bugzilla.altlinux.org/46447

Reported-by: Konstantin A. Lepikhov <lakostis@altlinux.ru>
Reported-by: Gleb Fotengauer-Malinovskiy <glebfm@altlinux.org>
Fixes: https://bugzilla.altlinux.org/46447
2023-06-08 05:00:00 +00:00
..
.provides.sh find-package: renamed FindByPath -> FindByFile 2010-04-08 11:24:55 +04:00
0common-files.req.list 0common-files.req.list: remove /etc/syslog.d 2018-08-28 18:05:40 +00:00
0ldconfig.filetrigger 0ldconfig.filetrigger: execute telinit if appropriate 2012-08-30 23:05:00 +00:00
brp-adjust_libraries.in Removed cvsid tags. 2006-05-14 17:05:34 +04:00
brp-alt.in %%distribution: ALT Linux --> ALT (ALT#32707) and some minor corrections of old @altlinux.ru addresses 2016-11-29 15:12:34 +03:00
brp-check_contents.in brp-check_contents: do not suppress normal grep output 2017-10-26 14:23:23 +00:00
brp-cleanup.in brp-cleanup: perl cleanup routines moved to rpm-build-perl 2011-10-21 01:27:51 +04:00
brp-compress.in Use file4 instead of file 2021-08-12 13:23:31 +03:00
brp-debuginfo.in s/egrep/grep -E/ 2022-04-26 08:00:00 +00:00
brp-fix-perms.in brp-fix-perms: fix "find -perm" syntax 2012-08-08 13:15:41 +00:00
brp-fixup.in Add fixup method: gnuconfig 2020-12-21 08:00:00 +00:00
brp-sign-kmodules.in brp-sign-kmodules.in: add comment regarding this script's scope 2021-11-03 03:11:44 +03:00
brp-strip-lto.in process-lto: enhance __gnu_lto_slim diagnostics 2021-09-08 08:00:00 +00:00
brp-verify_elf.in Use file4 instead of file 2021-08-12 13:23:31 +03:00
brp-verify-info.in Implement info files verification 2009-05-20 23:25:58 +00:00
compress_files.in compress_files: change default method to xz 2015-12-02 21:46:44 +03:00
cpp.req.files cpp.req: new dependency generator for header files 2011-02-27 03:51:26 +03:00
cpp.req.in s/egrep/grep -E/ 2022-04-26 08:00:00 +00:00
debuginfo.prov.files scripts: ignore ELF shared objects with "no" machine type 2017-04-18 16:42:41 +00:00
debuginfo.prov.in implemented debuginfo.req and debuginfo.prov 2011-02-04 02:55:25 +03:00
debuginfo.req.files scripts: ignore ELF shared objects with "no" machine type 2017-04-18 16:42:41 +00:00
debuginfo.req.in s/fgrep/grep -F/ 2022-04-26 08:00:00 +00:00
files.req.files.in s/fgrep/grep -F/ 2022-04-26 08:00:00 +00:00
files.req.in files.req: added description and copyright 2008-06-22 11:52:53 +04:00
find-debuginfo-files.in Use system provided debugedit 2021-04-29 22:39:21 +03:00
find-lang.in find-lang: update copyright information 2013-03-11 23:15:51 +00:00
find-package.in s/fgrep/grep -F/ 2022-04-26 08:00:00 +00:00
find-scriptlet-requires.in Fix regression introduced by forgotten file usage 2021-08-18 01:20:36 +03:00
fixup-binconfig.in Use file4 instead of file 2021-08-12 13:23:31 +03:00
fixup-desktop.awk scripts/fixup-desktop.awk: fix regexp 2013-01-11 22:36:49 +00:00
fixup-desktop.in scripts: introduced tmpdir.sh 2011-09-22 02:58:59 +04:00
fixup-gnuconfig Add fixup method: gnuconfig 2020-12-21 08:00:00 +00:00
fixup-libraries.in Use file4 instead of file 2021-08-12 13:23:31 +03:00
fixup-libtool.in fixup-libtool, fixup-pkgconfig: Quote substitution text (ALT#11437) 2008-07-07 22:07:40 +00:00
fixup-pkgconfig.in fixup-binconfig: strip rpaths 2014-02-25 12:25:51 +00:00
functions scripts/functions: export LC_ALL=C 2013-01-10 22:38:52 +00:00
install Add a wrapper for install in %install section to skip strip 2020-12-15 04:05:15 +03:00
is_elf_so_executable Move "is this ELF shared object an executable" check to a separate script 2016-12-07 11:30:42 +00:00
ldd.in ldd.in: fix trace_elf error diagnostics 2021-01-11 08:00:00 +00:00
lib.prov.files scripts: ignore ELF shared objects with "no" machine type 2017-04-18 16:42:41 +00:00
lib.prov.in lib.prov: print the number of provided symbols and the bpp value for each library 2019-01-14 20:56:55 +00:00
lib.req.files scripts: ignore ELF shared objects with "no" machine type 2017-04-18 16:42:41 +00:00
lib.req.in s/egrep/grep -E/ 2022-04-26 08:00:00 +00:00
Makefile.am brp: Add brp-strip-lto script 2021-08-24 00:52:22 +03:00
pam.prov.files scripts/pam.*.files: Optimize filename check 2007-11-10 20:47:03 +00:00
pam.prov.in adapted pam.req and pam.prov 2007-03-12 15:06:07 +03:00
pam.req.files scripts/pam.*.files: Optimize filename check 2007-11-10 20:47:03 +00:00
pam.req.in pam.req.in: Handle lines with conditional controls 2009-06-26 00:17:19 +00:00
percolate.in percolate: removed loop optimization (for code clarity), result won't change 2016-04-06 03:26:17 +03:00
pkgconfig.req.files pkgconfig.req.files: ignore file type, treat all non-symlinks the same way 2012-12-22 14:41:22 +00:00
pkgconfig.req.in pkgconfig.req.in: allow pkgconfig names to start with + (ALT#29737) 2014-02-25 12:22:12 +00:00
pkgconfiglib.req.in Relax check for gcc package name in {cpp,pkgconfiglib}.req generators 2016-12-20 17:49:07 +03:00
posttrans-filetriggers.in posttrans-filetriggers: minor changes 2008-11-12 05:10:51 +03:00
process-debuginfo.in process-debuginfo: Keep .BTF section for kernel objects 2022-06-24 00:36:36 +03:00
process-lto.in process-lto: enhance __gnu_lto_slim diagnostics 2021-09-08 08:00:00 +00:00
provided_symbols scripts/provided_symbols: use elfutils' readelf instead of binutils' one 2023-06-08 05:00:00 +00:00
rpm2cpio.sh rpm2cpio.sh: output raw/compressed cpio stream 2009-09-24 12:35:42 +04:00
rpmlib.req.files.in Revert "rpmlib.req: generate rpmlib(PosttransFiletriggers) dependency for /usr/lib/rpm/*.filetrigger" 2008-11-25 15:37:14 +00:00
rpmlib.req.in Revert "rpmlib.req: generate rpmlib(PosttransFiletriggers) dependency for /usr/lib/rpm/*.filetrigger" 2008-11-25 15:37:14 +00:00
shebang.req.files scripts/*.req.files: Fix "not executable" wording 2007-11-10 20:47:02 +00:00
shebang.req.in find-package, shebang.req: introduced RPM_FINDPACKAGE_MANDATORY=1 2020-04-07 11:05:34 +03:00
shell.prov.files adapted shell.req and shell.prov 2007-03-11 15:00:23 +03:00
shell.prov.in adapted shell.req and shell.prov 2007-03-11 15:00:23 +03:00
shell.req.files shell.req.files: include #!/usr/bin/env sh 2018-05-23 17:00:54 +03:00
shell.req.in s/egrep/grep -E/ 2022-04-26 08:00:00 +00:00
shlib.req.awk Add shlib.req.awk 2006-01-11 00:39:39 +00:00
static.req.files factored static.req 2007-03-11 15:00:35 +03:00
static.req.in factored static.req 2007-03-11 15:00:35 +03:00
strip Add a wrapper for install in %install section to skip strip 2020-12-15 04:05:15 +03:00
symlinks.req.files symlinks.req.files: do all symbolic links (will emit file-level dependencies for targets under RPM_BUILD_ROOT) 2007-12-03 14:22:54 +03:00
symlinks.req.in symlinks.req: do only one single step of symlink resolution 2007-11-17 10:52:57 +03:00
systemd-services.req.files systemd-services.req.files: consider user units 2023-03-22 16:31:45 +03:00
systemd-services.req.in systemd-services.req.in: fix autoreq for systemd units 2023-01-25 19:50:49 +03:00
tmpdir.sh scripts: introduced tmpdir.sh 2011-09-22 02:58:59 +04:00
verify-elf.in Fix regression introduced by forgotten file usage 2021-08-18 01:20:36 +03:00