Bug 503366

Summary: libbfd: adr2errline resolution does not work for 32bit programs
Product: [openSUSE] openSUSE 11.1 Reporter: Elmar Stellnberger <estellnb>
Component: BasesystemAssignee: Michael Matz <matz>
Status: RESOLVED WONTFIX QA Contact: E-mail List <qa-bugs>
Severity: Enhancement    
Priority: P5 - None    
Version: Final   
Target Milestone: ---   
Hardware: x86-64   
OS: openSUSE 11.1   
Whiteboard:
Found By: --- Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---

Description Elmar Stellnberger 2009-05-13 10:29:22 UTC
User-Agent:       Mozilla/5.0 (compatible; Konqueror/3.5; Linux) KHTML/3.5.10 (like Gecko) SUSE

Using the addr2errline sample program from http://linuxgazette.net/151/misc/melinte/addr2line.c
I get the following results:

> gcc addr2errline.c -o addr2errline -lbfd -liberty -lz
> ./addr2errline getlineno 0x804b335 0x804b2aa
main [getlineno.c:61]
ThisLine [getlineno.c:49]

> gcc -m32 addr2errline.c -o addr2errline -lbfd -liberty -lz
> ./addr2errline getlineno 0x804b335 0x804b2aa
>  ** no result, nothing found, 0 lines of output **

It does not depend on the library version. If I link against old 32bit bfd & liberty librays from x86_32 days of OpenSuse10.1 it does not work either.
Perhaps this is some general incompatibility of 32/64bit plattforms.

Debugging addr2errline.c I found that the error turns out at the following point:
slurp_symtab(bfd *abfd)
{
...
    if ((bfd_get_file_flags(abfd) & HAS_SYMS) == 0)
        return -1;





Reproducible: Always
Comment 1 Elmar Stellnberger 2009-05-13 10:32:24 UTC
P.S.: This affects many different 32bit programs on x86_64-platforms like the Modula-3 compiler as well.
Comment 2 Elmar Stellnberger 2009-05-23 19:31:57 UTC
accidentially used wrong header files. Should however not be too difficult to provide a common header file and thereby a libbfd-32bit for x86_64 platforms since only the first few lines in bfd.h differ:

#define BFD_DEFAULT_TARGET_SIZE 32

#define BFD_HOST_64BIT_LONG 0
#define BFD_HOST_64BIT_LONG_LONG 1
#if 1
#define BFD_HOST_64_BIT long long
#define BFD_HOST_U_64_BIT unsigned long long

---------------------------------------------------

#define BFD_DEFAULT_TARGET_SIZE 64

#define BFD_HOST_64BIT_LONG 1
#define BFD_HOST_64BIT_LONG_LONG 0
#if 1
#define BFD_HOST_64_BIT long
#define BFD_HOST_U_64_BIT unsigned long
Comment 3 Tomáš Chvátal 2017-08-12 19:08:43 UTC
openSUSE 11.1 is out of support. As it is not easy to reproduce all the bugs please verify the latest release of openSUSE and open a new issue if you are still having the issue.