Red Hat Bugzilla – Bug 110438
dynamic_cast fails depending on linking combination
Last modified: 2007-11-30 17:06:59 EST
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.3) Gecko/20030314
Description of problem:
An application we have link different parts in different ways, archive
library, shared library, and at run time with dlopen(). In some cases
we have found dynamic_cast fails. I believe the attached test case
best illustrates this. It is essentially the same function,
consisting of a main function which creates a class object and sends
this to a test function. The class implementation can be linked as a
shared or archive library; the test function can be linked as a shared
library or at run time. The dynamic cast fails in the combination
classes in archive library and run time dlopen, but nowhere else.
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1.Unpack enclosed test case with "tar xfz testCast.tar.gz"
Actual Results: ar_dlopen case fails. All other succeeds.
FWIW, this also happens on Fedora Core 1 with gcc-3.3.2-1.
Created attachment 96057 [details]
Test case referred to in the initial report
If you want the ar_dlopen testcase to work, you need to link
it with -WL,--export-dynamic.