6

Due to a bug in ld I need to copy an ELF section from one object file to another. I can dump the desired section to a file but the problem is that objcopy's --add-section option expects a binary file and the section type information is therefore lost. As far as I can tell I cannot set the type of a section using binutils but I'm hoping I'm wrong :)

I can edit the binary manually to set the section type and that solves the underlying problem, but I'm curious as to whether there's a solution based on standard tools.

For the curious the underlying problem is that when GNU ld links an ARM object file without the .ARM.attributes section (such as a file with just a binary blob living in its own section) it picks some default that causes it to generate invalid veneers to RAM-functions even when the files containing the calls have good .ARM.attributes sections. The only solution (pending https://sourceware.org/bugzilla/show_bug.cgi?id=11897) that I can come up with is to add a .ARM.attributes section to the binary-blob object file. However, that only works if the .ARM.attributes section has the type ARM_ATTRIBUTES.

AJM
  • 1,317
  • 2
  • 15
  • 30
Per Knytt
  • 1,931
  • 1
  • 11
  • 14

0 Answers0