Linker generating incorrect sh_info values for .dynsym section
Nick Clifton
nickc@redhat.com
Fri Aug 12 11:59:00 GMT 2016
Hi Guys,
It appears that the linker is generating incorrect values for the
sh_info field of the .dynsym section. The field is meant to contain
the index of the first non-local symbol in the .dynsym section, but
often it does not.
I created a patch for readelf (see below) to report this problem,
but when I ran regression tests I found that it triggered for nearly
all the ELF based targets, including x86_64 and PowerPC. Two tests in
particular - PROVIDE HIDDEN test 4 and PROVIDE HIDDEN test 10 seem to
trigger this problem every time.
I have spent a day looking through the code in elflink.c but I am not
getting very far, so I am reaching out for help. Does anyone have an
idea as to what might be causing this problem ?
Cheers
Nick
diff --git a/binutils/readelf.c b/binutils/readelf.c
index e6674c2..586d13c 100644
--- a/binutils/readelf.c
+++ b/binutils/readelf.c
@@ -11114,6 +11114,11 @@ process_symbol_table (FILE * file)
}
putchar ('\n');
+
+ if (ELF_ST_BIND (psym->st_info) == STB_LOCAL
+ && si >= section->sh_info)
+ warn (_("local symbol %u found at index >= %s's sh_info value of %u\n"),
+ si, printable_section_name (section), section->sh_info);
}
free (symtab);
More information about the Binutils
mailing list