[Help]How to update the section content during the assemble?
Terry Guo
flameroc@gmail.com
Tue Aug 12 08:56:00 GMT 2014
Hi there,
Currently the gas will emit the obj attribute section and then do
relaxation. But my target will adjust some target attributes during
the relaxation, so I want to update the already generated attribute
section after relaxation.
Currently I am using the md_post_relax_hook with following code (in
pseudo code):
attribute_sec = bfd_get_section_by_name (abfd, sec_name);
size = bfd_elf_obj_attr_size (abfd);
seginfo = seg_info (attr_sec);
//generate new frag for updated target attributes.
fragS *newf = frag_alloc (ob);
bfd_elf_set_obj_attr_contents (abfd, (bfd_byte *)newf->fr_literal, size);
//link attribute section with this new frag and discard the old one
seginfo->frchainP->frch_root = newf;
seginfo->frchainP->frch_last = newf;
But it doesn't work. I think I am not understanding this frag stuff
very clearly. What's the correct way to do so? Please help.
BR,
Terry
More information about the Binutils
mailing list