title: How to replace a section of an elf file with another using objcopy or libelf, such that it does get loaded into the Memory?
body: <p>I have a project where I need to remove a section of an ELF file and replace it with another section with slightly modified contents. 
  I was able to first remove the original section and then add my desired section using objcopy. But I always get the warning that:</p>
  
  <pre><code> warning: allocated section `.nv_fatbin' not in segment
  </code></pre>
  
  <p>This leads to the section not getting loaded in the memory and hence desired functionality isn't achieved. </p>
  
  <p>What would be the best way to add it and bring it back into the segment ?</p>
  
  <p>libelf ? 
  Or can this be achieved using objcopy also ?</p>