title: How to correctly use a simple linker script? Executable gets SIGKILL when run
body: <p>I'm trying to understand deeper linking process and linker scripts...looking at binutils doc i found a simple linker script implementation that i've improved by adding some commands:</p>
  
  <pre><code>OUTPUT_FORMAT("elf32-i386", "elf32-i386",
            "elf32-i386")
  OUTPUT_ARCH(i386)
  
  ENTRY(mymain)
  
  SECTIONS
  {
     . = 0x10000;
     .text : { *(.text) }
     . = 0x8000000;
     .data : { *(.data) }
     .bss : { *(.bss) }
  }
  </code></pre>
  
  <p>My program is a very simple program:</p>
  
  <pre><code>void mymain(void)
  {
    int a;
    a++;
  }
  </code></pre>
  
  <p>Now i tried to build an executable: </p>
  
  <pre><code>gcc -c main.c
  ld -o prog -T my_script.lds main.o
  </code></pre>
  
  <p>But if i try to run <code>prog</code> it receives a <code>SIGKILL</code> during startup. I know that when a program is compiled and linked with the command:</p>
  
  <pre><code>gcc prog.c -o prog
  </code></pre>
  
  <p>the final executable is the product also of other object files like <code>crt1.o</code>, <code>crti.o</code> and <code>crtn.o</code> but what about my case? Which is the correct way to use this linker scripts?</p>