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 Wed, Apr 19, 2006 at 12:16:53AM -0400, Daniel Jacobowitz wrote:
> On Wed, Apr 19, 2006 at 12:05:25PM +0930, Alan Modra wrote:
> > Next question: What about SHT_LOPROC thru SHT_HIPROC that aren't handled
> > by the backend function?  And SHT_LOOS thru SHT_HIOS?  I think you ought
> > to be consistent about unknown section types in these ranges.  ie. If
> > SHT_LOUSER thru SHT_HIUSER is acceptable, then so should the others.
> 
> It would be Really Really Nice if we could reject these as linker input
> without (A) issuing useless error messages, which we currently (or
> formerly?) did for unknown section types, and (B) rejecting them for
> objdump.
> 

This patch adds an error on all sections we don't know how to handle.


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 07:08:54.000000000 -0700
@@ -2159,8 +2159,34 @@ 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);
+	      return FALSE;
+	    }
+	  else
+	    /* Allow sections reserved for applications.  */
+	    return _bfd_elf_make_section_from_shdr (abfd, hdr, name,
+						    shindex);
+	}
+
+      /* FIXME: We should handle this section.  */
+      (*_bfd_error_handler)
+	(_("%B: don't know how to handle psABI/osABI specific"
+	   " 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]