forked from OSchip/llvm-project
Remove sectionPosition attribute.
This code is simply dead. No one is using it. http://reviews.llvm.org/D8125 llvm-svn: 231583
This commit is contained in:
parent
316d64ea1d
commit
0536677ad6
|
@ -173,13 +173,6 @@ public:
|
|||
sectionCustomRequired // linker must place in specific section
|
||||
};
|
||||
|
||||
enum SectionPosition {
|
||||
sectionPositionStart, // atom must be at start of section (and zero size)
|
||||
sectionPositionEarly, // atom should be near start of section
|
||||
sectionPositionAny, // atom can be anywhere in section
|
||||
sectionPositionEnd // atom must be at end of section (and zero size)
|
||||
};
|
||||
|
||||
enum DeadStripKind {
|
||||
deadStripNormal, // linker may dead strip this atom
|
||||
deadStripNever, // linker must never dead strip this atom
|
||||
|
@ -272,9 +265,6 @@ public:
|
|||
/// name of the section the atom should be placed into.
|
||||
virtual StringRef customSectionName() const = 0;
|
||||
|
||||
/// \brief constraints on whether the linker may dead strip away this atom.
|
||||
virtual SectionPosition sectionPosition() const = 0;
|
||||
|
||||
/// \brief constraints on whether the linker may dead strip away this atom.
|
||||
virtual DeadStripKind deadStrip() const = 0;
|
||||
|
||||
|
|
|
@ -199,10 +199,6 @@ public:
|
|||
return DefinedAtom::sectionBasedOnContent;
|
||||
}
|
||||
|
||||
SectionPosition sectionPosition() const override {
|
||||
return DefinedAtom::sectionPositionAny;
|
||||
}
|
||||
|
||||
StringRef customSectionName() const override { return StringRef(); }
|
||||
DeadStripKind deadStrip() const override {
|
||||
return DefinedAtom::deadStripNormal;
|
||||
|
|
|
@ -181,11 +181,6 @@ void Resolver::doDefinedAtom(const DefinedAtom &atom) {
|
|||
<< atom.name()
|
||||
<< "\n");
|
||||
|
||||
// Verify on zero-size atoms are pinned to start or end of section.
|
||||
assert((atom.sectionPosition() != DefinedAtom::sectionPositionStart &&
|
||||
atom.sectionPosition() != DefinedAtom::sectionPositionEnd) ||
|
||||
atom.size() == 0);
|
||||
|
||||
// add to list of known atoms
|
||||
_atoms.push_back(&atom);
|
||||
|
||||
|
|
|
@ -51,8 +51,6 @@ public:
|
|||
|
||||
StringRef customSectionName() const override { return StringRef(); }
|
||||
|
||||
SectionPosition sectionPosition() const override { return sectionPositionAny; }
|
||||
|
||||
DeadStripKind deadStrip() const override {
|
||||
return DefinedAtom::deadStripNormal;
|
||||
}
|
||||
|
@ -114,8 +112,6 @@ public:
|
|||
|
||||
StringRef customSectionName() const override { return StringRef(); }
|
||||
|
||||
SectionPosition sectionPosition() const override { return sectionPositionAny; }
|
||||
|
||||
DeadStripKind deadStrip() const override {
|
||||
return DefinedAtom::deadStripNormal;
|
||||
}
|
||||
|
|
|
@ -335,10 +335,6 @@ public:
|
|||
return _sectionName;
|
||||
}
|
||||
|
||||
SectionPosition sectionPosition() const override {
|
||||
return sectionPositionAny;
|
||||
}
|
||||
|
||||
// It isn't clear that __attribute__((used)) is transmitted to the ELF object
|
||||
// file.
|
||||
DeadStripKind deadStrip() const override { return deadStripNormal; }
|
||||
|
@ -496,10 +492,6 @@ public:
|
|||
|
||||
StringRef customSectionName() const override { return _sectionName; }
|
||||
|
||||
SectionPosition sectionPosition() const override {
|
||||
return sectionPositionAny;
|
||||
}
|
||||
|
||||
DeadStripKind deadStrip() const override { return deadStripNormal; }
|
||||
|
||||
ContentPermissions permissions() const override { return permR__; }
|
||||
|
@ -577,10 +569,6 @@ public:
|
|||
|
||||
StringRef customSectionName() const override { return ".bss"; }
|
||||
|
||||
SectionPosition sectionPosition() const override {
|
||||
return sectionPositionAny;
|
||||
}
|
||||
|
||||
DeadStripKind deadStrip() const override { return deadStripNormal; }
|
||||
|
||||
ContentPermissions permissions() const override { return permRW_; }
|
||||
|
|
|
@ -166,13 +166,12 @@ void LayoutPass::checkFollowonChain(MutableFile::DefinedAtomRange &range) {
|
|||
#endif // #ifndef NDEBUG
|
||||
|
||||
/// The function compares atoms by sorting atoms in the following order
|
||||
/// a) Sorts atoms by Section position preference
|
||||
/// b) Sorts atoms by their ordinal overrides (layout-after/ingroup)
|
||||
/// c) Sorts atoms by their permissions
|
||||
/// d) Sorts atoms by their content
|
||||
/// e) Sorts atoms by custom sorter
|
||||
/// f) Sorts atoms on how they appear using File Ordinality
|
||||
/// g) Sorts atoms on how they appear within the File
|
||||
/// a) Sorts atoms by their ordinal overrides (layout-after/ingroup)
|
||||
/// b) Sorts atoms by their permissions
|
||||
/// c) Sorts atoms by their content
|
||||
/// d) Sorts atoms by custom sorter
|
||||
/// e) Sorts atoms on how they appear using File Ordinality
|
||||
/// f) Sorts atoms on how they appear within the File
|
||||
static bool compareAtomsSub(const LayoutPass::SortKey &lc,
|
||||
const LayoutPass::SortKey &rc,
|
||||
LayoutPass::SortOverride customSorter,
|
||||
|
@ -184,19 +183,6 @@ static bool compareAtomsSub(const LayoutPass::SortKey &lc,
|
|||
return false;
|
||||
}
|
||||
|
||||
// Sort by section position preference.
|
||||
DefinedAtom::SectionPosition leftPos = left->sectionPosition();
|
||||
DefinedAtom::SectionPosition rightPos = right->sectionPosition();
|
||||
|
||||
bool leftSpecialPos = (leftPos != DefinedAtom::sectionPositionAny);
|
||||
bool rightSpecialPos = (rightPos != DefinedAtom::sectionPositionAny);
|
||||
if (leftSpecialPos || rightSpecialPos) {
|
||||
if (leftPos != rightPos) {
|
||||
DEBUG(reason = formatReason("sectionPos", (int)leftPos, (int)rightPos));
|
||||
return leftPos < rightPos;
|
||||
}
|
||||
}
|
||||
|
||||
// Find the root of the chain if it is a part of a follow-on chain.
|
||||
const DefinedAtom *leftRoot = lc._root;
|
||||
const DefinedAtom *rightRoot = rc._root;
|
||||
|
|
|
@ -151,7 +151,7 @@ struct NativeAtomAttributesV1 {
|
|||
uint8_t interposable;
|
||||
uint8_t merge;
|
||||
uint8_t contentType;
|
||||
uint8_t sectionChoiceAndPosition; // high nibble is choice, low is position
|
||||
uint8_t sectionChoice;
|
||||
uint8_t deadStrip;
|
||||
uint8_t dynamicExport;
|
||||
uint8_t permissions;
|
||||
|
|
|
@ -71,17 +71,11 @@ public:
|
|||
}
|
||||
|
||||
DefinedAtom::SectionChoice sectionChoice() const override {
|
||||
return (DefinedAtom::SectionChoice)(
|
||||
attributes().sectionChoiceAndPosition >> 4);
|
||||
return (DefinedAtom::SectionChoice)(attributes().sectionChoice);
|
||||
}
|
||||
|
||||
StringRef customSectionName() const override;
|
||||
|
||||
SectionPosition sectionPosition() const override {
|
||||
return (DefinedAtom::SectionPosition)(
|
||||
attributes().sectionChoiceAndPosition & 0xF);
|
||||
}
|
||||
|
||||
DefinedAtom::DeadStripKind deadStrip() const override {
|
||||
return (DefinedAtom::DeadStripKind)(attributes().deadStrip);
|
||||
}
|
||||
|
|
|
@ -422,8 +422,7 @@ private:
|
|||
attrs.interposable = atom.interposable();
|
||||
attrs.merge = atom.merge();
|
||||
attrs.contentType = atom.contentType();
|
||||
attrs.sectionChoiceAndPosition
|
||||
= atom.sectionChoice() << 4 | atom.sectionPosition();
|
||||
attrs.sectionChoice = atom.sectionChoice();
|
||||
attrs.deadStrip = atom.deadStrip();
|
||||
attrs.dynamicExport = atom.dynamicExport();
|
||||
attrs.codeModel = atom.codeModel();
|
||||
|
|
|
@ -99,9 +99,6 @@ public:
|
|||
Merge merge() const override { return mergeNo; }
|
||||
Alignment alignment() const override { return Alignment(0); }
|
||||
StringRef customSectionName() const override { return ""; }
|
||||
SectionPosition sectionPosition() const override {
|
||||
return sectionPositionAny;
|
||||
}
|
||||
DeadStripKind deadStrip() const override { return deadStripNormal; }
|
||||
|
||||
Kind getKind() const { return _kind; }
|
||||
|
|
|
@ -332,15 +332,6 @@ template <> struct ScalarEnumerationTraits<lld::DefinedAtom::SectionChoice> {
|
|||
}
|
||||
};
|
||||
|
||||
template <> struct ScalarEnumerationTraits<lld::DefinedAtom::SectionPosition> {
|
||||
static void enumeration(IO &io, lld::DefinedAtom::SectionPosition &value) {
|
||||
io.enumCase(value, "start", lld::DefinedAtom::sectionPositionStart);
|
||||
io.enumCase(value, "early", lld::DefinedAtom::sectionPositionEarly);
|
||||
io.enumCase(value, "any", lld::DefinedAtom::sectionPositionAny);
|
||||
io.enumCase(value, "end", lld::DefinedAtom::sectionPositionEnd);
|
||||
}
|
||||
};
|
||||
|
||||
template <> struct ScalarEnumerationTraits<lld::DefinedAtom::Interposable> {
|
||||
static void enumeration(IO &io, lld::DefinedAtom::Interposable &value) {
|
||||
io.enumCase(value, "no", DefinedAtom::interposeNo);
|
||||
|
@ -810,7 +801,6 @@ template <> struct MappingTraits<const lld::DefinedAtom *> {
|
|||
_scope(atom->scope()), _interpose(atom->interposable()),
|
||||
_merge(atom->merge()), _contentType(atom->contentType()),
|
||||
_alignment(atom->alignment()), _sectionChoice(atom->sectionChoice()),
|
||||
_sectionPosition(atom->sectionPosition()),
|
||||
_deadStrip(atom->deadStrip()), _dynamicExport(atom->dynamicExport()),
|
||||
_codeModel(atom->codeModel()),
|
||||
_permissions(atom->permissions()), _size(atom->size()),
|
||||
|
@ -862,7 +852,6 @@ template <> struct MappingTraits<const lld::DefinedAtom *> {
|
|||
SectionChoice sectionChoice() const override { return _sectionChoice; }
|
||||
StringRef customSectionName() const override { return _sectionName; }
|
||||
uint64_t sectionSize() const override { return _sectionSize; }
|
||||
SectionPosition sectionPosition() const override { return _sectionPosition; }
|
||||
DeadStripKind deadStrip() const override { return _deadStrip; }
|
||||
DynamicExport dynamicExport() const override { return _dynamicExport; }
|
||||
CodeModel codeModel() const override { return _codeModel; }
|
||||
|
@ -908,7 +897,6 @@ template <> struct MappingTraits<const lld::DefinedAtom *> {
|
|||
ContentType _contentType;
|
||||
Alignment _alignment;
|
||||
SectionChoice _sectionChoice;
|
||||
SectionPosition _sectionPosition;
|
||||
DeadStripKind _deadStrip;
|
||||
DynamicExport _dynamicExport;
|
||||
CodeModel _codeModel;
|
||||
|
@ -954,8 +942,6 @@ template <> struct MappingTraits<const lld::DefinedAtom *> {
|
|||
io.mapOptional("section-choice", keys->_sectionChoice,
|
||||
DefinedAtom::sectionBasedOnContent);
|
||||
io.mapOptional("section-name", keys->_sectionName, StringRef());
|
||||
io.mapOptional("section-position", keys->_sectionPosition,
|
||||
DefinedAtom::sectionPositionAny);
|
||||
io.mapOptional("section-size", keys->_sectionSize, (uint64_t)0);
|
||||
io.mapOptional("dead-strip", keys->_deadStrip,
|
||||
DefinedAtom::deadStripNormal);
|
||||
|
|
Loading…
Reference in New Issue