On 12/14/2011 01:21 PM, Roland McGrath wrote:
Probably nobody has really used static linking for libdw before. We wouldn't recommend it.
Indeed. The usage in question comes from the makedumpfile package (http://sourceforge.net/projects/makedumpfile). They actually link everything using --static .... "$(CC) $(CFLAGS) $(LDFLAGS) $(OBJ_PART) $(OBJ_ARCH) -o $@ $< -static -ldw -lbz2 -lebl -ldl -lelf -lz"
I guess someone at our end (in an attempt to reduce the size of the kdump initrd) modified this to a combination of -Wl,-Bstatic for the elfutils stuff and -Wl,-Bdynamic for the remaining libs.
Since the library has no way to know where you're installing a program you link it into, the $ORIGIN methods are not really viable. Resorting to an absolute file name in the library would be dismal.
Agreed.
Tangentally: The whole dlopen() - to load the backend - seems fairly non-static friendly, i.e no way to statically incorporate these elements. No argument, I just wanted to verify I wasn't missing something.
The library tries the unadorned DSO name if the $ORIGIN name fails. So you can just build your program with an appropriate DT_RUNPATH, as we do for libdw.so itself (see libdw/Makefile.am).
Thanks Roland, I'll try this. Appreciate the reply.
Tony