title: Why are labels not printed while re-writing assembly with just bytes, and how can a program always start at the same memory location?
body: <p>I have the following assembly code linked to final executable.</p>
  
  <pre><code>section .text
  global _start
  
  _start: mov eax, 4
          mov ebx, 1
          mov ecx, mesg
          mov edx, 9
          int 0x80
  mesg    db      "Kingkong",0xa
  </code></pre>
  
  <p>The next thing I did was get its hexcode
       <code>0xb8,0x04,0x00,0x00,0x00,0xbb,0x01,0x00,0x00,0x00,0xb9,0x76,0x80,0x04,0x08,0xba,0x09,0x00,0x00,0x00,0xcd,0x80,0x4b,0x69,0x6e,0x67,0x6b,0x6f,0x6e,0x67,0x0a</code></p>
  
  <p>and place it into another program which looks like the one below</p>
  
  <pre><code>section .text
  global _start
  _start:
          db 0xb8,0x04,0x00,0x00,0x00,0xbb,0x01,0x00,0x00,0x00,0xb9,0x76,0x80,0x04,0x08,0xba,0x09,0x00,0x00,0x00,0xcd,0x80,0x4b,0x69,0x6e,0x67,0x6b,0x6f,0x6e,0x67,0x0a
  </code></pre>
  
  <p>Now when I assemble the above file and get an <code>objdump</code> over it, it gives me</p>
  
  <pre><code>08048060 &lt;_start&gt;:
   8048060:       b8 04 00 00 00          mov    $0x4,%eax
   8048065:       bb 01 00 00 00          mov    $0x1,%ebx
   804806a:       b9 76 80 04 08          mov    $0x8048076,%ecx
   804806f:       ba 09 00 00 00          mov    $0x9,%edx
   8048074:       cd 80                   int    $0x80
   8048076:       4b                      dec    %ebx
   8048077:       69 6e 67 6b 6f 6e 67    imul   $0x676e6f6b,0x67(%esi),%ebp
   804807e:       0a                      .byte 0xa
  </code></pre>
  
  <p>The <code>mesg</code> label is not seen in the final dump, how does the program then figure out the address of the <code>mesg</code> segment in the above program?</p>
  
  <p><strong>EDIT:</strong>
    Well I would like to add a small question to this after reading the answers, I can understand that labels are not used for the actual addressing but the address is directly baked into the code, But if address are specified like <code>mov    $0x8048076,%ecx</code> what is the guarantee that the next time the program loads it will start exactly at that same address ... What if I wrap this code with a C ? What if I want to run it on another machine with a completely different memory pattern ?</p>