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]

[PATCH RFC] gas: don't process relocs for content-less sections


In line with write_contents(), make write_relocs() bail early on
sections without contents. Otherwise (at least without the other pair
of patches just sent) .bss style sections may get relocations emitted
for them, even though such sections aren't supposed to have any
relocations attached.

However, this causes the gas/all/none test to fail. Thoughts/advice?

gas/
2015-12-07  Jan Beulich  <jbeulich@suse.com>

	* write.c (write_relocs): Bail early when SEC_HAS_CONTENTS is
	not set.

--- 2015-12-07/gas/write.c
+++ 2015-12-07/gas/write.c
@@ -1206,7 +1206,8 @@ write_relocs (bfd *abfd, asection *sec,
 
   /* If seginfo is NULL, we did not create this section; don't do
      anything with it.  */
-  if (seginfo == NULL)
+  if (seginfo == NULL
+      || !(bfd_get_section_flags (abfd, sec) & SEC_HAS_CONTENTS))
     return;
 
   n = 0;



Attachment: binutils-master-bss-write-no-relocs.patch
Description: Text document


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