<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>EmbLogic &#187; rahul.gaur</title>
	<atom:link href="https://www.emblogic.com/blog/author/rahul-gaur/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.emblogic.com/blog</link>
	<description>Embedded System and ARM Training</description>
	<lastBuildDate>Tue, 03 Mar 2020 13:00:06 +0000</lastBuildDate>
	<language>en-US</language>
		<sy:updatePeriod>hourly</sy:updatePeriod>
		<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.9.1</generator>
	<item>
		<title>To Pravjot Sir : Compilation steps for a C code</title>
		<link>https://www.emblogic.com/blog/06/to-pravjot-sir-compilation-steps-for-a-c-code/</link>
		<comments>https://www.emblogic.com/blog/06/to-pravjot-sir-compilation-steps-for-a-c-code/#comments</comments>
		<pubDate>Thu, 28 Jun 2012 10:58:02 +0000</pubDate>
		<dc:creator><![CDATA[rahul.gaur]]></dc:creator>
				<category><![CDATA[Data Structures with C]]></category>

		<guid isPermaLink="false">http://emblogic.org/blog/?p=3635</guid>
		<description><![CDATA[Compilation Steps  For a Hello World program : #include&#60;stdio.h&#62; int main() { printf(&#8220;Hello World \n&#8221;); return 0; } Step One :The C preprocessor implements the macro language used to transform C,C++, and Objective-C programs before they are compiled. aregee@linuxstation src_projects$ &#8230; <a href="https://www.emblogic.com/blog/06/to-pravjot-sir-compilation-steps-for-a-c-code/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>Compilation Steps  For a Hello World program :</p>
<blockquote><p>#include&lt;stdio.h&gt;</p>
<p>int main()</p>
<p>{<br />
printf(&#8220;Hello World \n&#8221;);<br />
return 0;<br />
}</p></blockquote>
<p>Step One :The C preprocessor implements the macro language used to transform C,C++, and Objective-C programs before they are compiled.</p>
<blockquote><p>aregee@linuxstation src_projects$ cpp hello.c &gt; hello.i</p>
<p>aregee@linuxstation src_projects$ ls<br />
hello.i<br />
hello.c<br />
aregee@linuxstation src_projects$</p></blockquote>
<p>Step Two : In this stage the hello.i is compiled to assembly language. -S option with gcc creates a hello.s file</p>
<blockquote><p>aregee@linuxstation src_projects$ gcc -S hello.i<br />
aregee@linuxstation src_projects$ ls<br />
bashme Depriciated Gdata_Module <strong>hello.i</strong> m_c resultworks<br />
Ddev file_rem.py<strong> hello.c </strong><strong>hello.s</strong> Pong_game</p></blockquote>
<p>Step Three : The Assembler can be invoked with the following command and what assembler does is to convert the hello.s to  ELF(executable linked format)  hello.o</p>
<blockquote><p>aregee@linuxstation src_projects$ as hello.s -o hello.o<br />
aregee@linuxstation src_projects$ ls<br />
bashme Depriciated Gdata_Module <strong>hello.i hello.s</strong> Pong_game<br />
Ddev file_rem.py <strong>hello.c hello.o</strong> m_c resultworks<br />
aregee@linuxstation src_projects$</p>
<p>+++++reading hello.o++++++++++</p>
<p>$ readelf -a hello.o</p></blockquote>
<p>Step Four : The Linker  links all the resources required for the execution,thus it links /loads the .so libraries dynamically during the run time&#8230;</p>
<p>To link the hello.o file to the dependent libraries,</p>
<blockquote><p>aregee@linuxstation src_projects$ gcc hello.o<br />
aregee@linuxstation src_projects$ ls<br />
<strong>a.out</strong> Ddev file_rem.py <strong>hello.c hello.o</strong> m_c resultworks<br />
bashme Depriciated Gdata_Module <strong>hello.i hello.s</strong> Pong_game<br />
aregee@linuxstation src_projects$</p>
<p>aregee@linuxstation src_projects$ ./a.out<br />
Hello World</p></blockquote>
<p>Finding Dynamically linked libraries  :</p>
<blockquote><p>aregee@linuxstation src_projects$ ldd a.out<br />
linux-vdso.so.1 =&gt; (0x00007fffaf962000)<br />
libc.so.6 =&gt; /lib64/libc.so.6 (0x0000003d0bc00000)<br />
/lib64/ld-linux-x86-64.so.2 (0x0000003d0b400000)</p>
<p>&nbsp;</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>https://www.emblogic.com/blog/06/to-pravjot-sir-compilation-steps-for-a-c-code/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
