This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PATCH: ld/2537: Linker doesn't allow sections reserved for applications.


On Thu, Apr 20, 2006 at 03:50:31PM +0100, Maciej W. Rozycki wrote:
> On Wed, 19 Apr 2006, H. J. Lu wrote:
> 
> > I updated it. Do you have other suggestions?
> [...]
> > +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);
> 
>  The order of phrases in a clause is language-specific -- why don't you 
> simply use three distinct sentences?
> 

Here is the new patch.


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-20 08:34:26.000000000 -0700
@@ -2159,8 +2159,43 @@ 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))
+	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;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]