forked from OSchip/llvm-project
Partially revert "PECOFF: Do not add layout-after edges."
This reverts commit r230732. sectionSize() in lib/Core/SymbolTable.cpp still depends on the layout- after edges, so we couldn't remove them yet. llvm-svn: 230734
This commit is contained in:
parent
93c7fa209c
commit
6c39e77896
|
@ -351,16 +351,21 @@ void addLayoutEdge(T *a, U *b, uint32_t which) {
|
|||
a->addReference(std::unique_ptr<COFFReference>(ref));
|
||||
}
|
||||
|
||||
/// Connect atoms with layout-before edges. It prevents atoms from
|
||||
/// being GC'ed (aka dead-stripped) if there is a reference to one of
|
||||
/// the atoms in the same layout-before chain. In such case we want to
|
||||
/// emit all the atoms appeared in the same chain, because the "live"
|
||||
/// atom may reference other atoms in the same chain.
|
||||
template <typename T, typename U> void connectWithLayoutEdge(T *a, U *b) {
|
||||
addLayoutEdge(a, b, lld::Reference::kindLayoutAfter);
|
||||
addLayoutEdge(b, a, lld::Reference::kindLayoutBefore);
|
||||
}
|
||||
|
||||
/// Connect atoms with layout-before/after edges. It prevents atoms
|
||||
/// from being GC'ed (aka dead-stripped) if there is a reference to
|
||||
/// one of the atoms in the same layout-before chain. In such case we
|
||||
/// want to emit all the atoms appeared in the same chain, because the
|
||||
/// "live" atom may reference other atoms in the same chain.
|
||||
template <typename T> void connectAtomsWithLayoutEdge(std::vector<T *> &atoms) {
|
||||
if (atoms.size() < 2)
|
||||
return;
|
||||
for (auto it = atoms.begin(), e = atoms.end(); it + 1 != e; ++it)
|
||||
addLayoutEdge(*(it + 1), *it, lld::Reference::kindLayoutBefore);
|
||||
connectWithLayoutEdge(*it, *(it + 1));
|
||||
}
|
||||
|
||||
} // namespace pecoff
|
||||
|
|
|
@ -756,7 +756,7 @@ std::error_code FileCOFF::AtomizeDefinedSymbols(
|
|||
if (atoms.size() > 0)
|
||||
atoms[0]->setAlignment(getAlignment(section));
|
||||
|
||||
// Connect atoms with layout-before edges.
|
||||
// Connect atoms with layout-before/layout-after edges.
|
||||
connectAtomsWithLayoutEdge(atoms);
|
||||
|
||||
for (COFFDefinedFileAtom *atom : atoms) {
|
||||
|
|
Loading…
Reference in New Issue