This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: PATCH: ld/2537: Linker doesn't allow sections reserved for applications.
On Tue, Apr 18, 2006 at 05:49:09PM +0100, Nick Clifton wrote:
> Hi H.J,
>
> >+ /* FIXME: How to properly handle allocated section
> >+ reserved for applications? */
> >+ (*_bfd_error_handler)
> >+ (_("%B: allocated section `%s' reserved for applications"),
>
> I think that the error message ought to be more helpful here. Something
> along the lines of:
>
> "BFD library does not know how to handle the allocated, application
> specific section %s".
>
> Also, it may be possible for a particular backend to handle such a
> section, so we ought to give elf_backend_section_from_shdr() a chance to
> process it, don't you think ?
Like this?
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.
--- bfd/elf.c.user 2006-04-14 14:45:19.000000000 -0700
+++ bfd/elf.c 2006-04-18 10:23:01.000000000 -0700
@@ -2159,8 +2159,29 @@ bfd_section_from_shdr (bfd *abfd, unsign
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) == TRUE)
+ 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'"),
+ abfd, name);
+ return FALSE;
+ }
+ else
+ /* Allow sections reserved for applications. */
+ return _bfd_elf_make_section_from_shdr (abfd, hdr, name,
+ shindex);
+ }
+
+ return FALSE;
}
return TRUE;