No functional changes.
llvm-svn: 213310
template <class ELFT>
class MipsDynamicLibraryWriter : public DynamicLibraryWriter<ELFT> {
public:
- MipsDynamicLibraryWriter(MipsLinkingContext &context,
+ MipsDynamicLibraryWriter(MipsLinkingContext &ctx,
MipsTargetLayout<ELFT> &layout);
protected:
template <class ELFT>
MipsDynamicLibraryWriter<ELFT>::MipsDynamicLibraryWriter(
- MipsLinkingContext &context, MipsTargetLayout<ELFT> &layout)
- : DynamicLibraryWriter<ELFT>(context, layout),
- _writeHelper(context, layout),
- _mipsContext(context), _mipsTargetLayout(layout) {}
+ MipsLinkingContext &ctx, MipsTargetLayout<ELFT> &layout)
+ : DynamicLibraryWriter<ELFT>(ctx, layout), _writeHelper(ctx, layout),
+ _mipsContext(ctx), _mipsTargetLayout(layout) {}
template <class ELFT>
bool MipsDynamicLibraryWriter<ELFT>::createImplicitFiles(
template <class MipsELFType>
class MipsDynamicTable : public DynamicTable<MipsELFType> {
public:
- MipsDynamicTable(MipsLinkingContext &context,
+ MipsDynamicTable(MipsLinkingContext &ctx,
MipsTargetLayout<MipsELFType> &layout)
- : DynamicTable<MipsELFType>(context, layout, ".dynamic",
+ : DynamicTable<MipsELFType>(ctx, layout, ".dynamic",
DefaultLayout<MipsELFType>::ORDER_DYNAMIC),
_mipsTargetLayout(layout) {}
template <typename ELFT> class MipsELFWriter {
public:
- MipsELFWriter(MipsLinkingContext &context,
- MipsTargetLayout<ELFT> &targetLayout)
- : _context(context), _targetLayout(targetLayout) {}
+ MipsELFWriter(MipsLinkingContext &ctx, MipsTargetLayout<ELFT> &targetLayout)
+ : _ctx(ctx), _targetLayout(targetLayout) {}
void setELFHeader(ELFHeader<ELFT> &elfHeader) {
elfHeader.e_version(1);
// merge them and write result here.
uint32_t flags = llvm::ELF::EF_MIPS_NOREORDER | llvm::ELF::EF_MIPS_ABI_O32 |
llvm::ELF::EF_MIPS_CPIC | llvm::ELF::EF_MIPS_ARCH_32R2;
- if (_context.getOutputELFType() == llvm::ELF::ET_DYN)
+ if (_ctx.getOutputELFType() == llvm::ELF::ET_DYN)
flags |= EF_MIPS_PIC;
elfHeader.e_flags(flags);
}
void finalizeMipsRuntimeAtomValues() {
- if (!_context.isDynamic())
+ if (!_ctx.isDynamic())
return;
auto gotSection = _targetLayout.findOutputSection(".got");
}
std::unique_ptr<MipsRuntimeFile<ELFT>> createRuntimeFile() {
- auto file = llvm::make_unique<MipsRuntimeFile<ELFT>>(_context);
- if (_context.isDynamic()) {
+ auto file = llvm::make_unique<MipsRuntimeFile<ELFT>>(_ctx);
+ if (_ctx.isDynamic()) {
file->addAbsoluteAtom("_GLOBAL_OFFSET_TABLE_");
file->addAbsoluteAtom("_gp");
file->addAbsoluteAtom("_gp_disp");
}
private:
- MipsLinkingContext &_context;
+ MipsLinkingContext &_ctx;
MipsTargetLayout<ELFT> &_targetLayout;
void setAtomValue(StringRef name, uint64_t value) {
template <class ELFT>
class MipsExecutableWriter : public ExecutableWriter<ELFT> {
public:
- MipsExecutableWriter(MipsLinkingContext &context,
- MipsTargetLayout<ELFT> &layout);
+ MipsExecutableWriter(MipsLinkingContext &ctx, MipsTargetLayout<ELFT> &layout);
protected:
void buildDynamicSymbolTable(const File &file) override;
};
template <class ELFT>
-MipsExecutableWriter<ELFT>::MipsExecutableWriter(MipsLinkingContext &context,
+MipsExecutableWriter<ELFT>::MipsExecutableWriter(MipsLinkingContext &ctx,
MipsTargetLayout<ELFT> &layout)
- : ExecutableWriter<ELFT>(context, layout), _writeHelper(context, layout),
- _mipsContext(context), _mipsTargetLayout(layout) {}
+ : ExecutableWriter<ELFT>(ctx, layout), _writeHelper(ctx, layout),
+ _mipsContext(ctx), _mipsTargetLayout(layout) {}
template <class ELFT>
void MipsExecutableWriter<ELFT>::buildDynamicSymbolTable(const File &file) {
template <typename ELFT> class RelocationPass : public Pass {
public:
- RelocationPass(MipsLinkingContext &context);
+ RelocationPass(MipsLinkingContext &ctx);
void perform(std::unique_ptr<MutableFile> &mf) override;
private:
/// \brief Reference to the linking context.
- const MipsLinkingContext &_context;
+ const MipsLinkingContext &_ctx;
/// \brief Owner of all the Atoms created by this pass.
RelocationPassFile _file;
};
template <typename ELFT>
-RelocationPass<ELFT>::RelocationPass(MipsLinkingContext &context)
- : _context(context), _file(context), _gotLDMEntry(nullptr) {
+RelocationPass<ELFT>::RelocationPass(MipsLinkingContext &ctx)
+ : _ctx(ctx), _file(ctx), _gotLDMEntry(nullptr) {
_localGotVector.push_back(new (_file._alloc) GOT0Atom(_file));
_localGotVector.push_back(new (_file._alloc) GOTModulePointerAtom(_file));
}
if ((atom.section()->sh_flags & SHF_ALLOC) == 0)
return false;
- if (_context.getOutputELFType() == llvm::ELF::ET_DYN)
+ if (_ctx.getOutputELFType() == llvm::ELF::ET_DYN)
return true;
if (!isMipsReadonly(atom))
return true;
if (sa)
return true;
- if (_context.getOutputELFType() == llvm::ELF::ET_DYN) {
+ if (_ctx.getOutputELFType() == llvm::ELF::ET_DYN) {
if (da && da->scope() != DefinedAtom::scopeTranslationUnit)
return true;
return true;
// Calls to external symbols defined in an executable file resolved locally.
- if (_context.getOutputELFType() == llvm::ELF::ET_EXEC)
+ if (_ctx.getOutputELFType() == llvm::ELF::ET_EXEC)
return true;
return false;
/// \brief Handle Mips GOT section
template <class ELFType> class MipsGOTSection : public AtomSection<ELFType> {
public:
- MipsGOTSection(const MipsLinkingContext &context)
- : AtomSection<ELFType>(context, ".got", DefinedAtom::typeGOT,
+ MipsGOTSection(const MipsLinkingContext &ctx)
+ : AtomSection<ELFType>(ctx, ".got", DefinedAtom::typeGOT,
DefinedAtom::permRW_,
MipsTargetLayout<ELFType>::ORDER_GOT),
_hasNonLocal(false), _localCount(0) {
/// \brief Handle Mips PLT section
template <class ELFType> class MipsPLTSection : public AtomSection<ELFType> {
public:
- MipsPLTSection(const MipsLinkingContext &context)
- : AtomSection<ELFType>(context, ".plt", DefinedAtom::typeGOT,
+ MipsPLTSection(const MipsLinkingContext &ctx)
+ : AtomSection<ELFType>(ctx, ".plt", DefinedAtom::typeGOT,
DefinedAtom::permR_X,
MipsTargetLayout<ELFType>::ORDER_PLT) {}
typedef llvm::object::ELFType<llvm::support::little, 2, false> Mips32ElELFType;
-MipsTargetHandler::MipsTargetHandler(MipsLinkingContext &context)
- : DefaultTargetHandler(context), _context(context),
- _runtimeFile(new MipsRuntimeFile<Mips32ElELFType>(context)),
- _targetLayout(new MipsTargetLayout<Mips32ElELFType>(context)),
+MipsTargetHandler::MipsTargetHandler(MipsLinkingContext &ctx)
+ : DefaultTargetHandler(ctx), _ctx(ctx),
+ _runtimeFile(new MipsRuntimeFile<Mips32ElELFType>(ctx)),
+ _targetLayout(new MipsTargetLayout<Mips32ElELFType>(ctx)),
_relocationHandler(new MipsTargetRelocationHandler(*_targetLayout)) {}
std::unique_ptr<Writer> MipsTargetHandler::getWriter() {
- switch (_context.getOutputELFType()) {
+ switch (_ctx.getOutputELFType()) {
case llvm::ELF::ET_EXEC:
return std::unique_ptr<Writer>(
- new elf::MipsExecutableWriter<Mips32ElELFType>(_context,
- *_targetLayout));
+ new MipsExecutableWriter<Mips32ElELFType>(_ctx, *_targetLayout));
case llvm::ELF::ET_DYN:
return std::unique_ptr<Writer>(
- new elf::MipsDynamicLibraryWriter<Mips32ElELFType>(_context,
- *_targetLayout));
+ new MipsDynamicLibraryWriter<Mips32ElELFType>(_ctx, *_targetLayout));
case llvm::ELF::ET_REL:
llvm_unreachable("TODO: support -r mode");
default:
template <class ELFType>
class MipsRuntimeFile final : public CRuntimeFile<ELFType> {
public:
- MipsRuntimeFile(const MipsLinkingContext &context)
- : CRuntimeFile<ELFType>(context, "Mips runtime file") {}
+ MipsRuntimeFile(const MipsLinkingContext &ctx)
+ : CRuntimeFile<ELFType>(ctx, "Mips runtime file") {}
};
/// \brief TargetHandler for Mips
class MipsTargetHandler final : public DefaultTargetHandler<Mips32ElELFType> {
public:
- MipsTargetHandler(MipsLinkingContext &context);
+ MipsTargetHandler(MipsLinkingContext &ctx);
MipsTargetLayout<Mips32ElELFType> &getTargetLayout() override {
return *_targetLayout;
private:
static const Registry::KindStrings kindStrings[];
- MipsLinkingContext &_context;
+ MipsLinkingContext &_ctx;
std::unique_ptr<MipsRuntimeFile<Mips32ElELFType>> _runtimeFile;
std::unique_ptr<MipsTargetLayout<Mips32ElELFType>> _targetLayout;
std::unique_ptr<MipsTargetRelocationHandler> _relocationHandler;
template <class ELFT>
class MipsDynamicSymbolTable : public DynamicSymbolTable<ELFT> {
public:
- MipsDynamicSymbolTable(const MipsLinkingContext &context,
+ MipsDynamicSymbolTable(const MipsLinkingContext &ctx,
MipsTargetLayout<ELFT> &layout)
- : DynamicSymbolTable<ELFT>(
- context, layout, ".dynsym",
- DefaultLayout<ELFT>::ORDER_DYNAMIC_SYMBOLS),
+ : DynamicSymbolTable<ELFT>(ctx, layout, ".dynsym",
+ DefaultLayout<ELFT>::ORDER_DYNAMIC_SYMBOLS),
_targetLayout(layout) {}
void sortSymbols() override {