[Bug gold/26827] New: ld.gold --threads segfault since 2.35

2020-11-01 Thread nick.gasson at arm dot com
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.


[Bug gold/26200] ld terminated with signal 11 with LTO and -Wl,--thread-count=2

2020-11-05 Thread nick.gasson at arm dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=26200

--- Comment #7 from Nick Gasson  ---
(In reply to H.J. Lu from comment #4)
> This helps.  But it doesn't fix the problem.
> 

When you say it doesn't fix the problem, perhaps you were running into the
--threads segfault in bug 26827? I tried latest master with your patch above
and the attached test case doesn't crash any more.

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


[Bug gold/26200] ld terminated with signal 11 with LTO and -Wl,--thread-count=2

2020-11-05 Thread nick.gasson at arm dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=26200

--- Comment #9 from Nick Gasson  ---
(In reply to Martin Liska from comment #8)
> > 
> > When you say it doesn't fix the problem, perhaps you were running into the
> > --threads segfault in bug 26827? I tried latest master with your patch above
> > and the attached test case doesn't crash any more.
> 
> It's a different problem related to a LTO plug-in. Please see H.J. brief
> analysis.

I mean you need to apply both patches - the one from comment 4 and the one from
bug 26827 - in order not to get a segfault. I tried your test case after
applying both and it no longer crashes.

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