Date: Mon, 18 Aug 1997 15:46:31 -0700 From: John Polstra <jdp@polstra.com> To: hackers@freebsd.org Subject: Re: [Fwd: Re: Please Help Me Understand dlopen()] Message-ID: <199708182246.PAA04812@austin.polstra.com> In-Reply-To: <33F869F3.446B9B3D@FreeBSD.org> References: <33F869F3.446B9B3D@FreeBSD.org>
next in thread | previous in thread | raw e-mail | index | archive | help
> Hmmm - any comments, ld hackers? I didn't see it in the newsgroup until Joerg brought it to my attention today. (I don't follow the newsgroups, since I already have all the FREE XXX SEX SITE PASSWORDS and FANTASTIC MEGA-INCOME OPPORTUNITIES that I need at the moment.) I agree that it's a bug, and I followed up there saying I planned to fix it. One fix would be switching to ELF, of course ... ;-) I think the fix should assume that the application most likely wants to look up a normal C symbol. So it should do something like this: /* * First try: look for a normal C symbol like (in assembly * language) "_foo". */ if (sym starts with "_") /* Assume caller already added "_" */ trysym = sym; else /* Add "_" for caller */ trysym = concat("_", sym); /* Not C, but you get the idea */ if (lookup(trysym)) return success; /* * Second try: look for a strange C symbol like (in assembly * language) "__foo", or an assembly language symbol "foo" with no * underscore at all. */ if (sym starts with "_") /* Assume C symbol really starts with "_" */ trysym = concat("_", sym); else /* Assume caller wants assembly symbol */ trysym = sym; if (lookup(trysym)) return success; /* * Give up. */ return failure; No matter what heuristic is used, it could do the wrong thing in some cases. John -- John Polstra jdp@polstra.com John D. Polstra & Co., Inc. Seattle, Washington USA "Self-knowledge is always bad news." -- John Barth
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199708182246.PAA04812>