This is the mail archive of the binutils@sources.redhat.com 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]

ELF dynamic loader and undefined weak symbols


Hi.  This is not a binutils issue, but an ELF loader issue.  Hopefully someone
here can point me in the right direction.

GCC 3.X has weak undefined references in crtbegin.o.  Specifically, the one I
am tripping over is (from objdump -x):

  00000000  w      *UND*  00000000 _Jv_RegisterClasses

We currently do not build gcc for java.  As a result, any executable linked
with this object fails:

  $ ./foo
  unknown symbol: _Jv_RegisterClasses
  Could not resolve all symbols
  $

>From crtstuf.c:

  extern void _Jv_RegisterClasses (void *) TARGET_ATTRIBUTE_WEAK;

  if (__JCR_LIST__[0] && _Jv_RegisterClasses)
    _Jv_RegisterClasses (__JCR_LIST__);


It looks like this means our loader is not handling undefined weak symbols
correctly.  The way the code is written, it looks like undefined weak symbols
should not prevent the binary from being loaded, so long as the code checks
the potentially undefined weak reference before using it.  

Can anyone confirm this?  Where can I find documentation that explains what
our ELF loader should do in this case?  

Thanks.
GP



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