From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/1027 Path: news.gmane.org!not-for-mail From: Rich Felker Newsgroups: gmane.linux.lib.musl.general Subject: Re: _GLOBAL_OFFSET_TABLE_ in ldso/*/start.s? Date: Fri, 8 Jun 2012 18:31:38 -0400 Message-ID: <20120608223138.GW163@brightrain.aerifal.cx> References: <10988613.MPE7PukreT@main.pennware.com> 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: dough.gmane.org 1339194974 5781 80.91.229.3 (8 Jun 2012 22:36:14 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 8 Jun 2012 22:36:14 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-1028-gllmg-musl=m.gmane.org@lists.openwall.com Sat Jun 09 00:36:13 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 1Sd7mv-0000BH-84 for gllmg-musl@plane.gmane.org; Sat, 09 Jun 2012 00:36:13 +0200 Original-Received: (qmail 9249 invoked by uid 550); 8 Jun 2012 22:36:13 -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 9240 invoked from network); 8 Jun 2012 22:36:13 -0000 Content-Disposition: inline In-Reply-To: <10988613.MPE7PukreT@main.pennware.com> User-Agent: Mutt/1.5.21 (2010-09-15) Xref: news.gmane.org gmane.linux.lib.musl.general:1027 Archived-At: On Fri, Jun 08, 2012 at 03:54:46PM -0500, Richard Pennington wrote: > What is the purpose of the _GLOBAL_OFFSET_TABLE_ reference in these files? It > doesn't seem to be used by __dynlink(), although it seems to be passed a a > third parameter. If you check git, you'll see that this code was removed. A much older version of __dynlink took a third argument that was the base address of the GOT, which was used to find a pointer to _DYNAMIC in the first GOT slot (traditionally, it was stored there). Then people started reporting crashes when linking with a non-binutils linker (gold? or something from clang/llvm? I don't remember...) that didn't follow this practice, so I replaced it with more elaborate code to find _DYNAMIC. The unneeded code in the asm was not removed until much later. I actually have a new idea for simplifying/replacing some of the C code, but it won't affect the asm. By the way, it might be a good idea to familiarize yourself with git or even the gitweb interface. Questions like the one you had just now can usually be answered quickly by checking the history of the relevant files. Rich