This is the mail archive of the binutils@sources.redhat.com 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: Does your .eh_frame_hdr change work with DW_EH_PE_absptr?


On Thu, Feb 14, 2002 at 12:58:56PM -0800, H . J . Lu wrote:
> On Thu, Feb 14, 2002 at 09:36:28PM +0100, Jakub Jelinek wrote:
> > On Thu, Feb 14, 2002 at 12:20:12PM -0800, H . J . Lu wrote:
> > > I don't know what the best way to fix it is. Given the problem I see
> > > on Linux/mips, I don't know how well your scheme will work on other
> > > platforms. The key is you have to make sure the .eh_frame_hdr section
> > > needs no run-time relocation or provide the relocation records for it. 
> > > I believe you should require the .eh_frame_hdr section needs no
> > > run-time relocation.
> > 
> > .eh_frame_hdr never needs any run-time relocation.
> > It always uses pcrel encoding.
> > 
> 
> Here is the problem:
> 
> #ifndef ASM_PREFERRED_EH_DATA_FORMAT
> #define ASM_PREFERRED_EH_DATA_FORMAT(CODE,GLOBAL)  DW_EH_PE_absptr
> #endif
> 
> It is true that .eh_frame_hdr itself doesn't need run-time relocation.
> But the VALUEs stored in .eh_frame_hdr may be the one before run-time
> relocation. It is the case for Linux/mips, which uses DW_EH_PE_absptr.
> You have to make sure the VALUEs stored in .eh_frame_hdr need no
> run-time relocations. But there are no checks in elf-eh-frame.c for
> run-time relocations on .eh_frame_hdr. As the result, ld generates the
> wrong binary silently. I am enclosing a simple asm code. The initial
> loc field in FDE is
> 

This is what I come up with.


H.J.
----
2002-02-14  H.J. Lu  (hjl@gnu.org)

	* elf-eh-frame.c (_bfd_elf_discard_section_eh_frame): Abort
	for DW_EH_PE_absptr in FDE while building shared library.

--- bfd/elf-eh-frame.c.eh	Wed Jan 30 23:36:05 2002
+++ bfd/elf-eh-frame.c	Thu Feb 14 14:05:54 2002
@@ -604,6 +604,16 @@ _bfd_elf_discard_section_eh_frame (abfd,
 	  if (cie.fde_encoding == DW_EH_PE_omit)
 	    cie.fde_encoding = DW_EH_PE_absptr;
 
+	  /* For shared libraries, DW_EH_PE_absptr in FDE may require
+	     run-time relocation.  */
+	  if (info->shared
+	      && (cie.fde_encoding & 0xf0) == DW_EH_PE_absptr)
+	    {
+	      (*_bfd_error_handler) (_("%s: DW_EH_PE_absptr in FDE is not supported in shared library"),
+				     bfd_archive_filename (abfd));
+	      abort ();
+	    }
+
 	  initial_insn_length = cie.hdr.length - (buf - last_fde - 4);
 	  if (initial_insn_length <= 50)
 	    {


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