Subject: Re: Netatalk library problems.
To: Bill Studenmund <>
From: Dave Huang <>
List: tech-toolchain
Date: 12/20/1999 22:24:46
[ moved to tech-toolchain (is this the right place? :) ]

On Mon, 20 Dec 1999, Bill Studenmund wrote:
> On Sat, 18 Dec 1999, Matthew Reilly wrote:
> > I'm working through getting my C500 configured my home server/gateway
> > machine. I'm trying to get netatalk up and running and having some
> > strange problems. I get these messages when I try to start it up:
> > 
> > Dec 18 07:48:47 gib afpd[175]: uam_load( failed to load. 

> I assume this is with the packaged netatalk?
> Roger, you mentioned you'd seen a fix for this in FreeBSD? Could you tell
> me what it was?
> For NetBSD, I expect it's an a.out vs elf thing. So it should be easy to
> get right in the Makefiles.

I noticed this on NetBSD-current/i386 (ELF) and took a quick look at
it... netatalk is doing a dlopen() on the shared lib with mode=RTLD_NOW.
According to dlfcn(3), "[mode] has currently no effect, but should be
set to DL_LAZY for future compatibility." This isn't true though (at
least not with the ELF; I didn't check a.out). With mode set to
RTLD_NOW, dlopen() returns a NULL pointer. With it set to RTLD_LAZY, it
succeeds. So what does the mode argument do?

Now with mode set to RTLD_LAZY, netatalk gets past the dlopen, but then
dies with an "Undefined PLT symbol" error referencing "uam_register,"
one of the functions in the main netatalk program. Something I noticed
about uam_register(), which may be the cause of the problem, is that
it's meant to be called by the dlopened UAM modules. So I guess my
question is: Can a function in a shared library call a function in the
program that loaded it? I.e. something like:


#include <dlfcn.h>
#include <stdio.h>
int main(void)
  void *h;
  void (*p)();

  h = dlopen("/tmp/", RTLD_LAZY);
  p = dlsym(h, "libfunc");
  return 0;
void callback(void)


#include <stdio.h>
extern void callback(void);
void libfunc(void)

yerfable /tmp> uname -msr
NetBSD 1.4P alpha
yerfable /tmp> cc -c -fPIC libfoo.c
yerfable /tmp> ld -Bshareable -o libfoo.o
yerfable /tmp> cc -o foo foo.c
yerfable /tmp> ./foo
/tmp/ Undefined PLT symbol "callback" (reloc type = 26, symnum = 24)

Name: Dave Huang     |   Mammal, mammal / their names are called /
INet:   |   they raise a paw / the bat, the cat /
FurryMUCK: Dahan     |   dolphin and dog / koala bear and hog -- TMBG
Dahan: Hani G Y+C 24 Y++ L+++ W- C++ T++ A+ E+ S++ V++ F- Q+++ P+ B+ PA+ PL++