This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: Creating .note sections
Hi Ceri,
> > How do people reccomend I go about programmaticly adding a .note
> > section to an already-existing (ELF format) binary
If you are doing this at assembly-time, it is quite straight forward.
See md_begin() in gas/config/tc-arm.c for an example.
If you are doing this at link-time, then it is probably easiest to add
the section into the linker script being used.
If you are doing this post-link time, then you might like to consider
using "objcopy --add-section" to do the hard work for you. Just
create the section's contents, write them to a file, and then invoke
objcopy.
> Unfourtunately, the code segfaults _bfd_elf_strtab_emit () after I
> call bfd_close ().
Presumably you have altered or created a symbol table but not
initialised the pointers correctly. Without a working example it is
hard to say. The code you included in your email looked OK in
general, so I would say that you are on the right track.
Cheers
Nick