This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Why ld not read some non-virtual thunk in a import library or dll?


Hi,
   I am now building Mozilla with Gcc-4.3.0 and binutils 2.18. And I
came across a strange LD error when I link some library to create a
DLL. For detail , I make a cross-compile env for Mingw32 on a Linux
machine. And there is a DLL import library, called
libxpcom_core.dll.a, which provice some symbols. In this library,
there are one class called nsHashProperytBag which multiple inherit
from some other virtual base class. And this class implements all the
virtual methods. In the libxpcom_core.dll.a, I use nm to examine what
it contain, I found it contain all the symbols. I mean, take for
example, there is a SetProperty virtual method in the
nsHashPropertyBag, then there are two symbol for this method: one is
the just the "nsHashPropertyBag::SetProperty
" and the other is "non-virtual thunk to nsHashPropertyBag::SetProperty".

   Then, I use this library to create some new DLL. I make a class
called "Test" which just inherit the nsHashPropertyBag. And I compile
the class and link it with the libxpcom_core.dll.a. But it failed, and
the errors are a bunch of "undefined reference to non-virtual thunk to
...". I use the LD's -cref option to examine where each symbol
appears, but to my surprise, for each "non-virtual thunk to..", the
ones in the libxpcom_core.dll.a is not read at all. And I use the LD's
-M to see the symbol map, there is no "non-virtual thunks" appearing
in the memeory at all.

   And when I link directly to a DLL, this happend too. I am sure all
the __attribute__(dllimport) and export are set correctly. And the
"non-virutal thunks" are rightly in the libxpcom_core.dll.a and the
DLL. I am just wodering why LD did not read these "non-virtual thunk "
out of the library and use them to link.

   Also, I try to make a set of classes and library to reproduce this
problem. I have create an exact set of classes with the same
inheritance of Mozilla code. But, I can't reproduce the problem, it is
really annoying.

   Could you please help me? If you need more information, please tell
me. Any advice will be appreciated very much!

Regards!
Bo


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]