[Bug target/13391] AIX: collect2 emits bad code with duplicated symbols

ajd at gentrack dot com gcc-bugzilla@gcc.gnu.org
Wed Mar 3 01:11:00 GMT 2004


------- Additional Comments From ajd at gentrack dot com  2004-03-03 01:11 -------
I think there are two separate issues here.
The issue reported by Davy Durham does not relate to shared libraries and may 
be an enhancement request for duplicate symbol handling.

But the original report is a problem throwing exceptions across a shared 
library boundary.

I am having the same problem as the original reporter.

A simple testcase:
a1.cpp:
extern void mycall();

int main()
{
        try {
                mycall();
        } catch (int i) {
                return i;
        }
        return 1;
}

a2.cpp:
void mycall()
{
        throw 0;
}

$ g++ -fPIC -DPIC -shared -o liba2.a a2.cpp
$ g++ -fPIC -DPIC -o a1 a1.cpp -L. -la2    

Sometimes it aborts, sometimes it succeeds.

I debugged through and in unwind-dw2-fde.c, the seen_objects element that 
represents liba2 contains FDE's for both liba2 and libstdc++.a.

As a consequence of this, when liba2.a is located in memory at a higher 
address than libstdc++.a, then the seen_objects list is not sorted correctly 
and the function _Unwind_Find_FDE will never search liba2 for fde's.

By disassembling liba2, I can see that it's local table does indeed import all 
the FDE's from libstdc++.

Could this be an installation problem?
Could this be a problem with collect2 picking up frames from imported 
libraries?

Configured with: --disable-symvers --without-gnu-as --without-gnu-ld --enable-
languages=c,c++


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13391



More information about the Gcc-bugs mailing list