title: Is there any way to generate ELF BINARY using only python library?
body: <p>Is there any way to generate <code>ELF binary</code> using only the python library?</p>
  
  <p>I want to assemble the file below using python library.  </p>
  
  <p><code>a.s</code> : </p>
  
  <pre><code>line 1 : .global _start
  line 2 : _start:
  line 3 :  push _STRING1
  line 4 :  push _STRING2
  line 5 :  call printf
  line 6 : _STRING1:
  line 7 :  .string "gogo"
  line 8 : _STRING2:
  line 9 :  .string "%s"
  </code></pre>
  
  <p>I've tried to use two python libraries <code>keystone</code>, and <code>pwntool</code>.<br>
  However, they support only machine code byte emission corresponding to assembly command.<br>
  (It didn't generate <code>ELF binary</code> consisting of elf header, section header,.. etc)</p>
  
  <p>Also, It doesn't support handling on external library info. (such as <code>line 5</code>)  </p>
  
  <p><br>  </p>
  
  <p>Q. I wanna generate a complete ELF BINARY <code>a.out</code> using python library.<br>
  Is there any possible way to do that?</p>