Import FSF binutils patch to fix running readelf on debug info binaries.

Resolves: #1434050
This commit is contained in:
Nick Clifton 2017-03-21 10:45:16 +00:00
parent 834bfa6a76
commit d3157973ba
2 changed files with 41 additions and 1 deletions

View File

@ -0,0 +1,33 @@
diff -rup binutils.orig/binutils/readelf.c binutils-2.28/binutils/readelf.c
--- binutils.orig/binutils/readelf.c 2017-03-20 17:06:41.260789454 +0000
+++ binutils-2.28/binutils/readelf.c 2017-03-20 17:08:09.181289807 +0000
@@ -4965,12 +4965,6 @@ process_program_headers (FILE * file)
section in the DYNAMIC segment. */
dynamic_addr = segment->p_offset;
dynamic_size = segment->p_filesz;
- /* PR binutils/17512: Avoid corrupt dynamic section info in the segment. */
- if (dynamic_addr + dynamic_size >= current_file_size)
- {
- error (_("the dynamic segment offset + size exceeds the size of the file\n"));
- dynamic_addr = dynamic_size = 0;
- }
/* Try to locate the .dynamic section. If there is
a section header table, we can easily locate it. */
@@ -5005,6 +4999,16 @@ process_program_headers (FILE * file)
warn (_("the .dynamic section is not the first section"
" in the dynamic segment.\n"));
}
+
+ /* PR binutils/17512: Avoid corrupt dynamic section info in the
+ segment. Check this after matching against the section headers
+ so we don't warn on debuginfo file (which have NOBITS .dynamic
+ sections). */
+ if (dynamic_addr + dynamic_size >= current_file_size)
+ {
+ error (_("the dynamic segment offset + size exceeds the size of the file\n"));
+ dynamic_addr = dynamic_size = 0;
+ }
break;
case PT_INTERP:

View File

@ -43,7 +43,7 @@
Summary: A GNU collection of binary utilities
Name: %{?cross}binutils%{?_with_debug:-debug}
Version: 2.27
Release: 20%{?dist}
Release: 21%{?dist}
License: GPLv3+
Group: Development/Tools
URL: http://sources.redhat.com/binutils
@ -102,6 +102,8 @@ Patch25: binutils-2.27-arm-binary-objects.patch
Patch26: binutils-2.27-ppc-fp-attributes.patch
# GAS: Emit name, comp_dir and producer strings in .debug_str.
Patch27: binutils-2.28-gas-comp_dir.patch
# Have readelf skip checks of the dynamic section when its type is SHT_NOBITS.
Patch28: binutils-2.28-dynamic-section-warning.patch
Provides: bundled(libiberty)
@ -254,6 +256,7 @@ using libelf instead of BFD.
%patch25 -p1
%patch26 -p1
%patch27 -p1
%patch28 -p1
# We cannot run autotools as there is an exact requirement of autoconf-2.59.
@ -620,6 +623,10 @@ exit 0
%endif # %{isnative}
%changelog
* Tue Mar 21 2017 Nick Clifton <nickc@redhat.com> 2.27-21
- Import FSF binutils patch to fix running readelf on debug info binaries.
(#1434050)
* Mon Mar 06 2017 Mark Wielaard <mjw@redhat.com> 2.27-20
- Backport patch to add support for putting name, comp_dir and
producer strings into the .debug_str section.