[PATCH] D66130: [ELF] Initialize 2 fields of Symbol in SymbolTable::insert
Fangrui Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 13 03:17:21 PDT 2019
MaskRay updated this revision to Diff 214794.
MaskRay added a comment.
Delete a sentence from a comment
Repository:
rLLD LLVM Linker
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D66130/new/
https://reviews.llvm.org/D66130
Files:
ELF/SymbolTable.cpp
ELF/Symbols.h
Index: ELF/Symbols.h
===================================================================
--- ELF/Symbols.h
+++ ELF/Symbols.h
@@ -537,6 +537,8 @@
Symbol old = *this;
memcpy(this, &newSym, newSym.getSymbolSize());
+ // old may be a placeholder. The referenced fields must be initialized in
+ // SymbolTable::insert.
versionId = old.versionId;
visibility = old.visibility;
isUsedInRegularObj = old.isUsedInRegularObj;
Index: ELF/SymbolTable.cpp
===================================================================
--- ELF/SymbolTable.cpp
+++ ELF/SymbolTable.cpp
@@ -71,6 +71,8 @@
Symbol *sym = reinterpret_cast<Symbol *>(make<SymbolUnion>());
symVector.push_back(sym);
+ // *sym was not initialized by a constructor. Fields that may get referenced
+ // when it is a placeholder must be initialized here.
sym->setName(name);
sym->symbolKind = Symbol::PlaceholderKind;
sym->versionId = VER_NDX_GLOBAL;
@@ -79,6 +81,8 @@
sym->exportDynamic = false;
sym->inDynamicList = false;
sym->canInline = true;
+ sym->referenced = false;
+ sym->traced = false;
sym->scriptDefined = false;
sym->partition = 1;
return sym;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D66130.214794.patch
Type: text/x-patch
Size: 1161 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190813/8bd850bc/attachment.bin>
More information about the llvm-commits
mailing list