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:
warning: allocated section `.nv_fatbin' not in segment
This leads to the section not getting loaded in the memory and hence desired functionality isn't achieved.
What would be the best way to add it and bring it back into the segment ?
libelf ? Or can this be achieved using objcopy also ?