bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

BFD bug with elf*-sparc sections?


From: Daniel Marques
Subject: BFD bug with elf*-sparc sections?
Date: Sun, 10 Jul 2005 20:55:41 -0400
User-agent: Mozilla Thunderbird 1.0.2 (Windows/20050317)

NOTE:
I originally reported this in an email titled "BFD 2.16.1 'assertion failure' and 'internal error'". I now believe that my original email described two separate bugs, one with the DEC Alpha platform (that Nick Clifton is investigating), and one with the Sparc platform.
A better description of the Sparc bug is below.




The BFD library is apparently not finding all the sections in a elf*-sparc object file, produced with the SunPro C++ compiler.
It is also 'botching' the name of one of the sections.

To illustrate, compile this simple c++ file

#include <iostream>

using namespace std;

void b()
{
  cout << "b" << endl;
}

//EOF


with SunPro C++.

Running the native "elfdump -c" will show that there are 12 sections.

[output of elfdump -c: http://www.cs.cornell.edu/marques/bfdexample/elfdump.txt ]

Running "objdump -h" (2.16 and 2.13) shows only 7 sections.

[output of objdump -h: http://www.cs.cornell.edu/marques/bfdexample/objdump.txt ]


Notice that BFD is mishandling the name of one of the sections.

elfdump reports the following:

Section Header[3]: sh_name: .group%__1cDstdEendl4Ccn0ALchar_traits4Cc___6Frn0ANbasic_ostream3CTACTB___4_
    sh_addr:      0               sh_flags:   0
    sh_size:      0xc             sh_type:    [ SHT_GROUP ]
    sh_offset:    0x1c8           sh_entsize: 0x4
    sh_link:      10              sh_info:    5
    sh_addralign: 0x4


while objdump reports:

1 __1cDstdEendl4Ccn0ALchar_traits4Cc___6Frn0ANbasic_ostream3CTACTB___4_ 00000008 00000000 00000000 000001c8 2**2
                  CONTENTS, READONLY, EXCLUDE, LINK_ONCE_DISCARD




As discussed in my original email, running objcopy on a c.o makes it impossible to link the final application together.


To demonstrate, download
http://www.cs.cornell.edu/marques/bfdexample/a.cxx
http://www.cs.cornell.edu/marques/bfdexample/c.cxx
http://www.cs.cornell.edu/marques/bfdexample/Makefile

and run 'make final1' and 'make final2'.


Thanks.


Dan









reply via email to

[Prev in Thread] Current Thread [Next in Thread]