This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Improve on PR81968
- From: Richard Biener <rguenther at suse dot de>
- To: gcc-patches at gcc dot gnu dot org
- Date: Mon, 28 Aug 2017 13:52:53 +0200 (CEST)
- Subject: [PATCH] Improve on PR81968
- Authentication-results: sourceware.org; auth=none
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);
}