+2011-09-21 Tristan Gingold <gingold@adacore.com>
+
+ * mach-o.c (bfd_mach_o_convert_section_name_to_bfd): Add comment.
+ Deals with size limited strings.
+ (bfd_mach_o_build_commands): Initialize more fields.
+
2011-09-15 H.J. Lu <hongjiu.lu@intel.com>
PR ld/13177
}
}
+/* Convert Mach-O section name to BFD. Try to use standard names, otherwise
+ forge a new name. SEGNAME and SECTNAME are 16 bytes strings. */
+
static void
bfd_mach_o_convert_section_name_to_bfd
(bfd *abfd, const char *segname, const char *sectname,
if (*name)
return;
- len = strlen (segname) + 1 + strlen (sectname) + 1;
+ len = 16 + 1 + 16 + 1;
/* Put "LC_SEGMENT." prefix if the segment name is weird (ie doesn't start
with an underscore. */
res = bfd_alloc (abfd, len);
if (res == NULL)
return;
- snprintf (res, len, "%s%s.%s", pfx, segname, sectname);
+ snprintf (res, len, "%s%.16s.%.16s", pfx, segname, sectname);
*name = res;
*flags = SEC_NO_FLAGS;
}
| BFD_MACH_O_PROT_EXECUTE;
seg->initprot = seg->maxprot;
seg->flags = 0;
+ seg->sect_head = NULL;
+ seg->sect_tail = NULL;
/* Create Mach-O sections. */
target_index = 0;