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.
# --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 1195883: But do not do this by default.
@ -19,6 +19,8 @@
# Default to read-only-relocations (relro) in shared binaries.
%define default_relro 1
#----End of Configure Options------------------------------------------------
# Default: Not bootstrapping.
%bcond_with bootstrap
# Default: Not debug
@ -37,8 +39,6 @@
%undefine with_testsuite
%endif
#----End of Configure Options-----------------------------------------------------------------------
%if 0%{!?binutils_target:1}
%define binutils_target %{_target_platform}
%define isnative 1
@ -49,18 +49,18 @@
%define enable_shared 0
%endif
#---------------------------------------------------------------------------------
#----------------------------------------------------------------------------
Summary: A GNU collection of binary utilities
Name: %{?cross}binutils%{?_with_debug:-debug}
Version: 2.29
Release: 10%{?dist}
Release: 11%{?dist}
License: GPLv3+
Group: Development/Tools
URL: http://sources.redhat.com/binutils
# Note - the Linux Kernel binutils releases are too unstable and contain too
# many controversial patches so we stick with the official FSF version
# Note - the Linux Kernel binutils releases are too unstable and contain
# too many controversial patches so we stick with the official FSF version
# instead.
Source: http://ftp.gnu.org/gnu/binutils/binutils-%{version}.tar.xz
@ -70,34 +70,38 @@ Source2: binutils-2.19.50.0.1-output-format.sed
# Purpose: Use /lib64 and /usr/lib64 instead of /lib and /usr/lib in the
# default library search path of 64-bit targets.
# 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
# file). These are based on a version released in 2009 (2.2.6?) rather
# than the latest version. (Definitely fixed in libtool version 2.4.6).
# sources used in both binutils and gcc, (specifically the
# libtool.m4 file). These are based on a version released in 2009
# (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
# 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.
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.
# FIXME: Need a test case to reproduce the potential bug so
# that the patch can be contributes.
Patch03: binutils-2.20.51.0.10-sec-merge-emit.patch
# Purpose: Exports the demangle.h header file (associated with the libiberty sources) with
# the binutils-devel rpm.
# Purpose: Exports the demangle.h header file (associated with the libiberty
# sources) with the binutils-devel rpm.
# Lifetime: Permanent. This is a RHEL/Fedora specific 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
# included before the bfd.h header. See BZ #845084 for more details.
# Lifetime: Permanent - but it should not be. The bfd.h header defines various types that
# are dependent upon configuration options, so he order of inclusion is important.
# FIXME: It would be better if the packages using the BFD header were fixed so
# that they do include the header files in the correct order. It may also be
# necessary to add a way for a package to tell the bfd.h header that this check
# is not necessary.
# Purpose: Disables the check in the BFD library's header file that config.h
# has been included before the bfd.h header. See BZ #845084 for
# more details.
# Lifetime: Permanent - but it should not be. The bfd.h header defines
# various types that are dependent upon configuration options, so
# the order of inclusion is important.
# FIXME: It would be better if the packages using the BFD header were
# 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
# Purpose: Import H.J.Lu's Kernel LTO patch.
@ -106,17 +110,20 @@ Patch05: binutils-2.22.52.0.4-no-config-h-check.patch
Patch06: binutils-2.26-lto.patch
# Purpose: Skip PR14918 linker test for ARM native targets.
# Lifetime: Permanent - but it should not be.
# FIXME: This patch should be contributed upstream.
# Lifetime: Fixed in 2.30.
Patch07: binutils-2.29-skip-rp14918-test-for-arm.patch
# Purpose: Include the filename concerned in readelf error messages.
# 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.
# Purpose: Include the filename concerned in readelf error messages. This
# makes readelf's output more helpful when it is run on multiple
# input files.
# 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
# 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.
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.
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)
@ -210,7 +225,7 @@ Requires(preun): %{_sbindir}/alternatives
%define _gnu %{nil}
%endif
#---------------------------------------------------------------------------------
#----------------------------------------------------------------------------
%description
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
converting addresses to file and line).
#---------------------------------------------------------------------------------
#----------------------------------------------------------------------------
%package devel
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
using libelf instead of BFD.
#---------------------------------------------------------------------------------
#----------------------------------------------------------------------------
%prep
%setup -q -n binutils-%{version}
@ -270,6 +285,7 @@ using libelf instead of BFD.
%patch10 -p1
%patch11 -p1
%patch12 -p1
%patch13 -p1
# 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}
%endif
#---------------------------------------------------------------------------------
#----------------------------------------------------------------------------
%build
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}
%endif
#---------------------------------------------------------------------------------
#----------------------------------------------------------------------------
%install
rm -rf %{buildroot}
@ -560,12 +576,12 @@ if [ -x gold/ld-new ]; then
cat %{?cross}gold.lang >> %{?cross}binutils.lang
fi
#---------------------------------------------------------------------------------
#----------------------------------------------------------------------------
%clean
rm -rf %{buildroot}
#---------------------------------------------------------------------------------
#----------------------------------------------------------------------------
%post
%if "%{build_gold}" == "both"
@ -575,7 +591,7 @@ rm -rf %{buildroot}
%{_sbindir}/alternatives --install %{_bindir}/%{?cross}ld %{?cross}ld \
%{_bindir}/%{?cross}ld.gold %{ld_gold_priority}
%{_sbindir}/alternatives --auto %{?cross}ld
%endif
%endif # both ld.gold and ld.bfd
%if %{isnative}
/sbin/ldconfig
@ -589,7 +605,7 @@ rm -rf %{buildroot}
exit 0
#---------------------------------------------------------------------------------
#----------------------------------------------------------------------------
%preun
%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.gold
fi
%endif
%endif # both ld.gold and ld.bfd
%if %{isnative}
if [ $1 = 0 ]; then
@ -609,11 +625,11 @@ if [ $1 = 0 ]; then
/sbin/install-info --delete --info-dir=%{_infodir} %{_infodir}/ld.info.gz
fi
fi
%endif
%endif # isnative
exit 0
#---------------------------------------------------------------------------------
#----------------------------------------------------------------------------
%if %{isnative}
%postun
@ -627,7 +643,7 @@ exit 0
fi
%endif # isnative
#---------------------------------------------------------------------------------
#----------------------------------------------------------------------------
%files -f %{?cross}binutils.lang
%defattr(-,root,root,-)
@ -640,7 +656,7 @@ exit 0
%ghost %{_bindir}/%{?cross}ld
%else
%{_bindir}/%{?cross}ld*
%endif
%endif # both ld.gold and ld.bfd
%if %{with docs}
%{_mandir}/man1/*
@ -657,6 +673,7 @@ exit 0
%endif
%if %{isnative}
%if %{with docs}
%{_infodir}/[^b]*info*
%{_infodir}/binutils*info*
@ -668,14 +685,18 @@ exit 0
%{_libdir}/lib*.a
%{_libdir}/libbfd.so
%{_libdir}/libopcodes.so
%if %{with docs}
%{_infodir}/bfd*info*
%endif # with docs
%endif # isnative
#---------------------------------------------------------------------------------
#----------------------------------------------------------------------------
%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
- Do not enable relro by default for the PowerPC64 architecture. (#1523946)