public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Temporary elf-eh-frame.c fix till _cooked_size 0 works
@ 2001-12-18 13:34 Jakub Jelinek
  2001-12-19 14:28 ` Richard Henderson
  0 siblings, 1 reply; 2+ messages in thread
From: Jakub Jelinek @ 2001-12-18 13:34 UTC (permalink / raw)
  To: binutils

Hi!

Ok to commit the following temporary workaround till _raw_size/_cooked_size
changes are done (which will take longer)?
Otherwise, ld currently builds bad libgcj.so. Tested on libgcj build.

2001-12-18  Jakub Jelinek  <jakub@redhat.com>

	* elf-eh-frame.c (_bfd_elf_discard_section_eh_frame): If new_size
	is 0, temporarily grow it to minimal CIE size.
	(_bfd_elf_write_section_eh_frame): If input .eh_frame section would
	end up empty, build a fake minimal CIE.

--- bfd/elf-eh-frame.c.jj	Mon Dec 17 15:14:48 2001
+++ bfd/elf-eh-frame.c	Tue Dec 18 23:31:12 2001
@@ -701,8 +701,12 @@ _bfd_elf_discard_section_eh_frame (abfd,
       hdr_info->last_cie_offset = sec_info->entry[last_cie_ndx].new_offset;
     }
 
+  /* FIXME: Currently it is not possible to shrink sections to zero size at
+     this point, so build a fake minimal CIE.  */
+  if (new_size == 0)
+    new_size = 16;
+
   /* Shrink the sec as needed.  */
-  
   sec->_cooked_size = new_size;
   if (sec->_cooked_size == 0)
     sec->flags |= SEC_EXCLUDE;
@@ -1069,6 +1073,18 @@ _bfd_elf_write_section_eh_frame (abfd, s
       p += sec_info->entry[i].size;
     }
 
+  /* FIXME: Once _bfd_elf_discard_section_eh_frame will be able to
+     shrink sections to zero size, this won't be needed any more.  */
+  if (p == contents && sec->_cooked_size == 16)
+    {
+      bfd_put_32 (abfd, 12, p);		/* Fake CIE length */
+      bfd_put_32 (abfd, 0, p + 4);	/* Fake CIE id */
+      p[8] = 1;				/* Fake CIE version */
+      memset (p + 9, 0, 7);		/* Fake CIE augmentation, 3xleb128
+					   and 3xDW_CFA_nop as pad  */
+      p += 16;
+    }
+
   BFD_ASSERT ((bfd_size_type) (p - contents) == sec->_cooked_size);
 
   return bfd_set_section_contents (abfd, sec->output_section,

	Jakub

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] Temporary elf-eh-frame.c fix till _cooked_size 0 works
  2001-12-18 13:34 [PATCH] Temporary elf-eh-frame.c fix till _cooked_size 0 works Jakub Jelinek
@ 2001-12-19 14:28 ` Richard Henderson
  0 siblings, 0 replies; 2+ messages in thread
From: Richard Henderson @ 2001-12-19 14:28 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: binutils

On Tue, Dec 18, 2001 at 10:38:01PM +0100, Jakub Jelinek wrote:
> 	* elf-eh-frame.c (_bfd_elf_discard_section_eh_frame): If new_size
> 	is 0, temporarily grow it to minimal CIE size.
> 	(_bfd_elf_write_section_eh_frame): If input .eh_frame section would
> 	end up empty, build a fake minimal CIE.

Ok.


r~

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2001-12-19 22:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-12-18 13:34 [PATCH] Temporary elf-eh-frame.c fix till _cooked_size 0 works Jakub Jelinek
2001-12-19 14:28 ` Richard Henderson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).