Bug 529028 - bfd_get_section_by_name() not working correctly on i686 machine
bfd_get_section_by_name() not working correctly on i686 machine
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: binutils (Show other bugs)
All Linux
medium Severity medium
: rc
: 5.5
Assigned To: Andreas Schwab
: 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-
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2010-03-30 05:04:36 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

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- and "opreport -l" works fine. Build oprofile with binutils-devel- and "opreport -l" doesn't work.

Version-Release number of selected component (if applicable):
binutils-devel.i386 0:

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

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- 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 
- 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.

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/' \
     -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.


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