[PATCH] D51409: [LLD][ELF] - Do not forget to clean synthetic sections pointers before link().

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 29 02:41:04 PDT 2018


grimar created this revision.
grimar added a reviewer: ruiu.
Herald added subscribers: arichardson, emaste.
Herald added a reviewer: espindola.

This is https://bugs.llvm.org/show_bug.cgi?id=38739,

user tries to use LLD as a library and seems faced the dead pointer in `InX::EhFrame`
on non-first call of `link()`. We should clean the global variables correctly.


https://reviews.llvm.org/D51409

Files:
  ELF/Driver.cpp


Index: ELF/Driver.cpp
===================================================================
--- ELF/Driver.cpp
+++ ELF/Driver.cpp
@@ -90,6 +90,35 @@
   ObjectFiles.clear();
   SharedFiles.clear();
 
+  InX::ARMAttributes = nullptr;
+  InX::Bss = nullptr;
+  InX::BssRelRo = nullptr;
+  InX::BuildId = nullptr;
+  InX::EhFrameHdr = nullptr;
+  InX::EhFrame = nullptr;
+  InX::Dynamic = nullptr;
+  InX::DynStrTab = nullptr;
+  InX::DynSymTab = nullptr;
+  InX::Interp = nullptr;
+  InX::GdbIndex = nullptr;
+  InX::Got = nullptr;
+  InX::GotPlt = nullptr;
+  InX::GnuHashTab = nullptr;
+  InX::HashTab = nullptr;
+  InX::IgotPlt = nullptr;
+  InX::MipsGot = nullptr;
+  InX::MipsRldMap = nullptr;
+  InX::Plt = nullptr;
+  InX::Iplt = nullptr;
+  InX::RelaDyn = nullptr;
+  InX::RelrDyn = nullptr;
+  InX::RelaPlt = nullptr;
+  InX::RelaIplt = nullptr;
+  InX::ShStrTab = nullptr;
+  InX::StrTab = nullptr;
+  InX::SymTab = nullptr;
+  InX::SymTabShndx = nullptr;
+
   Config = make<Configuration>();
   Driver = make<LinkerDriver>();
   Script = make<LinkerScript>();


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D51409.163032.patch
Type: text/x-patch
Size: 1066 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180829/cd3050dd/attachment.bin>


More information about the llvm-commits mailing list