From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/1770 Path: news.gmane.org!not-for-mail From: Rich Felker Newsgroups: gmane.linux.lib.musl.general Subject: dladdr patch status Date: Sun, 26 Aug 2012 17:46:45 -0400 Message-ID: <20120826214645.GO27715@brightrain.aerifal.cx> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1346017507 11671 80.91.229.3 (26 Aug 2012 21:45:07 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 26 Aug 2012 21:45:07 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-1771-gllmg-musl=m.gmane.org@lists.openwall.com Sun Aug 26 23:45:08 2012 Return-path: Envelope-to: gllmg-musl@plane.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1T5kdj-0001pK-72 for gllmg-musl@plane.gmane.org; Sun, 26 Aug 2012 23:45:03 +0200 Original-Received: (qmail 11723 invoked by uid 550); 26 Aug 2012 21:45:00 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 11715 invoked from network); 26 Aug 2012 21:45:00 -0000 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Xref: news.gmane.org gmane.linux.lib.musl.general:1770 Archived-At: I want to go ahead with merging Boris's dladdr patch; the main question that remains is how to handle getting the symbol table length. For ELF hash it's easy; the hash table contains the symbol table length at the beginning. But for GNU-hash-only files, the length is never stored and the number of symbols intended to be visible can only be measured by a linear pass across the GNU hash table. This is no so bad in big-O terms since dladdr is already O(n) where n is the number of symbols, but it's rather ugly code and still probably has a moderate performance cost. The only alternative I see so far is using the _section_ header information to determine the symbol table size. This should work for either GNU or standard ELF hash, without any specialized code, but it's not clear at all to me that section headers are required to exist at runtime. They almost surely exist in .so files since "ld" needs them to link programs or other libraries against the .so file and in practice they exist in the main program unless you've done nasty things to the ELF file to remove them, so it's probably okay... Thoughts? Rich