Have readelf display extra symbol information at the end of the line.

Resolves: #1479302
This commit is contained in:
Nick Clifton 2017-12-15 12:36:16 +00:00
parent 2e86afa036
commit c48f0264a9
2 changed files with 136 additions and 49 deletions

View File

@ -0,0 +1,66 @@
diff -rup binutils.orig/binutils/readelf.c binutils-2.29/binutils/readelf.c
--- binutils.orig/binutils/readelf.c 2017-12-12 16:24:19.571221194 +0000
+++ binutils-2.29/binutils/readelf.c 2017-12-12 16:27:26.997979803 +0000
@@ -11018,12 +11018,14 @@ print_dynamic_symbol (bfd_vma si, unsign
unsigned int vis = ELF_ST_VISIBILITY (psym->st_other);
printf (" %-7s", get_symbol_visibility (vis));
+#if 0
/* Check to see if any other bits in the st_other field are set.
Note - displaying this information disrupts the layout of the
table being generated, but for the moment this case is very
rare. */
if (psym->st_other ^ vis)
printf (" [%s] ", get_symbol_other (psym->st_other ^ vis));
+#endif
}
printf (" %3.3s ", get_symbol_index_type (psym->st_shndx));
@@ -11031,6 +11033,15 @@ print_dynamic_symbol (bfd_vma si, unsign
print_symbol (25, GET_DYNAMIC_NAME (psym->st_name));
else
printf (_(" <corrupt: %14ld>"), psym->st_name);
+#if 1
+ {
+ unsigned int vis = ELF_ST_VISIBILITY (psym->st_other);
+
+ /* Check to see if any other bits in the st_other field are set. */
+ if (psym->st_other ^ vis)
+ printf (" \t[%s]", get_symbol_other (psym->st_other ^ vis));
+ }
+#endif
putchar ('\n');
}
--- binutils.orig/binutils/readelf.c 2017-12-12 16:36:21.806561149 +0000
+++ binutils-2.29.1/binutils/readelf.c 2017-12-12 16:38:17.763168514 +0000
@@ -11548,11 +11548,13 @@ process_symbol_table (FILE * file)
unsigned int vis = ELF_ST_VISIBILITY (psym->st_other);
printf (" %-7s", get_symbol_visibility (vis));
+#if 0
/* Check to see if any other bits in the st_other field are set.
Note - displaying this information disrupts the layout of the
table being generated, but for the moment this case is very rare. */
if (psym->st_other ^ vis)
printf (" [%s] ", get_symbol_other (psym->st_other ^ vis));
+#endif
}
printf (" %4s ", get_symbol_index_type (psym->st_shndx));
print_symbol (25, psym->st_name < strtab_size
@@ -11571,7 +11573,15 @@ process_symbol_table (FILE * file)
printf (sym_info == symbol_hidden ? "@%s" : "@@%s",
version_string);
}
+#if 1
+ {
+ unsigned int vis = ELF_ST_VISIBILITY (psym->st_other);
+ /* Check to see if any other bits in the st_other field are set. */
+ if (psym->st_other ^ vis)
+ printf (" \t[%s] ", get_symbol_other (psym->st_other ^ vis));
+ }
+#endif
putchar ('\n');
if (ELF_ST_BIND (psym->st_info) == STB_LOCAL

View File

@ -7,7 +7,7 @@
# --without=testsuite: Do not run the testsuite. Default is to run it. # --without=testsuite: Do not run the testsuite. Default is to run it.
# --with=testsuite: Run the testsuite. Default when --with=debug is not to run it. # --with=testsuite: Run the testsuite. Default when --with=debug is not to run it.
#---Start of Configure Options----------------------------------------------------------------------- #---Start of Configure Options-----------------------------------------------
# BZ 1124342: Provide a way to enable deterministic archives. # BZ 1124342: Provide a way to enable deterministic archives.
# BZ 1195883: But do not do this by default. # BZ 1195883: But do not do this by default.
@ -19,6 +19,8 @@
# Default to read-only-relocations (relro) in shared binaries. # Default to read-only-relocations (relro) in shared binaries.
%define default_relro 1 %define default_relro 1
#----End of Configure Options------------------------------------------------
# Default: Not bootstrapping. # Default: Not bootstrapping.
%bcond_with bootstrap %bcond_with bootstrap
# Default: Not debug # Default: Not debug
@ -37,8 +39,6 @@
%undefine with_testsuite %undefine with_testsuite
%endif %endif
#----End of Configure Options-----------------------------------------------------------------------
%if 0%{!?binutils_target:1} %if 0%{!?binutils_target:1}
%define binutils_target %{_target_platform} %define binutils_target %{_target_platform}
%define isnative 1 %define isnative 1
@ -49,74 +49,81 @@
%define enable_shared 0 %define enable_shared 0
%endif %endif
#--------------------------------------------------------------------------------- #----------------------------------------------------------------------------
Summary: A GNU collection of binary utilities Summary: A GNU collection of binary utilities
Name: %{?cross}binutils%{?_with_debug:-debug} Name: %{?cross}binutils%{?_with_debug:-debug}
Version: 2.29 Version: 2.29
Release: 10%{?dist} Release: 11%{?dist}
License: GPLv3+ License: GPLv3+
Group: Development/Tools Group: Development/Tools
URL: http://sources.redhat.com/binutils URL: http://sources.redhat.com/binutils
# Note - the Linux Kernel binutils releases are too unstable and contain too # Note - the Linux Kernel binutils releases are too unstable and contain
# many controversial patches so we stick with the official FSF version # too many controversial patches so we stick with the official FSF version
# instead. # instead.
Source: http://ftp.gnu.org/gnu/binutils/binutils-%{version}.tar.xz Source: http://ftp.gnu.org/gnu/binutils/binutils-%{version}.tar.xz
Source2: binutils-2.19.50.0.1-output-format.sed Source2: binutils-2.19.50.0.1-output-format.sed
# Purpose: Use /lib64 and /usr/lib64 instead of /lib and /usr/lib in the # Purpose: Use /lib64 and /usr/lib64 instead of /lib and /usr/lib in the
# default library search path of 64-bit targets. # default library search path of 64-bit targets.
# Lifetime: Permanent, but it should not be. This is a bug in the libtool # Lifetime: Permanent, but it should not be. This is a bug in the libtool
# sources used in both binutils and gcc, (specifically the libtool.m4 # sources used in both binutils and gcc, (specifically the
# file). These are based on a version released in 2009 (2.2.6?) rather # libtool.m4 file). These are based on a version released in 2009
# than the latest version. (Definitely fixed in libtool version 2.4.6). # (2.2.6?) rather than the latest version. (Definitely fixed in
# libtool version 2.4.6).
Patch01: binutils-2.20.51.0.2-libtool-lib64.patch Patch01: binutils-2.20.51.0.2-libtool-lib64.patch
# Purpose: Appends a RHEL or Fedora release string to the generic binutils version string. # Purpose: Appends a RHEL or Fedora release string to the generic binutils
# version string.
# Lifetime: Permanent. This is a RHEL/Fedora specific patch. # Lifetime: Permanent. This is a RHEL/Fedora specific patch.
Patch02: binutils-2.25-version.patch Patch02: binutils-2.25-version.patch
# Purpose: Prevent a seg-fault when attempting to pad a section with a NULL padding pointer. # Purpose: Prevent a seg-fault when attempting to pad a section with a NULL
# padding pointer.
# Lifetime: Permanent - but should be contributed upstream and fixed. # Lifetime: Permanent - but should be contributed upstream and fixed.
# FIXME: Need a test case to reproduce the potential bug so # FIXME: Need a test case to reproduce the potential bug so
# that the patch can be contributes. # that the patch can be contributes.
Patch03: binutils-2.20.51.0.10-sec-merge-emit.patch Patch03: binutils-2.20.51.0.10-sec-merge-emit.patch
# Purpose: Exports the demangle.h header file (associated with the libiberty sources) with # Purpose: Exports the demangle.h header file (associated with the libiberty
# the binutils-devel rpm. # sources) with the binutils-devel rpm.
# Lifetime: Permanent. This is a RHEL/Fedora specific patch. # Lifetime: Permanent. This is a RHEL/Fedora specific patch.
Patch04: binutils-2.22.52.0.1-export-demangle.h.patch Patch04: binutils-2.22.52.0.1-export-demangle.h.patch
# Purpose: Disables the check in the BFD library's header file that config.h has been # Purpose: Disables the check in the BFD library's header file that config.h
# included before the bfd.h header. See BZ #845084 for more details. # has been included before the bfd.h header. See BZ #845084 for
# Lifetime: Permanent - but it should not be. The bfd.h header defines various types that # more details.
# are dependent upon configuration options, so he order of inclusion is important. # Lifetime: Permanent - but it should not be. The bfd.h header defines
# FIXME: It would be better if the packages using the BFD header were fixed so # various types that are dependent upon configuration options, so
# that they do include the header files in the correct order. It may also be # the order of inclusion is important.
# necessary to add a way for a package to tell the bfd.h header that this check # FIXME: It would be better if the packages using the BFD header were
# is not necessary. # fixed so that they do include the header files in the correct
# order.
Patch05: binutils-2.22.52.0.4-no-config-h-check.patch Patch05: binutils-2.22.52.0.4-no-config-h-check.patch
# Purpose: Import H.J.Lu's Kernel LTO patch. # Purpose: Import H.J.Lu's Kernel LTO patch.
# Lifetime: Permanent, but needs continual updating. # Lifetime: Permanent, but needs continual updating.
# FIXME: Try removing.... # FIXME: Try removing....
Patch06: binutils-2.26-lto.patch Patch06: binutils-2.26-lto.patch
# Purpose: Skip PR14918 linker test for ARM native targets. # Purpose: Skip PR14918 linker test for ARM native targets.
# Lifetime: Permanent - but it should not be. # Lifetime: Fixed in 2.30.
# FIXME: This patch should be contributed upstream.
Patch07: binutils-2.29-skip-rp14918-test-for-arm.patch Patch07: binutils-2.29-skip-rp14918-test-for-arm.patch
# Purpose: Include the filename concerned in readelf error messages. # Purpose: Include the filename concerned in readelf error messages. This
# Lifetime: Permanent. This patch changes the format of readelf's output, making it # makes readelf's output more helpful when it is run on multiple
# better (IMHO) but also potentially breaking tools that depend upon readelf's # input files.
# current format. Hence it remains a local patch. # Lifetime: Permanent. This patch changes the format of readelf's output,
# making it better (IMHO) but also potentially breaking tools that
# depend upon readelf's current format. Hence it remains a local
# patch.
Patch08: binutils-2.29-filename-in-error-messages.patch Patch08: binutils-2.29-filename-in-error-messages.patch
# Purpose: Do not enable the PPC64 plt-localentry0 linker optimization by default. # Purpose: Do not enable the PPC64 plt-localentry0 linker optimization by
# default.
# Lifetime: Fixed in 2.29.1. # Lifetime: Fixed in 2.29.1.
Patch09: binutils-2.29-ppc64-plt-localentry0-disable.patch Patch09: binutils-2.29-ppc64-plt-localentry0-disable.patch
@ -135,7 +142,15 @@ Patch11: binutils-2.28-ignore-gold-duplicates.patch
# Lifetime: Fixed in 2.30. # Lifetime: Fixed in 2.30.
Patch12: binutils-strip-delete-relocs.patch Patch12: binutils-strip-delete-relocs.patch
#--------------------------------------------------------------------------------- # Purpose: Changes readelf so that when it displays extra information about
# a symbol, this information is placed at the end of the line.
# Lifetime: Permanent.
# FIXME: The proper fix would be to update the scripts that are expecting
# a fixed output from readelf. But it seems that some of them are
# no longer being maintained.
Patch13: binutils-readelf-other-sym-info.patch
#----------------------------------------------------------------------------
Provides: bundled(libiberty) Provides: bundled(libiberty)
@ -210,7 +225,7 @@ Requires(preun): %{_sbindir}/alternatives
%define _gnu %{nil} %define _gnu %{nil}
%endif %endif
#--------------------------------------------------------------------------------- #----------------------------------------------------------------------------
%description %description
Binutils is a collection of binary utilities, including ar (for Binutils is a collection of binary utilities, including ar (for
@ -225,7 +240,7 @@ of an object or archive file), strings (for listing printable strings
from files), strip (for discarding symbols), and addr2line (for from files), strip (for discarding symbols), and addr2line (for
converting addresses to file and line). converting addresses to file and line).
#--------------------------------------------------------------------------------- #----------------------------------------------------------------------------
%package devel %package devel
Summary: BFD and opcodes static and dynamic libraries and header files Summary: BFD and opcodes static and dynamic libraries and header files
@ -254,7 +269,7 @@ dynamic libraries.
Developers starting new projects are strongly encouraged to consider Developers starting new projects are strongly encouraged to consider
using libelf instead of BFD. using libelf instead of BFD.
#--------------------------------------------------------------------------------- #----------------------------------------------------------------------------
%prep %prep
%setup -q -n binutils-%{version} %setup -q -n binutils-%{version}
@ -270,6 +285,7 @@ using libelf instead of BFD.
%patch10 -p1 %patch10 -p1
%patch11 -p1 %patch11 -p1
%patch12 -p1 %patch12 -p1
%patch13 -p1
# We cannot run autotools as there is an exact requirement of autoconf-2.59. # We cannot run autotools as there is an exact requirement of autoconf-2.59.
@ -307,7 +323,7 @@ touch */configure
%define _target_platform %{_arch}-%{_vendor}-%{_host_os} %define _target_platform %{_arch}-%{_vendor}-%{_host_os}
%endif %endif
#--------------------------------------------------------------------------------- #----------------------------------------------------------------------------
%build %build
echo target is %{binutils_target} echo target is %{binutils_target}
@ -436,7 +452,7 @@ uuencode binutils-%{_target_platform}.tar.bz2 binutils-%{_target_platform}.tar.b
rm -f binutils-%{_target_platform}.tar.bz2 binutils-%{_target_platform}-*.{sum,log} rm -f binutils-%{_target_platform}.tar.bz2 binutils-%{_target_platform}-*.{sum,log}
%endif %endif
#--------------------------------------------------------------------------------- #----------------------------------------------------------------------------
%install %install
rm -rf %{buildroot} rm -rf %{buildroot}
@ -560,12 +576,12 @@ if [ -x gold/ld-new ]; then
cat %{?cross}gold.lang >> %{?cross}binutils.lang cat %{?cross}gold.lang >> %{?cross}binutils.lang
fi fi
#--------------------------------------------------------------------------------- #----------------------------------------------------------------------------
%clean %clean
rm -rf %{buildroot} rm -rf %{buildroot}
#--------------------------------------------------------------------------------- #----------------------------------------------------------------------------
%post %post
%if "%{build_gold}" == "both" %if "%{build_gold}" == "both"
@ -575,7 +591,7 @@ rm -rf %{buildroot}
%{_sbindir}/alternatives --install %{_bindir}/%{?cross}ld %{?cross}ld \ %{_sbindir}/alternatives --install %{_bindir}/%{?cross}ld %{?cross}ld \
%{_bindir}/%{?cross}ld.gold %{ld_gold_priority} %{_bindir}/%{?cross}ld.gold %{ld_gold_priority}
%{_sbindir}/alternatives --auto %{?cross}ld %{_sbindir}/alternatives --auto %{?cross}ld
%endif %endif # both ld.gold and ld.bfd
%if %{isnative} %if %{isnative}
/sbin/ldconfig /sbin/ldconfig
@ -589,7 +605,7 @@ rm -rf %{buildroot}
exit 0 exit 0
#--------------------------------------------------------------------------------- #----------------------------------------------------------------------------
%preun %preun
%if "%{build_gold}" == "both" %if "%{build_gold}" == "both"
@ -597,7 +613,7 @@ if [ $1 = 0 ]; then
%{_sbindir}/alternatives --remove %{?cross}ld %{_bindir}/%{?cross}ld.bfd %{_sbindir}/alternatives --remove %{?cross}ld %{_bindir}/%{?cross}ld.bfd
%{_sbindir}/alternatives --remove %{?cross}ld %{_bindir}/%{?cross}ld.gold %{_sbindir}/alternatives --remove %{?cross}ld %{_bindir}/%{?cross}ld.gold
fi fi
%endif %endif # both ld.gold and ld.bfd
%if %{isnative} %if %{isnative}
if [ $1 = 0 ]; then if [ $1 = 0 ]; then
@ -609,11 +625,11 @@ if [ $1 = 0 ]; then
/sbin/install-info --delete --info-dir=%{_infodir} %{_infodir}/ld.info.gz /sbin/install-info --delete --info-dir=%{_infodir} %{_infodir}/ld.info.gz
fi fi
fi fi
%endif %endif # isnative
exit 0 exit 0
#--------------------------------------------------------------------------------- #----------------------------------------------------------------------------
%if %{isnative} %if %{isnative}
%postun %postun
@ -627,7 +643,7 @@ exit 0
fi fi
%endif # isnative %endif # isnative
#--------------------------------------------------------------------------------- #----------------------------------------------------------------------------
%files -f %{?cross}binutils.lang %files -f %{?cross}binutils.lang
%defattr(-,root,root,-) %defattr(-,root,root,-)
@ -640,7 +656,7 @@ exit 0
%ghost %{_bindir}/%{?cross}ld %ghost %{_bindir}/%{?cross}ld
%else %else
%{_bindir}/%{?cross}ld* %{_bindir}/%{?cross}ld*
%endif %endif # both ld.gold and ld.bfd
%if %{with docs} %if %{with docs}
%{_mandir}/man1/* %{_mandir}/man1/*
@ -657,6 +673,7 @@ exit 0
%endif %endif
%if %{isnative} %if %{isnative}
%if %{with docs} %if %{with docs}
%{_infodir}/[^b]*info* %{_infodir}/[^b]*info*
%{_infodir}/binutils*info* %{_infodir}/binutils*info*
@ -668,14 +685,18 @@ exit 0
%{_libdir}/lib*.a %{_libdir}/lib*.a
%{_libdir}/libbfd.so %{_libdir}/libbfd.so
%{_libdir}/libopcodes.so %{_libdir}/libopcodes.so
%if %{with docs} %if %{with docs}
%{_infodir}/bfd*info* %{_infodir}/bfd*info*
%endif # with docs %endif # with docs
%endif # isnative %endif # isnative
#--------------------------------------------------------------------------------- #----------------------------------------------------------------------------
%changelog %changelog
* Fri Dec 15 2017 Nick Clifton <nickc@redhat.com> 2.29.1-11
- Have readelf display extra symbol information at the end of the line. (#1479302)
* Mon Dec 11 2017 Nick Clifton <nickc@redhat.com> 2.29.1-10 * Mon Dec 11 2017 Nick Clifton <nickc@redhat.com> 2.29.1-10
- Do not enable relro by default for the PowerPC64 architecture. (#1523946) - Do not enable relro by default for the PowerPC64 architecture. (#1523946)