[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 11:39:26 PDT 2018
grimar updated this revision to Diff 163154.
grimar removed a reviewer: espindola.
grimar added a comment.
Herald added a reviewer: espindola.
- Changed implementation.
https://reviews.llvm.org/D51409
Files:
ELF/SyntheticSections.cpp
ELF/SyntheticSections.h
ELF/Writer.cpp
Index: ELF/Writer.cpp
===================================================================
--- ELF/Writer.cpp
+++ ELF/Writer.cpp
@@ -260,6 +260,8 @@
// Initialize all pointers with NULL. This is needed because
// you can call lld::elf::main more than once as a library.
memset(&Out::First, 0, sizeof(Out));
+ memset(&InX::First, 0, sizeof(InX));
+ memset(&In<ELFT>::First, 0, sizeof(In<ELFT>));
auto Add = [](InputSectionBase *Sec) { InputSections.push_back(Sec); };
Index: ELF/SyntheticSections.h
===================================================================
--- ELF/SyntheticSections.h
+++ ELF/SyntheticSections.h
@@ -974,6 +974,7 @@
// Linker generated sections which can be used as inputs.
struct InX {
+ static uint8_t First;
static InputSection *ARMAttributes;
static BssSection *Bss;
static BssSection *BssRelRo;
@@ -1005,11 +1006,13 @@
};
template <class ELFT> struct In {
+ static uint8_t First;
static VersionDefinitionSection<ELFT> *VerDef;
static VersionTableSection<ELFT> *VerSym;
static VersionNeedSection<ELFT> *VerNeed;
};
+template <class ELFT> uint8_t In<ELFT>::First;
template <class ELFT> VersionDefinitionSection<ELFT> *In<ELFT>::VerDef;
template <class ELFT> VersionTableSection<ELFT> *In<ELFT>::VerSym;
template <class ELFT> VersionNeedSection<ELFT> *In<ELFT>::VerNeed;
Index: ELF/SyntheticSections.cpp
===================================================================
--- ELF/SyntheticSections.cpp
+++ ELF/SyntheticSections.cpp
@@ -3041,6 +3041,7 @@
return Changed;
}
+uint8_t InX::First;
InputSection *InX::ARMAttributes;
BssSection *InX::Bss;
BssSection *InX::BssRelRo;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D51409.163154.patch
Type: text/x-patch
Size: 1664 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180829/baad54ab/attachment.bin>
More information about the llvm-commits
mailing list