ld --cref is crashing spuriously (dependent on linkpath inclusion as well as number of files in the linkpath directories) with a glibc detected corrupted dl list, and I've tracked it down to a memcpy in ldcref.c. valgrind reports memory errors when doing the memcpy at lines 261 and 303 of the head revision, and the following patch corrects the crash and valgrind does not report any memory errors with it:
--- ld/ldcref.c +++ ld/ldcref.c.mine @@ -258,8 +258,8 @@ c = (struct cref_hash_entry *) p; for (r = c->refs; r != NULL; r = r->next) { - memcpy (old_ref, r, sizeof (struct cref_hash_entry)); - old_ref = (char *) old_ref + sizeof (struct cref_hash_entry); + memcpy (old_ref, r, sizeof (struct cref_ref)); + old_ref = (char *) old_ref + sizeof (struct cref_ref); } } } @@ -300,8 +300,8 @@ c = (struct cref_hash_entry *) p; for (r = c->refs; r != NULL; r = r->next) { - memcpy (r, old_ref, sizeof (struct cref_hash_entry)); - old_ref = (char *) old_ref + sizeof (struct cref_hash_entry); + memcpy (r, old_ref, sizeof (struct cref_ref)); + old_ref = (char *) old_ref + sizeof (struct cref_ref); } } } I believe this corrects the code to perform the intended action, and using the sizeof(struct cref_hash_entry) was a mistake to begin with. -- Summary: cref memcpy + pointer math error Product: binutils Version: 2.21 (HEAD) Status: NEW Severity: normal Priority: P2 Component: ld AssignedTo: unassigned at sources dot redhat dot com ReportedBy: werkt0 at gmail dot com CC: bug-binutils at gnu dot org GCC build triplet: x86_64-redhat-linux GCC host triplet: x86_64-redhat-linux GCC target triplet: x86_64-redhat-linux http://sourceware.org/bugzilla/show_bug.cgi?id=11367 ------- You are receiving this mail because: ------- You are on the CC list for the bug, or are watching someone who is. _______________________________________________ bug-binutils mailing list bug-binutils@gnu.org http://lists.gnu.org/mailman/listinfo/bug-binutils