[binutils-gdb] Don't check relocations in excluded sections

H.J.Lu hjl@sourceware.org
Thu Apr 21 00:16:00 GMT 2016


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=5ce03cea78d4d8bf00e29e4dfa4952d53f3b1064

commit 5ce03cea78d4d8bf00e29e4dfa4952d53f3b1064
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Wed Apr 20 17:10:55 2016 -0700

    Don't check relocations in excluded sections
    
    When checking relocations after gc-sections has run, the unused sections
    have been removed.  Don't check relocations in excluded sections.
    
    	* elflink.c (_bfd_elf_link_check_relocs): Don't check relocations
    	in excluded sections

Diff:
---
 bfd/ChangeLog | 5 +++++
 bfd/elflink.c | 2 ++
 2 files changed, 7 insertions(+)

diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 73b0b4d..57bb506 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,5 +1,10 @@
 2016-04-20  H.J. Lu  <hongjiu.lu@intel.com>
 
+	* elflink.c (_bfd_elf_link_check_relocs): Don't check relocations
+	in excluded sections
+
+2016-04-20  H.J. Lu  <hongjiu.lu@intel.com>
+
 	PR ld/19969
 	* elf64-x86-64.c (check_relocs_failed): New.
 	(elf_x86_64_need_pic): Moved before elf_x86_64_check_relocs.
diff --git a/bfd/elflink.c b/bfd/elflink.c
index 5af334a..b432384 100644
--- a/bfd/elflink.c
+++ b/bfd/elflink.c
@@ -3518,7 +3518,9 @@ _bfd_elf_link_check_relocs (bfd *abfd, struct bfd_link_info *info)
 	  Elf_Internal_Rela *internal_relocs;
 	  bfd_boolean ok;
 
+	  /* Don't check relocations in excluded sections.  */
 	  if ((o->flags & SEC_RELOC) == 0
+	      || (o->flags & SEC_EXCLUDE) != 0
 	      || o->reloc_count == 0
 	      || ((info->strip == strip_all || info->strip == strip_debugger)
 		  && (o->flags & SEC_DEBUGGING) != 0)



More information about the Binutils-cvs mailing list