https://sourceware.org/bugzilla/show_bug.cgi?id=26827
            Bug ID: 26827
           Summary: ld.gold --threads segfault since 2.35
           Product: binutils
           Version: 2.35
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: gold
          Assignee: ccoutant at gmail dot com
          Reporter: nick.gasson at arm dot com
                CC: ian at airs dot com
  Target Milestone: ---

With latest binutils 2.35:

$ gcc -fuse-ld=gold -Wl,--threads test.c 
malloc(): invalid next size (unsorted)
collect2: fatal error: ld terminated with signal 6 [Aborted], core dumped
compilation terminated.
$ gcc -fuse-ld=gold -Wl,--threads test.c 
$ gcc -fuse-ld=gold -Wl,--threads test.c 
double free or corruption (out)
collect2: fatal error: ld terminated with signal 11 [Segmentation fault], core
dumped
compilation terminated.

The contents of the .c file don't matter. I think it was introduced with

  f37b21b481a7 PR 22843: ld, gold: Add --dependency-file option.

Simple fix:

--- a/gold/fileread.cc
+++ b/gold/fileread.cc
@@ -212,6 +212,7 @@ File_read::open(const Task* task, const std::string& name)
       gold_debug(DEBUG_FILES, "Attempt to open %s succeeded",
                 this->name_.c_str());
       this->token_.add_writer(task);
+      file_counts_initialize_lock.initialize();
       Hold_optional_lock hl(file_counts_lock);
       record_file_read(this->name_);
     }

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Reply via email to