atom feed27 messages in org.freebsd.freebsd-currentRe: E-day problems: rtld-elf dlsym() ...
FromSent OnAttachments
Brian FeldmanSep 1, 1998 4:33 am.c
John PolstraSep 1, 1998 10:21 am 
John PolstraSep 1, 1998 11:01 am 
Doug RabsonSep 1, 1998 11:12 am 
Brian FeldmanSep 1, 1998 12:20 pm 
Mike SmithSep 1, 1998 2:23 pm 
Chuck RobeySep 1, 1998 2:34 pm 
Mike SmithSep 1, 1998 2:46 pm 
John PolstraSep 1, 1998 4:29 pm 
Brian FeldmanSep 1, 1998 4:55 pm 
John PolstraSep 1, 1998 6:17 pm 
John PolstraSep 1, 1998 6:24 pm 
Joel Ray HolveckSep 1, 1998 8:22 pm 
John PolstraSep 1, 1998 9:35 pm 
Terry LambertSep 2, 1998 12:09 am 
Doug RabsonSep 2, 1998 12:32 am 
Terry LambertSep 2, 1998 12:58 am 
Mike SmithSep 2, 1998 2:33 am 
John PolstraSep 2, 1998 8:45 am 
John PolstraSep 2, 1998 8:49 am 
Brian CullySep 2, 1998 11:54 am 
Brian FeldmanSep 2, 1998 12:13 pm 
Mark MurraySep 2, 1998 12:16 pm 
Joel Ray HolveckSep 2, 1998 4:01 pm 
Mike SmithSep 2, 1998 6:04 pm 
Doug RabsonSep 3, 1998 12:49 am 
John PolstraSep 3, 1998 8:46 am 
Subject:Re: E-day problems: rtld-elf dlsym() broken?
From:John Polstra (jd@polstra.com)
Date:Sep 1, 1998 6:17:26 pm
List:org.freebsd.freebsd-current

OK, I believe I've fixed this in src/libexec/rtld-elf/rtld.c revision 1.4. It now does what the documentation says it does. Namely:

dlopen(NULL, ...)

returns a handle which, if passed to dlsym(), will cause the main executable and all of its needed shared objects to be searched for the symbol.

And:

dlsym(NULL, ...)

will search for the symbol in the caller's shared object. N.B., that's the caller's shared object _only_. It doesn't include any needed shared objects.

Also, your particular test case of trying to look up "main" still isn't going to work. The reason is that ELF doesn't put "main" into the dynamic symbol table, because it's not needed there. If you are looking up symbols defined in shared libraries or called from shared libraries, it should work fine. But symbols in the main executable that don't meet those criteria probably won't be found.

There is a linker option "-E" that puts all global symbols into the dynamic symbol table. That will cause it to do what you want. But of course you have to specify it when you're building the program (LDFLAGS+=-Wl,-E).

John

To Unsubscribe: send mail to majo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message