diff mbox series

Improve on PR81968

Message ID alpine.LSU.2.20.1708281352040.14191@zhemvz.fhfr.qr
State New
Headers show
Series Improve on PR81968 | expand

Commit Message

Richard Biener Aug. 28, 2017, 11:52 a.m. UTC
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.
diff mbox series

Patch

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);
     }