<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/1.5.2" -->
<rss version="2.0" 
	xmlns:content="http://purl.org/rss/1.0/modules/content/">
<channel>
	<title>Comments on: Linkers part 4</title>
	<link>http://www.airs.com/blog/archives/41</link>
	<description>Ian Lance Taylor</description>
	<pubDate>Wed,  8 Oct 2008 05:55:28 +0000</pubDate>
	<generator>http://wordpress.org/?v=1.5.2</generator>

	<item>
 		<title>Comment on Linkers part 4 by: Ian Lance Taylor</title>
		<link>http://www.airs.com/blog/archives/41#comment-4286</link>
		<pubDate>Fri, 14 Sep 2007 04:32:17 +0000</pubDate>
		<guid>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>Comment on Linkers part 4 by: jrlevine</title>
		<link>http://www.airs.com/blog/archives/41#comment-4273</link>
		<pubDate>Thu, 13 Sep 2007 23:46:33 +0000</pubDate>
		<guid>http://www.airs.com/blog/archives/41#comment-4273</guid>
					<description>The other advantage of PIC is better code sharing. If there's no relocation fixups in a page, all processes can share the same physical copy of the page. As soon as there'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>Comment on Linkers part 4 by: Mark J. Wielaard &#187; Ian Lance Taylor&#8217;s Linker Notes</title>
		<link>http://www.airs.com/blog/archives/41#comment-4026</link>
		<pubDate>Fri, 31 Aug 2007 16:21:17 +0000</pubDate>
		<guid>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>[&#8230;] Linkers part 4 - Shared Libraries (Procedure Linkage Table - PLT and Global Offset Table - GOT). [&#8230;]
</p>
]]></content:encoded>
				</item>
	<item>
 		<title>Comment on Linkers part 4 by: Ian Lance Taylor</title>
		<link>http://www.airs.com/blog/archives/41#comment-4000</link>
		<pubDate>Thu, 30 Aug 2007 04:02:55 +0000</pubDate>
		<guid>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>Comment on Linkers part 4 by: wh5a</title>
		<link>http://www.airs.com/blog/archives/41#comment-3993</link>
		<pubDate>Wed, 29 Aug 2007 08:57:26 +0000</pubDate>
		<guid>http://www.airs.com/blog/archives/41#comment-3993</guid>
					<description>Thanks for your great article. I'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'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>
