PATCH: ld/2537: Linker doesn't allow sections reserved for applications.
H. J. Lu
hjl@lucon.org
Tue Apr 18 16:03:00 GMT 2006
On Fri, Apr 14, 2006 at 04:26:05PM -0700, H. J. Lu wrote:
> Sections bewteen SHT_LOUSER and SHT_HIUSER are reserved for
> applications. Linker should accept them.
>
>
Here is the updated patch. If section reserved for applications has
SHF_ALLOC, linker can't handle it properly.
H.J.
----
2006-04-14 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-17 09:42:46.000000000 -0700
@@ -2158,8 +2158,25 @@ 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,
+ 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: allocated section `%s' reserved for applications"),
+ abfd, name);
+ return FALSE;
+ }
+ else
+ /* Allow sections reserved for applications. */
+ return _bfd_elf_make_section_from_shdr (abfd, hdr, name,
+ shindex);
+ }
+ else
+ /* Check for any processor-specific section types. */
+ return bed->elf_backend_section_from_shdr (abfd, hdr, name,
shindex);
}
More information about the Binutils
mailing list