aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTristan Gingold <gingold@adacore.com>2011-09-21 10:10:11 +0000
committerTristan Gingold <gingold@adacore.com>2011-09-21 10:10:11 +0000
commit7ba695a99c683e29175cf633a65e479b67be5416 (patch)
treead3a926983698f8b2e6f4999620c20cfd1761160
parentfc436fd907b73452d2d532f448ee3f15efd3617d (diff)
downloadgdb-7ba695a99c683e29175cf633a65e479b67be5416.zip
gdb-7ba695a99c683e29175cf633a65e479b67be5416.tar.gz
gdb-7ba695a99c683e29175cf633a65e479b67be5416.tar.bz2
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.
-rw-r--r--bfd/ChangeLog6
-rw-r--r--bfd/mach-o.c9
2 files changed, 13 insertions, 2 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 3521289..9fb8422 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,9 @@
+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
diff --git a/bfd/mach-o.c b/bfd/mach-o.c
index efc58f5..91f0306 100644
--- a/bfd/mach-o.c
+++ b/bfd/mach-o.c
@@ -183,6 +183,9 @@ bfd_mach_o_normalize_section_name (const char *segname, const char *sectname,
}
}
+/* 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,
@@ -199,7 +202,7 @@ bfd_mach_o_convert_section_name_to_bfd
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. */
@@ -214,7 +217,7 @@ bfd_mach_o_convert_section_name_to_bfd
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;
}
@@ -1406,6 +1409,8 @@ bfd_mach_o_build_commands (bfd *abfd)
| 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;