Copying an ELF section between object files with binutils

Due to an error in ld, I need to copy the ELF section from one object file to another. I can dump the necessary section to a file, but the problem is that the objcopys -add-section option expects a binary file and therefore information about the type of section is lost. As far as I can tell I can not set the partition type using binutils, but I hope I'm wrong :)

I can edit the binary file manually to set the type of partition and solves the main problem, but I'm curious if there is a solution based on standard tools.

For the curious, the main problem is that when GNU ld binds an ARM Object without a .ARM.attributes section (for example, a file with just a binary blob living in its own section), it selects some defaults, which leads to what it generates invalid veneers for RAM functions even if files containing calls have good attributes .ARM.attributes sections. The only solution (waiting for https://sourceware.org/bugzilla/show_bug.cgi?id=11897 ) that I can come up with is to add the .ARM.attributes section to the binary-blob file object. However, this only works if the .ARM.attributes section is of type ARM_ATTRIBUTES.

+4
source share

All Articles