public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Don't check caches_rawsize in elf_link_input_bfd
@ 2016-04-29 11:10 H.J. Lu
  2016-04-30  2:03 ` Alan Modra
  0 siblings, 1 reply; 2+ messages in thread
From: H.J. Lu @ 2016-04-29 11:10 UTC (permalink / raw)
  To: binutils

When backend caches the section contents, the .eh_frame section size
may be increased due to DW_EH_PE_pcrel address encoding conversion
even if caches_rawsize isn't set.  ld-elf/eh6.d is such an example.
We shouldn't check caches_rawsize to support section size increase.

OK for master?

H.J.
---
	* elflink.c (elf_link_input_bfd): Don't caches_rawsize to
	support section size increase.
---
 bfd/elflink.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/bfd/elflink.c b/bfd/elflink.c
index 021db68..20f75f6 100644
--- a/bfd/elflink.c
+++ b/bfd/elflink.c
@@ -10054,14 +10054,15 @@ elf_link_input_bfd (struct elf_final_link_info *flinfo, bfd *input_bfd)
 	}
 
       /* Get the contents of the section.  They have been cached by a
-	 relaxation routine.  Note that o is a section in an input
-	 file, so the contents field will not have been set by any of
-	 the routines which work on output files.  */
+	 relaxation or check_relocs routines.  The .eh_frame section
+	 size may be increased due to DW_EH_PE_pcrel address encoding
+	 conversion.  Note that o is a section in an input file, so the
+	 contents field will not have been set by any of the routines
+	 which work on output files.  */
       if (elf_section_data (o)->this_hdr.contents != NULL)
 	{
 	  contents = elf_section_data (o)->this_hdr.contents;
-	  if (bed->caches_rawsize
-	      && o->rawsize != 0
+	  if (o->rawsize != 0
 	      && o->rawsize < o->size)
 	    {
 	      memcpy (flinfo->contents, contents, o->rawsize);
-- 
2.5.5

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

* Re: [PATCH] Don't check caches_rawsize in elf_link_input_bfd
  2016-04-29 11:10 [PATCH] Don't check caches_rawsize in elf_link_input_bfd H.J. Lu
@ 2016-04-30  2:03 ` Alan Modra
  0 siblings, 0 replies; 2+ messages in thread
From: Alan Modra @ 2016-04-30  2:03 UTC (permalink / raw)
  To: H.J. Lu; +Cc: binutils

On Fri, Apr 29, 2016 at 04:10:04AM -0700, H.J. Lu wrote:
> When backend caches the section contents, the .eh_frame section size
> may be increased due to DW_EH_PE_pcrel address encoding conversion
> even if caches_rawsize isn't set.  ld-elf/eh6.d is such an example.
> We shouldn't check caches_rawsize to support section size increase.
> 
> OK for master?

No.  This would break targets that increase section size in
relax_section and realloc section contents.

-- 
Alan Modra
Australia Development Lab, IBM

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

end of thread, other threads:[~2016-04-30  2:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-29 11:10 [PATCH] Don't check caches_rawsize in elf_link_input_bfd H.J. Lu
2016-04-30  2:03 ` Alan Modra

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).