aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2007-08-09 23:13:41 +0000
committerH.J. Lu <hjl.tools@gmail.com>2007-08-09 23:13:41 +0000
commit6d33f2176c63496fc73634c8971aef1cd4f99d20 (patch)
tree53108c419e3c7dc4c6d26082430eae3b9a5b7b7a /bfd
parentd4310edb359dda35189ab0ece88a9107085fcf54 (diff)
downloadgdb-6d33f2176c63496fc73634c8971aef1cd4f99d20.zip
gdb-6d33f2176c63496fc73634c8971aef1cd4f99d20.tar.gz
gdb-6d33f2176c63496fc73634c8971aef1cd4f99d20.tar.bz2
2007-08-09 H.J. Lu <hongjiu.lu@intel.com>
PR ld/4909 * elf.c (print_segment_map): New function. (assign_file_positions_for_load_sections): Call print_segment_map when a section can't be allocated in segment.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog7
-rw-r--r--bfd/elf.c27
2 files changed, 34 insertions, 0 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index eb5b3e0..6f211a9 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,10 @@
+2007-08-09 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR ld/4909
+ * elf.c (print_segment_map): New function.
+ (assign_file_positions_for_load_sections): Call print_segment_map
+ when a section can't be allocated in segment.
+
2007-08-09 Jan Kratochvil <jan.kratochvil@redhat.com>
* opncls.c (bfd_openr_iovec): Fix the OPEN parameter macro expansion.
diff --git a/bfd/elf.c b/bfd/elf.c
index ee0339b..bd32974 100644
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -3971,6 +3971,32 @@ vma_page_aligned_bias (bfd_vma vma, ufile_ptr off, bfd_vma maxpagesize)
return ((vma - off) % maxpagesize);
}
+static void
+print_segment_map (const struct elf_segment_map *m)
+{
+ unsigned int j;
+ const char *pt = get_segment_type (m->p_type);
+ char buf[32];
+
+ if (pt == NULL)
+ {
+ if (m->p_type >= PT_LOPROC && m->p_type <= PT_HIPROC)
+ sprintf (buf, "LOPROC+%7.7x",
+ (unsigned int) (m->p_type - PT_LOPROC));
+ else if (m->p_type >= PT_LOOS && m->p_type <= PT_HIOS)
+ sprintf (buf, "LOOS+%7.7x",
+ (unsigned int) (m->p_type - PT_LOOS));
+ else
+ snprintf (buf, sizeof (buf), "%8.8x",
+ (unsigned int) m->p_type);
+ pt = buf;
+ }
+ fprintf (stderr, "%s:", pt);
+ for (j = 0; j < m->count; j++)
+ fprintf (stderr, " %s", m->sections [j]->name);
+ putc ('\n',stderr);
+}
+
/* Assign file positions to the sections based on the mapping from
sections to segments. This function also sets up some fields in
the file header. */
@@ -4359,6 +4385,7 @@ assign_file_positions_for_load_sections (bfd *abfd,
(*_bfd_error_handler)
(_("%B: section `%A' can't be allocated in segment %d"),
abfd, sec, j);
+ print_segment_map (m);
bfd_set_error (bfd_error_bad_value);
return FALSE;
}