[lld] r314108 - [ELF][fix] Using statically linked lld leads to segmentation fault on linking ELF

Evgeny Mankov via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 25 07:42:16 PDT 2017


Author: emankov
Date: Mon Sep 25 07:42:15 2017
New Revision: 314108

URL: http://llvm.org/viewvc/llvm-project?rev=314108&view=rev
Log:
[ELF][fix] Using statically linked lld leads to segmentation fault on linking ELF

[Synopsys]
Using function elf::link(...) leads to segmentation fault on its second call. First call finishes correctly.
[Solution]
Clear the rest of globals.

Reviewed by: George Rimar and Rui Ueyama

Differential Revision: http://reviews.llvm.org/D38131

Modified:
    lld/trunk/ELF/Driver.cpp

Modified: lld/trunk/ELF/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Driver.cpp?rev=314108&r1=314107&r2=314108&view=diff
==============================================================================
--- lld/trunk/ELF/Driver.cpp (original)
+++ lld/trunk/ELF/Driver.cpp Mon Sep 25 07:42:15 2017
@@ -75,7 +75,12 @@ bool elf::link(ArrayRef<const char *> Ar
   ErrorCount = 0;
   ErrorOS = &Error;
   InputSections.clear();
+  OutputSections.clear();
   Tar = nullptr;
+  BinaryFiles.clear();
+  BitcodeFiles.clear();
+  ObjectFiles.clear();
+  SharedFiles.clear();
 
   Config = make<Configuration>();
   Driver = make<LinkerDriver>();




More information about the llvm-commits mailing list