Red Hat Bugzilla – Bug 114073
ld error "atexit" using dmalloc
Last modified: 2007-11-30 17:10:35 EST
Description of problem:
I am posting this against glibc because dmalloc works fine on FC1 i386
and does not appear to be doing anything wrong. This error occurs
both with dmalloc-4.8.1 in FC1 as well as the current dmalloc-5.2.4.
Attempting to compile link a simple program which include dmalloc.h I get:
gcc -O2 -g -fPIC -o mmaptest test2.c -ldmalloc
/usr/bin/ld: mmaptest: hidden symbol `atexit' in
/usr/lib64/libc_nonshared.a(atexit.oS) is referenced by DSO
collect2: ld returned 1 exit status
BTW, if you fiddle with the source and change dmalloc touse
on_exit(...) rather than atexit(...), it works. However, atexit
should be OK too and it is not.
glibc is innocent.
libdmalloc.so has been built incorrectly (ld -shared instead of
OK ... but why does it work as is on i386 and not on x86_64?
Is this change documented somewhere?
If it works on any arch, it is by pure luck, nothing else.
ld -shared should never be used unless the developer is aware of
all consequences of it.
BTW, I am passing this info upstream to the dmalloc
maintainer/developer so future version (hopefully) will have this fixed.
Should be fixed in dmalloc-5.3.0-3.