Wind River Support Network

HomeDefectsLIN6-3816
Fixed

LIN6-3816 : bfd header files refer to std_section but the symbol has been renamed or removed causing memory analysis to completely fail

Created: Jan 28, 2013    Updated: Mar 10, 2016
Resolved Date: Dec 9, 2013
Previous ID: LIN5-1618, LIN6-3031
Found In Version: 6.0
Fix Version: 6.0
Severity: Severe
Applicable for: Wind River Linux 6
Component/s: Toolchain

Description

For tools that reference bfd like mpatrol, the header's seem to reflect possibly renamed important variables:
 
From sysroots/common-pc-64/usr/include/bfd.h
---------------------------------------------
/* These sections are global, and are managed by BFD.  The application
   and target back end are not permitted to change the values in
   these sections.  */
extern asection std_section[4];

#define BFD_ABS_SECTION_NAME "*ABS*"
#define BFD_UND_SECTION_NAME "*UND*"
#define BFD_COM_SECTION_NAME "*COM*"
#define BFD_IND_SECTION_NAME "*IND*"

/* Pointer to the common section.  */
#define bfd_com_section_ptr (&std_section[0])
/* Pointer to the undefined section.  */
#define bfd_und_section_ptr (&std_section[1])
/* Pointer to the absolute section.  */
-----------------------------
But as of my latest git pull,  libbfd.so doesn't have std_section.  This is a recent change that breaks mpatrol and any tool that uses bfd.h and the section pointers. (or else cache is completely broken)

This is also evidenced by sudden failures in the automated mpatrol regression tests.

Also, and finally this link 
http://sourceware.org/ml/binutils/2013-01/msg00005.html
suggests that
1) std_section may have been renamed to _bfd_std_section  in source,
2) causing libbfd.so pre-builts to reference the new variable name,
3) but the old headers were left in place.

Steps to Reproduce

configure --with-template=feature/analysis --enable-board=common-pc-64 \
--enable-build=profiling --with-sstate-dir=[your path]  \
AND EITHER
--enable-kernel=standard --enable-rootfs=glibc-small 
OR
--enable-kernel=cgl --enable-rootfs=glibc-cgl 
make fs
deploy

# note error
root@dell390n:~# mpatrol -jgdL -l stdout /bin/ls
/bin/ls: symbol lookup error: /usr/lib64/libmpatrolmt.so: undefined symbol: std_section


To show the same error during a link of an application in workbench:
import the platform
    File > Import > windriver platform project > browse to the project
Create or even easier, build the memory analysis example
    File > New > Example > Application > Memory Analysis Example
Click on that new project's Properties | Build Properties | Libraries and add
    -lunwind -liberty -lmpatrol -lbfd

Change the main source to indirectly bring in the bfd header files by adding
    # include "mpatrol.h"
Click Rebuild and note the similar error
... sysroots/common-pc-64/usr/lib64/../lib64/libmpatrolmt.so: undefined reference to 'std_section'



The discovery was on cgl/glibc-cgl but if my analysis is correct bfd should show the symptoms with standard/glibc-small

Live chat
Online