static void dump_bfd_file (char *filename, char *mode, char *target, CORE_ADDR vaddr, char *buf, int len) { bfd *obfd; asection *osection; obfd = bfd_openw_with_cleanup (filename, target, mode); osection = bfd_make_section_anyway (obfd, ".newsec"); bfd_set_section_size (obfd, osection, len); (((osection)->vma = (osection)->lma= (vaddr)), ((osection)->user_set_vma = (boolean)true), true); (((osection)->alignment_power = (0)),true); bfd_set_section_flags (obfd, osection, 0x203); osection->entsize = 0; bfd_set_section_contents (obfd, osection, buf, 0, len); }
/* FIXME: add comment: */ static void dump_bfd_file(const char *filename, const char *mode, const char *target, CORE_ADDR vaddr, const bfd_byte *buf, int len) { bfd *obfd; asection *osection; obfd = bfd_openw_with_cleanup(filename, target, mode); osection = bfd_make_section_anyway(obfd, ".newsec"); bfd_set_section_size(obfd, osection, len); if (bfd_set_section_vma(obfd, osection, vaddr)) { ; } if (bfd_set_section_alignment(obfd, osection, 0)) { ; } bfd_set_section_flags(obfd, osection, (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD)); osection->entsize = 0; bfd_set_section_contents(obfd, osection, buf, 0, len); }