<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Linkers part 4</title>
	<atom:link href="http://www.airs.com/blog/archives/41/feed" rel="self" type="application/rss+xml" />
	<link>http://www.airs.com/blog/archives/41</link>
	<description>Ian Lance Taylor</description>
	<lastBuildDate>Sun, 07 Mar 2010 17:12:02 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: berkus</title>
		<link>http://www.airs.com/blog/archives/41/comment-page-1#comment-15623</link>
		<dc:creator>berkus</dc:creator>
		<pubDate>Fri, 02 Jan 2009 22:09:09 +0000</pubDate>
		<guid isPermaLink="false">http://www.airs.com/blog/archives/41#comment-15623</guid>
		<description>Thanks, all this GOT/PLT thing became a bit more clear now. I was seeing the general picture before, but these little details is what was buzzing in my head all the time.</description>
		<content:encoded><![CDATA[<p>Thanks, all this GOT/PLT thing became a bit more clear now. I was seeing the general picture before, but these little details is what was buzzing in my head all the time.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ian Lance Taylor</title>
		<link>http://www.airs.com/blog/archives/41/comment-page-1#comment-15013</link>
		<dc:creator>Ian Lance Taylor</dc:creator>
		<pubDate>Wed, 29 Oct 2008 01:43:52 +0000</pubDate>
		<guid isPermaLink="false">http://www.airs.com/blog/archives/41#comment-15013</guid>
		<description>jlh: yes; thanks for the note.</description>
		<content:encoded><![CDATA[<p>jlh: yes; thanks for the note.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jlh</title>
		<link>http://www.airs.com/blog/archives/41/comment-page-1#comment-15007</link>
		<dc:creator>jlh</dc:creator>
		<pubDate>Tue, 28 Oct 2008 13:25:43 +0000</pubDate>
		<guid isPermaLink="false">http://www.airs.com/blog/archives/41#comment-15007</guid>
		<description>For the uneducated reader, it may worth saying explicitely that the offset added to the ebx register is the difference between the start of the GOT and the actual location in the code.  Otherwise, the following sentence may not be as clear as you might think: &quot;this requires that the GOT always be a fixed offset from the code, regardless of where the shared library is loaded&quot;.  An interesting note is that these offsets are all fixed in the code at link time by the linker program.</description>
		<content:encoded><![CDATA[<p>For the uneducated reader, it may worth saying explicitely that the offset added to the ebx register is the difference between the start of the GOT and the actual location in the code.  Otherwise, the following sentence may not be as clear as you might think: &#8220;this requires that the GOT always be a fixed offset from the code, regardless of where the shared library is loaded&#8221;.  An interesting note is that these offsets are all fixed in the code at link time by the linker program.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ian Lance Taylor</title>
		<link>http://www.airs.com/blog/archives/41/comment-page-1#comment-4286</link>
		<dc:creator>Ian Lance Taylor</dc:creator>
		<pubDate>Fri, 14 Sep 2007 04:32:17 +0000</pubDate>
		<guid isPermaLink="false">http://www.airs.com/blog/archives/41#comment-4286</guid>
		<description>Thanks--I remembered to put that bit into part 6.</description>
		<content:encoded><![CDATA[<p>Thanks&#8211;I remembered to put that bit into part 6.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jrlevine</title>
		<link>http://www.airs.com/blog/archives/41/comment-page-1#comment-4273</link>
		<dc:creator>jrlevine</dc:creator>
		<pubDate>Thu, 13 Sep 2007 23:46:33 +0000</pubDate>
		<guid isPermaLink="false">http://www.airs.com/blog/archives/41#comment-4273</guid>
		<description>The other advantage of PIC is better code sharing. If there&#039;s no relocation fixups in a page, all processes can share the same physical copy of the page. As soon as there&#039;s  load time fixup, you need a separate copy of the page per process. Making and maintaining the copy is way more work than the fixups themselves, since it requires a trap to the system and a copy of the whole page.</description>
		<content:encoded><![CDATA[<p>The other advantage of PIC is better code sharing. If there&#8217;s no relocation fixups in a page, all processes can share the same physical copy of the page. As soon as there&#8217;s  load time fixup, you need a separate copy of the page per process. Making and maintaining the copy is way more work than the fixups themselves, since it requires a trap to the system and a copy of the whole page.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mark J. Wielaard &#187; Ian Lance Taylor&#8217;s Linker Notes</title>
		<link>http://www.airs.com/blog/archives/41/comment-page-1#comment-4026</link>
		<dc:creator>Mark J. Wielaard &#187; Ian Lance Taylor&#8217;s Linker Notes</dc:creator>
		<pubDate>Fri, 31 Aug 2007 16:21:17 +0000</pubDate>
		<guid isPermaLink="false">http://www.airs.com/blog/archives/41#comment-4026</guid>
		<description>[...] Linkers part 4 - Shared Libraries (Procedure Linkage Table - PLT and Global Offset Table - GOT). [...]</description>
		<content:encoded><![CDATA[<p>[...] Linkers part 4 &#8211; Shared Libraries (Procedure Linkage Table &#8211; PLT and Global Offset Table &#8211; GOT). [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ian Lance Taylor</title>
		<link>http://www.airs.com/blog/archives/41/comment-page-1#comment-4000</link>
		<dc:creator>Ian Lance Taylor</dc:creator>
		<pubDate>Thu, 30 Aug 2007 04:02:55 +0000</pubDate>
		<guid isPermaLink="false">http://www.airs.com/blog/archives/41#comment-4000</guid>
		<description>%ebx is a callee saved register for the i386, which means that if a function changes %ebx, it must save it at the start of a function and restore it at the end.  This is normally the best choice for the GOT register, since it means that the the value does not have to be recomputed or restored after a function call.

However, if a function does not call any other functions (i.e., it is a leaf function), then it is not important to keep the address of the GOT in a callee saved register.  In fact, in that case, it is better to keep it in a caller saved register--that is, a register which a function is permitted to change without needing to save and restore it.  So gcc optimizes by putting the GOT table in a caller saved register in a leaf function.

gcc does not always use %ecx, incidentally, though that is a common choice.  Depending on the function, it may choose any available caller saved register.</description>
		<content:encoded><![CDATA[<p>%ebx is a callee saved register for the i386, which means that if a function changes %ebx, it must save it at the start of a function and restore it at the end.  This is normally the best choice for the GOT register, since it means that the the value does not have to be recomputed or restored after a function call.</p>
<p>However, if a function does not call any other functions (i.e., it is a leaf function), then it is not important to keep the address of the GOT in a callee saved register.  In fact, in that case, it is better to keep it in a caller saved register&#8211;that is, a register which a function is permitted to change without needing to save and restore it.  So gcc optimizes by putting the GOT table in a caller saved register in a leaf function.</p>
<p>gcc does not always use %ecx, incidentally, though that is a common choice.  Depending on the function, it may choose any available caller saved register.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: wh5a</title>
		<link>http://www.airs.com/blog/archives/41/comment-page-1#comment-3993</link>
		<dc:creator>wh5a</dc:creator>
		<pubDate>Wed, 29 Aug 2007 08:57:26 +0000</pubDate>
		<guid isPermaLink="false">http://www.airs.com/blog/archives/41#comment-3993</guid>
		<description>Thanks for your great article. I&#039;ve got one question:

It seems if a pic function only access global variables but does not call global functions, it will call __i686.get_pc_thunk.cx to compute the GOT address, and its value will be cached in %ecx, instead of %ebx.  Why is that?

I&#039;m running Linux. Thanks.</description>
		<content:encoded><![CDATA[<p>Thanks for your great article. I&#8217;ve got one question:</p>
<p>It seems if a pic function only access global variables but does not call global functions, it will call __i686.get_pc_thunk.cx to compute the GOT address, and its value will be cached in %ecx, instead of %ebx.  Why is that?</p>
<p>I&#8217;m running Linux. Thanks.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
