https://sourceware.org/bugzilla/show_bug.cgi?id=26827
--- Comment #1 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Alan Modra <amo...@sourceware.org>: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=af61e84fd2d6eca1273f1d24b8d7b89c5a1441e5 commit af61e84fd2d6eca1273f1d24b8d7b89c5a1441e5 Author: Nick Gasson <nick.gas...@arm.com> Date: Mon Nov 2 12:02:05 2020 +0800 gold: ensure file_counts_lock is initialized before using Since upgrading to binutils 2.35 I've been experiencing random memory corruption related crashes with ld.gold --threads. It's caused by multiple threads concurrently pushing elements onto the shared std::vector in File_read::record_file_read(). This vector is supposed to be protected by file_counts_lock, but that is initialized lazily and might be NULL when File_read::open() is called, in which case Hold_optional_lock silently skips locking it. Fix by calling the initialize() method before attempting to acquire the lock, the same as other places that use file_counts_lock. PR 26827 * fileread.cc (File_read::open): Ensure file_counts_lock is initialized. * testsuite/Makefile.am (check_PROGRAMS): Add a test that passes -Wl,--threads. * testsuite/Makefile.in: Regenerate. -- You are receiving this mail because: You are on the CC list for the bug.