Bug 529028 - bfd_get_section_by_name() not working correctly on i686 machine
bfd_get_section_by_name() not working correctly on i686 machine
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: binutils (Show other bugs)
5.4
All Linux
medium Severity medium
: rc
: 5.5
Assigned To: Andreas Schwab
qe-baseos-tools
: Regression
Depends On:
Blocks: 527679
  Show dependency treegraph
 
Reported: 2009-10-14 13:14 EDT by William Cohen
Modified: 2016-01-20 03:52 EST (History)
5 users (show)

See Also:
Fixed In Version: binutils-2.17.50.0.6-13.el5
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2010-03-30 05:04:36 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)

  None (edit)
Description William Cohen 2009-10-14 13:14:56 EDT
Description of problem:

OProfile builds with binutils-devel. On the i686 (32-bit) platform bfd_get_section_by_name() is returning incorrect information about the debuginfo section.

There is a regression in binutils-devel. Rebuilt oprofile with older 
binutils-devel-2.17.50.0.6-9.el5.i386.rpm and "opreport -l" works fine. Build oprofile with binutils-devel-2.17.50.0.6-12.el5 and "opreport -l" doesn't work.


Version-Release number of selected component (if applicable):
binutils-devel.i386 0:2.17.50.0.6-12.el5
oprofile-0.9.4-11.el5

How reproducible:

Run the following script:
opcontrol --init
opcontrol --setup --no-vmlinux
opcontrol --start
sleep 3
opcontrol --dump
opreport -l && echo "opreport ended successfully" || echo "ERROR: opreport
returned $?"
opcontrol --shutdown > /dev/null

Actual results:
The output ends with:
...
CPU: P4 / Xeon, speed 2400 MHz (estimated)
Counted GLOBAL_POWER_EVENTS events (time during which processor is not stopped)
with a unit mask of 0x01 (mandatory) count 100000
bfd_get_section_contents:get_debug:: Bad value
ERROR: opreport returned 2

Expected results:
A long detailed per-symbol profile and "opreport ended successfully" at the
end.


Additional info:

Can set a break point in get_debug_link_info() in opreport and then step through the function. After bfd_get_section_by_name() runs can examine the contents of sect. This has a length of 0 which is not correct.
Comment 1 William Cohen 2009-10-15 17:47:08 EDT
The binutils-devel-2.17.50.0.6-10 seems to be where the problem first appears, so something in the following changes caused oprofile to break:

PatchSet 124 
Date: 2009/04/08 15:16:10
Author: dvlasenk
Branch: HEAD
Tag: binutils-2_17_50_0_6-10_el5 
Branches: 
Log:
- Improve support of ELF64, particularly on 32-bit architectures.
  Resolves: RHBZ #457189.
- Fix rare linker corner case when it produces large zero-filled hole
  in the executable.
  Resolves: RHBZ #458301.
- Make "strings -n non_number" error message clearer.
  Resolves: RHBZ #480009.
- Fix man page of c++filt to show --[no-]strip-underscore option correctly.
  Resolves: RHBZ #485194.
- While at it, fix "makeinfo >= 4.4" check in configure.

Members: 
	binutils-2.17.50.0.6-build-fix-configure.patch:INITIAL->1.1 
	binutils-2.17.50.0.6-rh457189-minimal-64bit-i386.patch:INITIAL->1.1 
	binutils-2.17.50.0.6-rh458301-2m-hole.patch:INITIAL->1.1 
	binutils-2.17.50.0.6-rh480009.patch:INITIAL->1.1 
	binutils-2.17.50.0.6-rh485194.patch:INITIAL->1.1 
	binutils.spec:1.113->1.114
Comment 2 Andreas Schwab 2009-10-16 12:07:45 EDT
This specfile patch fixes the bug (oprofile needs to be recompiled afterwards):

--- binutils.spec.~1.116.~	2009-04-17 14:44:09.000000000 +0200
+++ binutils.spec	2009-10-16 18:02:59.000000000 +0200
@@ -185,9 +185,6 @@ rm -rf %{buildroot}%{_prefix}/%{_target_
 
 %ifarch %{ix86} x86_64 ppc ppc64 s390 s390x sparc sparc64
 sed -i -e '/^#include "ansidecl.h"/{p;s~^.*$~#include <bits/wordsize.h>~;}' \
-%ifarch %{ix86} x86_64
-    -e 's/^#define BFD_ARCH_SIZE \(32\|64\) *$/#define BFD_ARCH_SIZE __WORDSIZE/' \
-%endif
     -e 's/^#define BFD_DEFAULT_TARGET_SIZE \(32\|64\) *$/#define BFD_DEFAULT_TARGET_SIZE __WORDSIZE/' \
     -e 's/^#define BFD_HOST_64BIT_LONG [01] *$/#define BFD_HOST_64BIT_LONG (__WORDSIZE == 64)/' \
     -e 's/^#define BFD_HOST_64_BIT \(long \)\?long *$/#if __WORDSIZE == 32\
Comment 3 William Cohen 2009-10-16 12:58:43 EDT
Yes, this change in the spec file resolves the problem in oprofile.
Comment 4 Eric Bachalo 2009-10-22 12:11:28 EDT
This patch is required to fix bz 527679, a OProfile BZ targeted for RHEL 5.5
Comment 15 errata-xmlrpc 2010-03-30 05:04:36 EDT
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2010-0304.html

Note You need to log in before you can comment on or make changes to this bug.