title: Embedding binary blobs using gcc mingw
body: <p>I am trying to embed binary blobs into an exe file. I am using mingw gcc.</p>
  
  <p>I make the object file like this:</p>
  
  <pre><code>ld -r -b binary -o binary.o input.txt
  </code></pre>
  
  <p>I then look objdump output to get the symbols:</p>
  
  <pre><code>objdump -x binary.o
  </code></pre>
  
  <p>And it gives symbols named:</p>
  
  <pre><code>_binary_input_txt_start
  _binary_input_txt_end
  _binary_input_txt_size
  </code></pre>
  
  <p>I then try and access them in my C program:</p>
  
  <pre><code>#include &lt;stdlib.h&gt;
  #include &lt;stdio.h&gt;
  
  extern char _binary_input_txt_start[];
  
  int main (int argc, char *argv[])
  {
      char *p;
      p = _binary_input_txt_start;
  
      return 0;
  }
  </code></pre>
  
  <p>Then I compile like this:</p>
  
  <pre><code>gcc -o test.exe test.c binary.o
  </code></pre>
  
  <p>But I always get:</p>
  
  <pre><code>undefined reference to _binary_input_txt_start
  </code></pre>
  
  <p>Does anyone know what I am doing wrong?</p>