[openbeosnetteam] Re: libnet fix

> You mean he's defined by current/headers/posix/resolv.h, and
> declared in current/src/kits/network/libnet/res_init.c, right?

No, that's not it. In the header it's defined, (extern), in the
implementation it's declared. And there's nowhere else a _res in the
source of libnet.

> > and I have the feeling that it clashed with a definition
> > outside libnet (probably the BeOS R5 libroot, I haven't looked at it
> > yet, because I only thought of it now).
> 
> Sorry, I'm slow, but in a previous message, you report this linker
> error message:
> ---- 8< ---------------------
> /boot/develop/tools/gnupro/bin/ld: Warning: size of symbol `_res'
> changed from 512 to 376 in /boot/develop/lib/x86/libnet.so
> ---- 8< ---------------------
> 
> Can you tell me on which target this error, well, warning, raise?

This is during link time. If I documented myself correctly, it means the
following:
The symbol _res exists only in res_init.o. Because it is defined in
resolve.h, every other file that included that resolve.h, will have an
undefined reference to _res (because the header says that it's
somewhere). During link time the linker looks up the undefined
references and finds _ref in res_init.o. However, a library that
libnet.so is linked against, also has a _ref. The size of the _ref in
res_init.o is 512 bytes. The size of the other _ref is 376. According to
the documentation, the linker then chooses the largest, which would
comply with the ours, however, in our case the linker chooses to keep
the reference undefined (and doesn't link it to any _res).

> I suspect that, for strange(s) reason(s), the bin tools seems to be
> linked against
> the BeOS R5 libnet.so (net_server's) instead of *our* libnet.so.
> I don't have this link error here, but I build on a BONE system, where
> your system is net_server based, right?
> _res symbol is an internal symbol, unless libroot.so need him for
> hostname()?

I will check it later tonight, but I think it's a plausible idea.

> It's obvious our resolver implementation, coming from BSD, is
different
> from BeOS R5 one.
> It's no suprise that our _res data size is different than R5 libnet.so
> one...
> Under a BONE system, his libnet.so don't export a _res symbol, which
> explain why I don't get clash link error I guess.
> 
> Anyway, our net apps shoudl link against *our* libnet.so, not the BeOS
> one...

As explained above, the apps link to no _res. 

> Last, '_res' is an internal symbol, only used by the resolver
> functions, which all are in libnet.so (except under BONE, where
they're
> in libbind.so, but we don't want to reproduce that), so I don't see
why
> large numbers of apps
> expect to find him in libnet.so!
> Anyone having an explanation here?

I think it's either because it is defined in resolve.h or because many
functions related to hostname lookup 'use' it. 

> > Anyway, I've changed all the
> > _res in the libnet source to the more meaningful (and less probable
> > of
> > clashing) name _resolver_configuration. Now all the utilities work,
> > and
> > when it doesn't work now, it's a real bug! May I commit?
> 
> Go, it should not hurt.

Expect a wonderful new symbol within 12 minutes.

> BTW, congratulations for fixing your read errors in your rtl8139
> driver.
> When you'll feel ready, tell me, I'll post a news to annouce this
> driver on OpenBeOS web site...

Thanks. Though I've stumbled upon another problem :-(, after a while the
receiver functions become terrible slow. As soon as that's finished, and
some other minor things on the TODO list are done, I'll give you a call.


Niels




Other related posts: