aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2006-04-21 03:42:47 +0000
committerH.J. Lu <hjl.tools@gmail.com>2006-04-21 03:42:47 +0000
commit3eb70a79d6f35f6fc1354c14a8e2dbc1f4e0195e (patch)
tree4be32b3d61886349592378bf91613480f2cfb319
parentfbd9c86b6baf651e928380c6830d160a9149b5cf (diff)
downloadgdb-3eb70a79d6f35f6fc1354c14a8e2dbc1f4e0195e.zip
gdb-3eb70a79d6f35f6fc1354c14a8e2dbc1f4e0195e.tar.gz
gdb-3eb70a79d6f35f6fc1354c14a8e2dbc1f4e0195e.tar.bz2
2006-04-20 H.J. Lu <hongjiu.lu@intel.com>
PR ld/2537 * elf.c (bfd_section_from_shdr): Allow sections reserved for applications. Issue an error on sections we don't know how to handle.
-rw-r--r--bfd/ChangeLog7
-rw-r--r--bfd/elf.c39
2 files changed, 44 insertions, 2 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 1ea6061..d1b48ff 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,10 @@
+2006-04-20 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR ld/2537
+ * elf.c (bfd_section_from_shdr): Allow sections reserved for
+ applications. Issue an error on sections we don't know how
+ to handle.
+
2006-04-19 Alan Modra <amodra@bigpond.net.au>
* Makefile.am: Run "make dep-am".
diff --git a/bfd/elf.c b/bfd/elf.c
index 9e48f66..b1d3a9b 100644
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -2159,8 +2159,43 @@ bfd_section_from_shdr (bfd *abfd, unsigned int shindex)
default:
/* Check for any processor-specific section types. */
- return bed->elf_backend_section_from_shdr (abfd, hdr, name,
- shindex);
+ if (bed->elf_backend_section_from_shdr (abfd, hdr, name, shindex))
+ return TRUE;
+
+ if (hdr->sh_type >= SHT_LOUSER && hdr->sh_type <= SHT_HIUSER)
+ {
+ if ((hdr->sh_flags & SHF_ALLOC) != 0)
+ /* FIXME: How to properly handle allocated section reserved
+ for applications? */
+ (*_bfd_error_handler)
+ (_("%B: don't know how to handle allocated, application "
+ "specific section `%s' [0x%8x]"),
+ abfd, name, hdr->sh_type);
+ else
+ /* Allow sections reserved for applications. */
+ return _bfd_elf_make_section_from_shdr (abfd, hdr, name,
+ shindex);
+ }
+ else if (hdr->sh_type >= SHT_LOPROC
+ && hdr->sh_type <= SHT_HIPROC)
+ /* FIXME: We should handle this section. */
+ (*_bfd_error_handler)
+ (_("%B: don't know how to handle processor specific section "
+ "`%s' [0x%8x]"),
+ abfd, name, hdr->sh_type);
+ else if (hdr->sh_type >= SHT_LOOS && hdr->sh_type <= SHT_HIOS)
+ /* FIXME: We should handle this section. */
+ (*_bfd_error_handler)
+ (_("%B: don't know how to handle OS specific section "
+ "`%s' [0x%8x]"),
+ abfd, name, hdr->sh_type);
+ else
+ /* FIXME: We should handle this section. */
+ (*_bfd_error_handler)
+ (_("%B: don't know how to handle section `%s' [0x%8x]"),
+ abfd, name, hdr->sh_type);
+
+ return FALSE;
}
return TRUE;