This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC 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] Improve on PR81968


The following avoids invalid flag combinations on removed sections
and fixes a word-size bug I noticed when doing so.

LTO bootstrap / testing in progress on x86_64-unknown-linux-gnu.

Richard.

2017-08-28  Richard Biener  <rguenther@suse.de>

	PR lto/81968
	* simple-object-elf.c (simple_object_elf_copy_lto_debug_section):
	Adjust field with for sh_type write, set SHF_EXCLUDE only for
	removed sections.

Index: libiberty/simple-object-elf.c
===================================================================
--- libiberty/simple-object-elf.c	(revision 251377)
+++ libiberty/simple-object-elf.c	(working copy)
@@ -1382,7 +1382,7 @@ simple_object_elf_copy_lto_debug_section
 	     unused.  That allows the link editor to remove it in a partial
 	     link.  */
 	  ELF_SET_FIELD (type_functions, ei_class, Shdr,
-			 shdr, sh_type, Elf_Addr, SHT_NULL);
+			 shdr, sh_type, Elf_Word, SHT_NULL);
 	}
 
       flags = ELF_FETCH_FIELD (type_functions, ei_class, Shdr,
@@ -1390,7 +1390,7 @@ simple_object_elf_copy_lto_debug_section
       if (ret == 0)
 	flags &= ~SHF_EXCLUDE;
       else if (ret == -1)
-	flags |= SHF_EXCLUDE;
+	flags = SHF_EXCLUDE;
       ELF_SET_FIELD (type_functions, ei_class, Shdr,
 		     shdr, sh_flags, Elf_Addr, flags);
     }


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