Commit dc4b8c68 by Richard Biener Committed by Richard Biener

re PR lto/81968 (early lto debug objects make Solaris ld SEGV)

2017-09-15  Richard Biener  <rguenther@suse.de>

	PR lto/81968
	* simple-object-elf.c (simple_object_elf_copy_lto_debug_sections):
	Iterate marking dependent sections necessary.

From-SVN: r252807
parent 9d89efeb
2017-09-15 Richard Biener <rguenther@suse.de>
PR lto/81968
* simple-object-elf.c (simple_object_elf_copy_lto_debug_sections):
Iterate marking dependent sections necessary.
2017-09-15 Nathan Sidwell <nathan@acm.org>
* cp-demangle.c (is_fnqual_component_type): Reimplement using
......
......@@ -1158,6 +1158,10 @@ simple_object_elf_copy_lto_debug_sections (simple_object_read *sobj,
/* Mark sections as preserved that are required by to be preserved
sections. */
int changed;
do
{
changed = 0;
for (i = 1; i < shnum; ++i)
{
unsigned char *shdr;
......@@ -1175,8 +1179,9 @@ simple_object_elf_copy_lto_debug_sections (simple_object_read *sobj,
if (sh_type == SHT_GROUP)
{
/* Mark groups containing copied sections. */
unsigned entsize = ELF_FETCH_FIELD (type_functions, ei_class, Shdr,
shdr, sh_entsize, Elf_Addr);
unsigned entsize = ELF_FETCH_FIELD (type_functions, ei_class,
Shdr, shdr, sh_entsize,
Elf_Addr);
unsigned char *ent, *buf;
int keep = 0;
offset = ELF_FETCH_FIELD (type_functions, ei_class, Shdr,
......@@ -1201,6 +1206,8 @@ simple_object_elf_copy_lto_debug_sections (simple_object_read *sobj,
}
if (keep)
{
changed |= (pfnret[sh_link - 1] == -1
|| pfnret[i - 1] == -1);
pfnret[sh_link - 1] = 0;
pfnret[i - 1] = 0;
}
......@@ -1211,6 +1218,8 @@ simple_object_elf_copy_lto_debug_sections (simple_object_read *sobj,
/* Mark relocation sections and symtab of copied sections. */
if (pfnret[sh_info - 1] == 0)
{
changed |= (pfnret[sh_link - 1] == -1
|| pfnret[i - 1] == -1);
pfnret[sh_link - 1] = 0;
pfnret[i - 1] = 0;
}
......@@ -1219,9 +1228,14 @@ simple_object_elf_copy_lto_debug_sections (simple_object_read *sobj,
{
/* Mark strings sections of copied symtabs. */
if (pfnret[i - 1] == 0)
{
changed |= pfnret[sh_link - 1] == -1;
pfnret[sh_link - 1] = 0;
}
}
}
}
while (changed);
/* Then perform the actual copying. */
for (i = 1; i < shnum; ++i)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment