PATCH: ld/2537: Linker doesn't allow sections reserved for applications.
H. J. Lu
hjl@lucon.org
Thu Apr 20 05:29:00 GMT 2006
On Wed, Apr 19, 2006 at 06:38:39PM +0200, Andreas Schwab wrote:
> "H. J. Lu" <hjl@lucon.org> writes:
>
> > +unsupported:
> > + /* FIXME: We should handle this section. */
> > + (*_bfd_error_handler)
> > + (_("%B: don't know how to handle%s section `%s' [0x%8x]"),
> > + abfd, specific, name, hdr->sh_type);
>
> This is not i18n-friendly.
>
> Andreas.
>
I updated it. Do you have other suggestions?
H.J.
-----
2006-04-18 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.
--- bfd/elf.c.user 2006-04-14 14:45:19.000000000 -0700
+++ bfd/elf.c 2006-04-19 12:54:33.000000000 -0700
@@ -2158,9 +2158,49 @@ bfd_section_from_shdr (bfd *abfd, unsign
break;
default:
- /* Check for any processor-specific section types. */
- return bed->elf_backend_section_from_shdr (abfd, hdr, name,
- shindex);
+ {
+ const char *specific = "";
+
+ /* Check for any processor-specific section types. */
+ 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? */
+ specific = _(" allocated, application specific");
+ goto unsupported;
+ }
+ 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)
+ {
+ specific = _(" processor specific");
+ goto unsupported;
+ }
+ else if (hdr->sh_type >= SHT_LOOS
+ && hdr->sh_type <= SHT_HIOS)
+ {
+ specific = _(" OS specific");
+ goto unsupported;
+ }
+
+unsupported:
+ /* FIXME: We should handle this section. */
+ (*_bfd_error_handler)
+ (_("%B: don't know how to handle%s section `%s' [0x%8x]"),
+ abfd, specific, name, hdr->sh_type);
+ }
+
+ return FALSE;
}
return TRUE;
More information about the Binutils
mailing list