title: Specify start address in nasm?
body: <p>Consider a file with only the simple 32-bit x86 assembly statement:</p>
  
  <pre><code>call 0xc1066580
  </code></pre>
  
  <p>If I assemble this file with nasm -f elf I get:</p>
  
  <pre><code>   0:   e8 7c 65 06 c1          call   0xc1066581
  </code></pre>
  
  <p>If I use GCC and specify -Ttext=0 and -nostdlib I get:</p>
  
  <pre><code>   0:   e8 7b 65 06 c1          call   c1066580
  </code></pre>
  
  <p>-nostdlib
      Do not use the standard system startup files or libraries when linking. No startup files and only the libraries you specify are passed to the linker, and options specifying linkage of the system libraries, such as -static-libgcc or -shared-libgcc, are ignored. </p>
  
  <p>But what exactly does -Ttext=0 do? I use it to specify the entry address the EIP starts at when it is loaded/executed. I'm unable to find -Ttext in the manpages, when I search online I found this: </p>
  
  <p>"-Ttext is an alias for "--section-start=text", which reads as:
  --section-start=sectionname=org
  Locate a section in the output file at the absolute address given
  by org. You may use this option as many times as necessary to
  locate multiple sections in the command line. org must be a single
  hexadecimal integer; for compatibility with other linkers, you may
  omit the leading 0x usually associated with hexadecimal values.
  Note: there should be no white space between sectionname, the
  equals sign ("="), and org."</p>
  
  <p>From <a href="http://www.linuxquestions.org/questions/linux-general-1/gcc-creating-a-huge-executable-image-redhat-2-6-18-8-el5-x86_64-linux-759302/" rel="nofollow">http://www.linuxquestions.org/questions/linux-general-1/gcc-creating-a-huge-executable-image-redhat-2-6-18-8-el5-x86_64-linux-759302/</a></p>
  
  <p>However, I don't find --section or sectionname in my manpage either, and when I try to replace -Ttext with --section-name I get that this is an unrecognized argument (this is GCC 4.7.2 if it is relevant).</p>
  
  <p>Could someone tell me if this explanation (of -Ttext) is accurate and where I can find it in my manual? If it is not accurate, what does -Ttext really do?</p>
  
  <p>My other question is: How does one specify a similar argument as -Ttext to nasm? Or in other words, what do I need to do to make nasm produce the same output as gcc does?</p>
  
  <p>I tried to execute the same assemble statements (with nasm and gcc) on both a 64-bit and 32-bit system, I get the same results.</p>