ELF: Remove redundant namespace qualifiers.

llvm-svn: 234938
This commit is contained in:
Rui Ueyama 2015-04-14 20:39:06 +00:00
parent 223de262b9
commit 921b8e93bb
24 changed files with 53 additions and 55 deletions

View File

@ -400,7 +400,7 @@ static void relocR_AARCH64_TLSLE_ADD_TPREL_LO12_NC(uint8_t *location,
}
std::error_code AArch64TargetRelocationHandler::applyRelocation(
ELFWriter &writer, llvm::FileOutputBuffer &buf, const lld::AtomLayout &atom,
ELFWriter &writer, llvm::FileOutputBuffer &buf, const AtomLayout &atom,
const Reference &ref) const {
uint8_t *atomContent = buf.getBufferStart() + atom._fileOffset;
uint8_t *loc = atomContent + ref.offsetInAtom();

View File

@ -18,7 +18,7 @@ namespace elf {
class AArch64TargetRelocationHandler final : public TargetRelocationHandler {
public:
std::error_code applyRelocation(ELFWriter &, llvm::FileOutputBuffer &,
const lld::AtomLayout &,
const AtomLayout &,
const Reference &) const override;
};

View File

@ -497,7 +497,7 @@ static void relocR_ARM_LDR_PC_G2(uint8_t *location, uint64_t P, uint64_t S,
}
std::error_code ARMTargetRelocationHandler::applyRelocation(
ELFWriter &writer, llvm::FileOutputBuffer &buf, const lld::AtomLayout &atom,
ELFWriter &writer, llvm::FileOutputBuffer &buf, const AtomLayout &atom,
const Reference &ref) const {
uint8_t *atomContent = buf.getBufferStart() + atom._fileOffset;
uint8_t *loc = atomContent + ref.offsetInAtom();

View File

@ -22,7 +22,7 @@ public:
ARMTargetRelocationHandler(ARMTargetLayout &layout) : _armLayout(layout) {}
std::error_code applyRelocation(ELFWriter &, llvm::FileOutputBuffer &,
const lld::AtomLayout &,
const AtomLayout &,
const Reference &) const override;
private:

View File

@ -102,7 +102,7 @@ private:
/// \brief ELFUndefinedAtom: These atoms store undefined symbols and are place
/// holders that will be replaced by defined atoms later in the linking process.
template <class ELFT> class ELFUndefinedAtom : public lld::UndefinedAtom {
template <class ELFT> class ELFUndefinedAtom : public UndefinedAtom {
typedef llvm::object::Elf_Sym_Impl<ELFT> Elf_Sym;
public:

View File

@ -26,7 +26,7 @@ DynamicFile<ELFT>::DynamicFile(std::unique_ptr<MemoryBuffer> mb,
template <typename ELFT>
std::error_code DynamicFile<ELFT>::isCompatible(const MemoryBuffer &mb,
ELFLinkingContext &ctx) {
return lld::elf::isCompatible<ELFT>(mb, ctx);
return elf::isCompatible<ELFT>(mb, ctx);
}
template <class ELFT>

View File

@ -68,7 +68,7 @@ void DynamicLibraryWriter<ELFT>::createImplicitFiles(
template <class ELFT>
void DynamicLibraryWriter<ELFT>::finalizeDefaultAtomValues() {
OutputELFWriter<ELFT>::finalizeDefaultAtomValues();
lld::AtomLayout *underScoreEndAtom = this->_layout.findAbsoluteAtom("_end");
AtomLayout *underScoreEndAtom = this->_layout.findAbsoluteAtom("_end");
assert(underScoreEndAtom);
if (auto bssSection = this->_layout.findOutputSection(".bss")) {

View File

@ -30,7 +30,7 @@ ELFFile<ELFT>::ELFFile(std::unique_ptr<MemoryBuffer> mb, ELFLinkingContext &ctx)
template <typename ELFT>
std::error_code ELFFile<ELFT>::isCompatible(const MemoryBuffer &mb,
ELFLinkingContext &ctx) {
return lld::elf::isCompatible<ELFT>(mb, ctx);
return elf::isCompatible<ELFT>(mb, ctx);
}
template <typename ELFT>
@ -319,7 +319,7 @@ template <class ELFT> std::error_code ELFFile<ELFT>::createAtoms() {
followOn = anonFollowedBy;
} else {
followOn = new (_readerStorage)
ELFReference<ELFT>(lld::Reference::kindLayoutAfter);
ELFReference<ELFT>(Reference::kindLayoutAfter);
previousAtom->addReference(followOn);
}
}
@ -362,7 +362,7 @@ template <class ELFT> std::error_code ELFFile<ELFT>::createAtoms() {
// If this is the last atom, let's not create a followon reference.
if (anonAtom && (si + 1) != se) {
anonFollowedBy = new (_readerStorage)
ELFReference<ELFT>(lld::Reference::kindLayoutAfter);
ELFReference<ELFT>(Reference::kindLayoutAfter);
anonAtom->addReference(anonFollowedBy);
}
}
@ -429,7 +429,7 @@ std::error_code ELFFile<ELFT>::handleGnuLinkOnceSection(
for (auto ha : atomsForSection[*sectionName]) {
_groupChild[ha->symbol()] = std::make_pair(*sectionName, section);
ELFReference<ELFT> *ref =
new (_readerStorage) ELFReference<ELFT>(lld::Reference::kindGroupChild);
new (_readerStorage) ELFReference<ELFT>(Reference::kindGroupChild);
ref->setTarget(ha);
refs.push_back(ref);
}
@ -490,8 +490,8 @@ std::error_code ELFFile<ELFT>::handleSectionGroup(
for (auto name : sectionNames) {
for (auto ha : atomsForSection[name]) {
_groupChild[ha->symbol()] = std::make_pair(*symbolName, section);
ELFReference<ELFT> *ref = new (_readerStorage)
ELFReference<ELFT>(lld::Reference::kindGroupChild);
ELFReference<ELFT> *ref =
new (_readerStorage) ELFReference<ELFT>(Reference::kindGroupChild);
ref->setTarget(ha);
refs.push_back(ref);
}
@ -631,7 +631,7 @@ void ELFFile<ELFT>::updateReferenceForMergeStringAccess(ELFReference<ELFT> *ref,
template <class ELFT> void ELFFile<ELFT>::updateReferences() {
for (auto &ri : _references) {
if (ri->kindNamespace() != lld::Reference::KindNamespace::ELF)
if (ri->kindNamespace() != Reference::KindNamespace::ELF)
continue;
const Elf_Sym *symbol = _objFile->getSymbol(ri->targetSymbolIndex());
const Elf_Shdr *shdr = _objFile->getSection(symbol);

View File

@ -13,7 +13,7 @@
namespace lld {
namespace elf {
std::unique_ptr<lld::ELFLinkingContext>
std::unique_ptr<ELFLinkingContext>
createHexagonLinkingContext(llvm::Triple triple) {
if (triple.getArch() == llvm::Triple::hexagon)
return llvm::make_unique<HexagonLinkingContext>(triple);

View File

@ -224,7 +224,7 @@ static void relocHexGOTREL_32(uint8_t *loc, uint64_t P, uint64_t S, uint64_t A,
}
std::error_code HexagonTargetRelocationHandler::applyRelocation(
ELFWriter &writer, llvm::FileOutputBuffer &buf, const lld::AtomLayout &atom,
ELFWriter &writer, llvm::FileOutputBuffer &buf, const AtomLayout &atom,
const Reference &ref) const {
uint8_t *atomContent = buf.getBufferStart() + atom._fileOffset;
uint8_t *loc = atomContent + ref.offsetInAtom();

View File

@ -22,7 +22,7 @@ public:
: _targetLayout(layout) {}
std::error_code applyRelocation(ELFWriter &, llvm::FileOutputBuffer &,
const lld::AtomLayout &,
const AtomLayout &,
const Reference &) const override;
private:

View File

@ -314,8 +314,8 @@ void HexagonLinkingContext::addPasses(PassManager &pm) {
void SDataSection::doPreFlight() {
// sort the atoms on the alignments they have been set
std::stable_sort(_atoms.begin(), _atoms.end(), [](const lld::AtomLayout *A,
const lld::AtomLayout *B) {
std::stable_sort(_atoms.begin(), _atoms.end(), [](const AtomLayout *A,
const AtomLayout *B) {
const DefinedAtom *definedAtomA = cast<DefinedAtom>(A->_atom);
const DefinedAtom *definedAtomB = cast<DefinedAtom>(B->_atom);
int64_t alignmentA = definedAtomA->alignment().value;
@ -353,7 +353,7 @@ const AtomLayout *SDataSection::appendAtom(const Atom *atom) {
const DefinedAtom *definedAtom = cast<DefinedAtom>(atom);
DefinedAtom::Alignment atomAlign = definedAtom->alignment();
uint64_t alignment = atomAlign.value;
_atoms.push_back(new (_alloc) lld::AtomLayout(atom, 0, 0));
_atoms.push_back(new (_alloc) AtomLayout(atom, 0, 0));
// Set the section alignment to the largest alignment
// std::max doesn't support uint64_t
if (_alignment < alignment)

View File

@ -30,7 +30,7 @@ public:
/// \brief Does this section have an output segment.
bool hasOutputSegment() const override { return true; }
const lld::AtomLayout *appendAtom(const Atom *atom) override;
const AtomLayout *appendAtom(const Atom *atom) override;
};
/// \brief TargetLayout for Hexagon

View File

@ -38,7 +38,7 @@ public:
std::error_code applyRelocation(ELFWriter &writer,
llvm::FileOutputBuffer &buf,
const lld::AtomLayout &atom,
const AtomLayout &atom,
const Reference &ref) const override;
private:
@ -556,9 +556,9 @@ static void relocWrite(uint64_t data, const MipsRelocationParams &params,
template <class ELFT>
std::error_code RelocationHandler<ELFT>::applyRelocation(
ELFWriter &writer, llvm::FileOutputBuffer &buf, const lld::AtomLayout &atom,
ELFWriter &writer, llvm::FileOutputBuffer &buf, const AtomLayout &atom,
const Reference &ref) const {
if (ref.kindNamespace() != lld::Reference::KindNamespace::ELF)
if (ref.kindNamespace() != Reference::KindNamespace::ELF)
return std::error_code();
assert(ref.kindArch() == Reference::KindArch::Mips);

View File

@ -507,7 +507,7 @@ void RelocationPass<ELFT>::handleReference(const MipsELFDefinedAtom<ELFT> &atom,
Reference &ref) {
if (!ref.target())
return;
if (ref.kindNamespace() != lld::Reference::KindNamespace::ELF)
if (ref.kindNamespace() != Reference::KindNamespace::ELF)
return;
assert(ref.kindArch() == Reference::KindArch::Mips);
switch (ref.kindValue()) {
@ -602,7 +602,7 @@ void RelocationPass<ELFT>::collectReferenceInfo(
const MipsELFDefinedAtom<ELFT> &atom, Reference &ref) {
if (!ref.target())
return;
if (ref.kindNamespace() != lld::Reference::KindNamespace::ELF)
if (ref.kindNamespace() != Reference::KindNamespace::ELF)
return;
auto refKind = ref.kindValue();

View File

@ -152,11 +152,11 @@ public:
return ia == _posMap.end() && ib != _posMap.end();
}
const lld::AtomLayout *appendAtom(const Atom *atom) override {
const AtomLayout *appendAtom(const Atom *atom) override {
const DefinedAtom *da = dyn_cast<DefinedAtom>(atom);
for (const auto &r : *da) {
if (r->kindNamespace() != lld::Reference::KindNamespace::ELF)
if (r->kindNamespace() != Reference::KindNamespace::ELF)
continue;
assert(r->kindArch() == Reference::KindArch::Mips);
switch (r->kindValue()) {
@ -211,13 +211,13 @@ public:
return it != _pltLayoutMap.end() ? it->second : nullptr;
}
const lld::AtomLayout *appendAtom(const Atom *atom) override {
const AtomLayout *appendAtom(const Atom *atom) override {
const auto *layout = AtomSection<ELFT>::appendAtom(atom);
const DefinedAtom *da = cast<DefinedAtom>(atom);
for (const auto &r : *da) {
if (r->kindNamespace() != lld::Reference::KindNamespace::ELF)
if (r->kindNamespace() != Reference::KindNamespace::ELF)
continue;
assert(r->kindArch() == Reference::KindArch::Mips);
if (r->kindValue() == LLD_R_MIPS_STO_PLT) {

View File

@ -161,7 +161,7 @@ uint64_t AtomSection<ELFT>::alignOffset(uint64_t offset,
// contains the atom, the atom file offset, the atom virtual address
// the atom file offset is aligned appropriately as set by the Reader
template <class ELFT>
const lld::AtomLayout *AtomSection<ELFT>::appendAtom(const Atom *atom) {
const AtomLayout *AtomSection<ELFT>::appendAtom(const Atom *atom) {
const DefinedAtom *definedAtom = cast<DefinedAtom>(atom);
DefinedAtom::Alignment atomAlign = definedAtom->alignment();
@ -183,7 +183,7 @@ const lld::AtomLayout *AtomSection<ELFT>::appendAtom(const Atom *atom) {
case DefinedAtom::typeThreadData:
case DefinedAtom::typeRONote:
case DefinedAtom::typeRWNote:
_atoms.push_back(new (_alloc) lld::AtomLayout(atom, fOffset, 0));
_atoms.push_back(new (_alloc) AtomLayout(atom, fOffset, 0));
this->_fsize = fOffset + definedAtom->size();
this->_msize = mOffset + definedAtom->size();
DEBUG_WITH_TYPE("Section", llvm::dbgs()
@ -192,7 +192,7 @@ const lld::AtomLayout *AtomSection<ELFT>::appendAtom(const Atom *atom) {
<< fOffset << "\n");
break;
case DefinedAtom::typeNoAlloc:
_atoms.push_back(new (_alloc) lld::AtomLayout(atom, fOffset, 0));
_atoms.push_back(new (_alloc) AtomLayout(atom, fOffset, 0));
this->_fsize = fOffset + definedAtom->size();
DEBUG_WITH_TYPE("Section", llvm::dbgs()
<< "[" << this->name() << " " << this << "] "
@ -201,7 +201,7 @@ const lld::AtomLayout *AtomSection<ELFT>::appendAtom(const Atom *atom) {
break;
case DefinedAtom::typeThreadZeroFill:
case DefinedAtom::typeZeroFill:
_atoms.push_back(new (_alloc) lld::AtomLayout(atom, mOffset, 0));
_atoms.push_back(new (_alloc) AtomLayout(atom, mOffset, 0));
this->_msize = mOffset + definedAtom->size();
break;
default:
@ -249,7 +249,7 @@ void AtomSection<ELFT>::write(ELFWriter *writer, TargetLayout<ELFT> &layout,
llvm::FileOutputBuffer &buffer) {
uint8_t *chunkBuffer = buffer.getBufferStart();
bool success = true;
parallel_for_each(_atoms.begin(), _atoms.end(), [&](lld::AtomLayout *ai) {
parallel_for_each(_atoms.begin(), _atoms.end(), [&](AtomLayout *ai) {
DEBUG_WITH_TYPE("Section", llvm::dbgs()
<< "Writing atom: " << ai->_atom->name()
<< " | " << ai->_fileOffset << "\n");
@ -461,8 +461,7 @@ void SymbolTable<ELFT>::addUndefinedAtom(Elf_Sym &sym,
/// information
template <class ELFT>
void SymbolTable<ELFT>::addSymbol(const Atom *atom, int32_t sectionIndex,
uint64_t addr,
const lld::AtomLayout *atomLayout) {
uint64_t addr, const AtomLayout *atomLayout) {
Elf_Sym symbol;
if (atom->name().empty())
@ -548,7 +547,7 @@ template <class ELFT> void DynamicSymbolTable<ELFT>::finalize() {
// don't have their addresses known until addresses have been assigned
// so let's update the symbol values after they have got assigned
for (auto &ste : this->_symbolTable) {
const lld::AtomLayout *atomLayout = ste._atomLayout;
const AtomLayout *atomLayout = ste._atomLayout;
if (!atomLayout)
continue;
ste._symbol.st_value = atomLayout->_virtualAddr;

View File

@ -156,7 +156,7 @@ public:
// \brief Append an atom to a Section. The atom gets pushed into a vector
// contains the atom, the atom file offset, the atom virtual address
// the atom file offset is aligned appropriately as set by the Reader
virtual const lld::AtomLayout *appendAtom(const Atom *atom);
virtual const AtomLayout *appendAtom(const Atom *atom);
/// \brief Set the virtual address of each Atom in the Section. This
/// routine gets called after the linker fixes up the virtual address
@ -176,7 +176,7 @@ public:
int64_t atomflags() const { return _contentPermissions; }
/// Atom Iterators
typedef typename std::vector<lld::AtomLayout *>::iterator atom_iter;
typedef typename std::vector<AtomLayout *>::iterator atom_iter;
range<atom_iter> atoms() { return _atoms; }
@ -192,7 +192,7 @@ protected:
int32_t _contentType;
int32_t _contentPermissions;
bool _isLoadedInMemory = true;
std::vector<lld::AtomLayout *> _atoms;
std::vector<AtomLayout *> _atoms;
mutable std::mutex _outputMutex;
void printError(const std::string &errorStr, const AtomLayout &atom,
@ -334,7 +334,7 @@ public:
std::size_t size() const { return _symbolTable.size(); }
void addSymbol(const Atom *atom, int32_t sectionIndex, uint64_t addr = 0,
const lld::AtomLayout *layout = nullptr);
const AtomLayout *layout = nullptr);
/// \brief Get the symbol table index for an Atom. If it's not in the symbol
/// table, return STN_UNDEF.
@ -375,12 +375,11 @@ public:
protected:
struct SymbolEntry {
SymbolEntry(const Atom *a, const Elf_Sym &sym,
const lld::AtomLayout *layout)
SymbolEntry(const Atom *a, const Elf_Sym &sym, const AtomLayout *layout)
: _atom(a), _atomLayout(layout), _symbol(sym) {}
const Atom *_atom;
const lld::AtomLayout *_atomLayout;
const AtomLayout *_atomLayout;
Elf_Sym _symbol;
};

View File

@ -252,7 +252,7 @@ TargetLayout<ELFT>::getSection(StringRef sectionName, int32_t contentType,
}
template <class ELFT>
ErrorOr<const lld::AtomLayout *> TargetLayout<ELFT>::addAtom(const Atom *atom) {
ErrorOr<const AtomLayout *> TargetLayout<ELFT>::addAtom(const Atom *atom) {
if (const DefinedAtom *definedAtom = dyn_cast<DefinedAtom>(atom)) {
// HACK: Ignore undefined atoms. We need to adjust the interface so that
// undefined atoms can still be included in the output symbol table for
@ -299,7 +299,7 @@ ErrorOr<const lld::AtomLayout *> TargetLayout<ELFT>::addAtom(const Atom *atom) {
// Absolute atoms are not part of any section, they are global for the whole
// link
_absoluteAtoms.push_back(
new (_allocator) lld::AtomLayout(absoluteAtom, 0, absoluteAtom->value()));
new (_allocator) AtomLayout(absoluteAtom, 0, absoluteAtom->value()));
return _absoluteAtoms.back();
}

View File

@ -148,7 +148,7 @@ public:
typedef std::unordered_map<SegmentKey, Segment<ELFT> *, SegmentHashKey>
SegmentMapT;
typedef typename std::vector<lld::AtomLayout *>::iterator AbsoluteAtomIterT;
typedef typename std::vector<AtomLayout *>::iterator AbsoluteAtomIterT;
typedef llvm::DenseSet<const Atom *> AtomSetT;
@ -187,7 +187,7 @@ public:
/// \brief Append the Atom to the layout and create appropriate sections.
/// \returns A reference to the atom layout or an error. The atom layout will
/// be updated as linking progresses.
virtual ErrorOr<const lld::AtomLayout *> addAtom(const Atom *atom);
virtual ErrorOr<const AtomLayout *> addAtom(const Atom *atom);
/// \brief Find an output Section given a section name.
OutputSection<ELFT> *findOutputSection(StringRef name) {
@ -198,7 +198,7 @@ public:
}
/// \brief find a absolute atom given a name
lld::AtomLayout *findAbsoluteAtom(StringRef name) {
AtomLayout *findAbsoluteAtom(StringRef name) {
auto iter = std::find_if(
_absoluteAtoms.begin(), _absoluteAtoms.end(),
[=](const AtomLayout *a) { return a->_atom->name() == name; });
@ -314,7 +314,7 @@ protected:
ProgramHeader<ELFT> *_programHeader;
unique_bump_ptr<RelocationTable<ELFT>> _dynamicRelocationTable;
unique_bump_ptr<RelocationTable<ELFT>> _pltRelocationTable;
std::vector<lld::AtomLayout *> _absoluteAtoms;
std::vector<AtomLayout *> _absoluteAtoms;
AtomSetT _referencedDynAtoms;
llvm::StringSet<> _copiedDynSymNames;
ELFLinkingContext &_ctx;

View File

@ -30,7 +30,7 @@ static int relocPC32(uint8_t *location, uint64_t P, uint64_t S, uint64_t A) {
}
std::error_code X86TargetRelocationHandler::applyRelocation(
ELFWriter &writer, llvm::FileOutputBuffer &buf, const lld::AtomLayout &atom,
ELFWriter &writer, llvm::FileOutputBuffer &buf, const AtomLayout &atom,
const Reference &ref) const {
uint8_t *atomContent = buf.getBufferStart() + atom._fileOffset;
uint8_t *loc = atomContent + ref.offsetInAtom();

View File

@ -18,7 +18,7 @@ namespace elf {
class X86TargetRelocationHandler final : public TargetRelocationHandler {
public:
std::error_code applyRelocation(ELFWriter &, llvm::FileOutputBuffer &,
const lld::AtomLayout &,
const AtomLayout &,
const Reference &) const override;
};

View File

@ -62,7 +62,7 @@ static void relocPC64(uint8_t *location, uint64_t P, uint64_t S, uint64_t A) {
}
std::error_code X86_64TargetRelocationHandler::applyRelocation(
ELFWriter &writer, llvm::FileOutputBuffer &buf, const lld::AtomLayout &atom,
ELFWriter &writer, llvm::FileOutputBuffer &buf, const AtomLayout &atom,
const Reference &ref) const {
uint8_t *atomContent = buf.getBufferStart() + atom._fileOffset;
uint8_t *loc = atomContent + ref.offsetInAtom();

View File

@ -22,7 +22,7 @@ public:
: _tlsSize(0), _layout(layout) {}
std::error_code applyRelocation(ELFWriter &, llvm::FileOutputBuffer &,
const lld::AtomLayout &,
const AtomLayout &,
const Reference &) const override;
private: