[lld] r207494 - [Mips] Implement emitting of R_MIPS_REL32 relocations:
Simon Atanasyan
simon at atanasyan.com
Mon Apr 28 22:21:54 PDT 2014
Author: atanasyan
Date: Tue Apr 29 00:21:54 2014
New Revision: 207494
URL: http://llvm.org/viewvc/llvm-project?rev=207494&view=rev
Log:
[Mips] Implement emitting of R_MIPS_REL32 relocations:
1. Re-implement PLT entries and dynamic relocations emitting to keep PLT
and relocations table in a consistent state.
2. Initialize st_value and st_other fields for dynamic symbols table
entry if this entry corresponds to an external function which address is
taken in a non-PIC executable. In that case the st_value field holds an
address of the function's PLT entry. Also set STO_MIPS_PLT bit in the
st_other field.
Added:
lld/trunk/test/elf/Mips/rel-dynamic-01.test
lld/trunk/test/elf/Mips/rel-dynamic-02.test
lld/trunk/test/elf/Mips/rel-dynamic-03.test
lld/trunk/test/elf/Mips/rel-dynamic-04.test
lld/trunk/test/elf/Mips/rel-dynamic-05.test
lld/trunk/test/elf/Mips/rel-dynamic-06.test
lld/trunk/test/elf/Mips/rel-dynamic-07.test
lld/trunk/test/elf/Mips/rel-dynamic-08.test
lld/trunk/test/elf/Mips/rel-dynamic-09.test
lld/trunk/test/elf/Mips/rel-dynamic-10.test
lld/trunk/test/elf/Mips/rel-dynamic-11.test
Removed:
lld/trunk/test/elf/Mips/plt-1.test
lld/trunk/test/elf/Mips/plt-2.test
Modified:
lld/trunk/lib/ReaderWriter/ELF/Mips/MipsLinkingContext.cpp
lld/trunk/lib/ReaderWriter/ELF/Mips/MipsLinkingContext.h
lld/trunk/lib/ReaderWriter/ELF/Mips/MipsRelocationHandler.cpp
lld/trunk/lib/ReaderWriter/ELF/Mips/MipsRelocationPass.cpp
lld/trunk/lib/ReaderWriter/ELF/Mips/MipsSectionChunks.h
lld/trunk/lib/ReaderWriter/ELF/Mips/MipsTargetHandler.cpp
lld/trunk/lib/ReaderWriter/ELF/Mips/MipsTargetHandler.h
lld/trunk/test/elf/Mips/rel-copy.test
Modified: lld/trunk/lib/ReaderWriter/ELF/Mips/MipsLinkingContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/Mips/MipsLinkingContext.cpp?rev=207494&r1=207493&r2=207494&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/Mips/MipsLinkingContext.cpp (original)
+++ lld/trunk/lib/ReaderWriter/ELF/Mips/MipsLinkingContext.cpp Tue Apr 29 00:21:54 2014
@@ -50,7 +50,14 @@ bool MipsLinkingContext::isDynamicReloca
const Reference &r) const {
if (r.kindNamespace() != Reference::KindNamespace::ELF)
return false;
- return r.kindValue() == llvm::ELF::R_MIPS_COPY;
+ assert(r.kindArch() == Reference::KindArch::Mips);
+ switch (r.kindValue()) {
+ case llvm::ELF::R_MIPS_COPY:
+ case llvm::ELF::R_MIPS_REL32:
+ return true;
+ default:
+ return false;
+ }
}
bool MipsLinkingContext::isPLTRelocation(const DefinedAtom &,
Modified: lld/trunk/lib/ReaderWriter/ELF/Mips/MipsLinkingContext.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/Mips/MipsLinkingContext.h?rev=207494&r1=207493&r2=207494&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/Mips/MipsLinkingContext.h (original)
+++ lld/trunk/lib/ReaderWriter/ELF/Mips/MipsLinkingContext.h Tue Apr 29 00:21:54 2014
@@ -25,7 +25,9 @@ enum {
/// \brief Setup hi 16 bits using the symbol this reference refers to.
LLD_R_MIPS_HI16 = 1027,
/// \brief Setup low 16 bits using the symbol this reference refers to.
- LLD_R_MIPS_LO16 = 1028
+ LLD_R_MIPS_LO16 = 1028,
+ /// \brief Represents a reference between PLT and dynamic symbol.
+ LLD_R_MIPS_STO_PLT = 1029
};
typedef llvm::object::ELFType<llvm::support::little, 2, false> Mips32ElELFType;
Modified: lld/trunk/lib/ReaderWriter/ELF/Mips/MipsRelocationHandler.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/Mips/MipsRelocationHandler.cpp?rev=207494&r1=207493&r2=207494&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/Mips/MipsRelocationHandler.cpp (original)
+++ lld/trunk/lib/ReaderWriter/ELF/Mips/MipsRelocationHandler.cpp Tue Apr 29 00:21:54 2014
@@ -157,7 +157,9 @@ error_code MipsTargetRelocationHandler::
case R_MIPS_JALR:
// We do not do JALR optimization now.
break;
+ case R_MIPS_REL32:
case R_MIPS_JUMP_SLOT:
+ case R_MIPS_COPY:
// Ignore runtime relocations.
break;
case R_MIPS_PC32:
@@ -178,6 +180,9 @@ error_code MipsTargetRelocationHandler::
case LLD_R_MIPS_LO16:
relocLldLo16(location, targetVAddress);
break;
+ case LLD_R_MIPS_STO_PLT:
+ // Do nothing.
+ break;
default: {
std::string str;
llvm::raw_string_ostream s(str);
Modified: lld/trunk/lib/ReaderWriter/ELF/Mips/MipsRelocationPass.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/Mips/MipsRelocationPass.cpp?rev=207494&r1=207493&r2=207494&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/Mips/MipsRelocationPass.cpp (original)
+++ lld/trunk/lib/ReaderWriter/ELF/Mips/MipsRelocationPass.cpp Tue Apr 29 00:21:54 2014
@@ -9,10 +9,13 @@
#include "MipsLinkingContext.h"
#include "MipsRelocationPass.h"
+#include "MipsTargetHandler.h"
#include "Atoms.h"
#include "MipsELFFile.h"
+#include "llvm/ADT/DenseSet.h"
+
using namespace lld;
using namespace lld::elf;
using namespace llvm::ELF;
@@ -170,6 +173,16 @@ private:
/// \brief Map Atoms to their LA25 entries.
llvm::DenseMap<const Atom *, LA25Atom *> _la25Map;
+ /// \brief Atoms referenced by static relocations.
+ llvm::DenseSet<const Atom *> _hasStaticRelocations;
+
+ /// \brief Atoms require pointers equality.
+ llvm::DenseSet<const Atom *> _requiresPtrEquality;
+
+ /// \brief References which are candidates for cconverting
+ /// to the R_MIPS_REL32 relocation.
+ std::vector<Reference *> _rel32Candidates;
+
/// \brief the list of PLT atoms.
std::vector<PLTAtom *> _pltVector;
@@ -185,20 +198,34 @@ private:
/// \brief Handle a specific reference.
void handleReference(Reference &ref);
+ /// \brief Collect information about the reference to use it
+ /// later in the handleReference() routine.
+ void collectReferenceInfo(const MipsELFDefinedAtom<ELFT> &atom,
+ Reference &ref);
+
void handlePlain(Reference &ref);
void handle26(Reference &ref);
void handleGOT(Reference &ref);
const GOTAtom *getLocalGOTEntry(const Reference &ref);
const GOTAtom *getGlobalGOTEntry(const Atom *a);
- const PLTAtom *getPLTEntry(const Atom *a);
+ PLTAtom *getPLTEntry(const Atom *a);
const LA25Atom *getLA25Entry(const Atom *a);
const ObjectAtom *getObjectEntry(const SharedLibraryAtom *a);
bool isLocal(const Atom *a) const;
- bool requireLocalGOT(const Atom *a) const;
+ bool isLocalCall(const Atom *a) const;
+ bool isDynamic(const Atom *atom) const;
bool requireLA25Stub(const Atom *a) const;
+ bool requirePLTEntry(Reference &ref);
+ bool requireCopy(Reference &ref);
+ void configurePLTReference(Reference &ref);
void createPLTHeader();
+ bool mightBeDynamic(const MipsELFDefinedAtom<ELFT> &atom,
+ const Reference &ref) const;
+
+ static void addSingleReference(SimpleELFDefinedAtom *src, const Atom *tgt,
+ uint16_t relocType);
};
template <typename ELFT>
@@ -210,11 +237,27 @@ RelocationPass<ELFT>::RelocationPass(Mip
template <typename ELFT>
void RelocationPass<ELFT>::perform(std::unique_ptr<MutableFile> &mf) {
+ for (const auto &atom : mf->defined())
+ for (const auto &ref : *atom)
+ collectReferenceInfo(*cast<MipsELFDefinedAtom<ELFT>>(atom),
+ const_cast<Reference &>(*ref));
+
// Process all references.
for (const auto &atom : mf->defined())
for (const auto &ref : *atom)
handleReference(const_cast<Reference &>(*ref));
+ // Create R_MIPS_REL32 relocations.
+ for (auto *ref : _rel32Candidates) {
+ if (!isDynamic(ref->target()))
+ continue;
+ if (_pltMap.count(ref->target()))
+ continue;
+ ref->setKindValue(R_MIPS_REL32);
+ if (!isLocalCall(ref->target()))
+ getGlobalGOTEntry(ref->target());
+ }
+
uint64_t ordinal = 0;
for (auto &got : _localGotVector) {
@@ -258,6 +301,8 @@ void RelocationPass<ELFT>::perform(std::
template <typename ELFT>
void RelocationPass<ELFT>::handleReference(Reference &ref) {
+ if (!ref.target())
+ return;
if (ref.kindNamespace() != lld::Reference::KindNamespace::ELF)
return;
assert(ref.kindArch() == Reference::KindArch::Mips);
@@ -280,6 +325,26 @@ void RelocationPass<ELFT>::handleReferen
}
template <typename ELFT>
+void
+RelocationPass<ELFT>::collectReferenceInfo(const MipsELFDefinedAtom<ELFT> &atom,
+ Reference &ref) {
+ if (!ref.target())
+ return;
+ if (ref.kindNamespace() != lld::Reference::KindNamespace::ELF)
+ return;
+ if ((atom.section()->sh_flags & SHF_ALLOC) == 0)
+ return;
+
+ if (mightBeDynamic(atom, ref))
+ _rel32Candidates.push_back(&ref);
+ else
+ _hasStaticRelocations.insert(ref.target());
+
+ if (ref.kindValue() != R_MIPS_CALL16 && ref.kindValue() != R_MIPS_26)
+ _requiresPtrEquality.insert(ref.target());
+}
+
+template <typename ELFT>
bool RelocationPass<ELFT>::isLocal(const Atom *a) const {
if (auto *da = dyn_cast<DefinedAtom>(a))
return da->scope() == Atom::scopeTranslationUnit;
@@ -287,23 +352,114 @@ bool RelocationPass<ELFT>::isLocal(const
}
template <typename ELFT>
-void RelocationPass<ELFT>::handlePlain(Reference &ref) {
- if (!ref.target())
- return;
- auto sla = dyn_cast<SharedLibraryAtom>(ref.target());
- if (!sla)
- return;
- switch (sla->type()) {
- case SharedLibraryAtom::Type::Data:
- ref.setTarget(getObjectEntry(sla));
- break;
- case SharedLibraryAtom::Type::Code:
- ref.setTarget(getPLTEntry(sla));
- break;
- default:
- // Nothing to do.
- break;
+static bool isMipsReadonly(const MipsELFDefinedAtom<ELFT> &atom) {
+ auto secFlags = atom.section()->sh_flags;
+ auto secType = atom.section()->sh_type;
+
+ if ((secFlags & SHF_ALLOC) == 0)
+ return false;
+ if (secType == SHT_NOBITS)
+ return false;
+ if ((secFlags & SHF_WRITE) != 0)
+ return false;
+ return true;
+}
+
+template <typename ELFT>
+bool RelocationPass<ELFT>::mightBeDynamic(const MipsELFDefinedAtom<ELFT> &atom,
+ const Reference &ref) const {
+ auto refKind = ref.kindValue();
+
+ if (refKind == R_MIPS_CALL16 || refKind == R_MIPS_GOT16)
+ return true;
+
+ if (refKind != R_MIPS_32)
+ return false;
+ if ((atom.section()->sh_flags & SHF_ALLOC) == 0)
+ return false;
+
+ if (_context.getOutputELFType() == llvm::ELF::ET_DYN)
+ return true;
+ if (!isMipsReadonly(atom))
+ return true;
+ if (atom.file().isPIC())
+ return true;
+
+ return false;
+}
+
+template <typename ELFT>
+bool RelocationPass<ELFT>::requirePLTEntry(Reference &ref) {
+ if (!_hasStaticRelocations.count(ref.target()))
+ return false;
+ const auto *sa = dyn_cast<ELFDynamicAtom<ELFT>>(ref.target());
+ if (sa && sa->type() != SharedLibraryAtom::Type::Code)
+ return false;
+ const auto *da = dyn_cast<ELFDefinedAtom<ELFT>>(ref.target());
+ if (da && da->contentType() != DefinedAtom::typeCode)
+ return false;
+ if (isLocalCall(ref.target()))
+ return false;
+ return true;
+}
+
+template <typename ELFT>
+bool RelocationPass<ELFT>::requireCopy(Reference &ref) {
+ if (!_hasStaticRelocations.count(ref.target()))
+ return false;
+ const auto *sa = dyn_cast<ELFDynamicAtom<ELFT>>(ref.target());
+ if (sa && sa->type() != SharedLibraryAtom::Type::Data)
+ return false;
+ const auto *da = dyn_cast<ELFDefinedAtom<ELFT>>(ref.target());
+ if (da && da->contentType() != DefinedAtom::typeData)
+ return false;
+ if (isLocalCall(ref.target()))
+ return false;
+ return true;
+}
+
+template <typename ELFT>
+void RelocationPass<ELFT>::configurePLTReference(Reference &ref) {
+ const Atom *atom = ref.target();
+
+ auto *plt = getPLTEntry(atom);
+ ref.setTarget(plt);
+
+ if (_hasStaticRelocations.count(atom) && _requiresPtrEquality.count(atom))
+ addSingleReference(plt, atom, LLD_R_MIPS_STO_PLT);
+}
+
+template <typename ELFT>
+bool RelocationPass<ELFT>::isDynamic(const Atom *atom) const {
+ const auto *da = dyn_cast<const DefinedAtom>(atom);
+ if (da && da->dynamicExport() == DefinedAtom::dynamicExportAlways)
+ return true;
+
+ const auto *sa = dyn_cast<SharedLibraryAtom>(atom);
+ if (sa)
+ return true;
+
+ if (_context.getOutputELFType() == llvm::ELF::ET_DYN) {
+ if (da && da->scope() != DefinedAtom::scopeTranslationUnit)
+ return true;
+
+ const auto *ua = dyn_cast<UndefinedAtom>(atom);
+ if (ua)
+ return true;
}
+
+ return false;
+}
+
+template <typename ELFT>
+void RelocationPass<ELFT>::handlePlain(Reference &ref) {
+ if (!isDynamic(ref.target()))
+ return;
+
+ if (requirePLTEntry(ref))
+ configurePLTReference(ref);
+ else if (requireCopy(ref))
+ ref.setTarget(getObjectEntry(cast<SharedLibraryAtom>(ref.target())));
}
template <typename ELFT> void RelocationPass<ELFT>::handle26(Reference &ref) {
@@ -316,18 +472,18 @@ template <typename ELFT> void Relocation
const auto *sla = dyn_cast<SharedLibraryAtom>(ref.target());
if (sla && sla->type() == SharedLibraryAtom::Type::Code)
- ref.setTarget(getPLTEntry(sla));
+ configurePLTReference(ref);
}
template <typename ELFT> void RelocationPass<ELFT>::handleGOT(Reference &ref) {
- if (requireLocalGOT(ref.target()))
+ if (isLocalCall(ref.target()))
ref.setTarget(getLocalGOTEntry(ref));
else
ref.setTarget(getGlobalGOTEntry(ref.target()));
}
template <typename ELFT>
-bool RelocationPass<ELFT>::requireLocalGOT(const Atom *a) const {
+bool RelocationPass<ELFT>::isLocalCall(const Atom *a) const {
Atom::Scope scope;
if (auto *da = dyn_cast<DefinedAtom>(a))
scope = da->scope();
@@ -340,7 +496,7 @@ bool RelocationPass<ELFT>::requireLocalG
if (scope == Atom::scopeTranslationUnit || scope == Atom::scopeLinkageUnit)
return true;
- // External symbol defined in an executable file requires a local GOT entry.
+ // Calls to external symbols defined in an executable file resolved locally.
if (_context.getOutputELFType() == llvm::ELF::ET_EXEC)
return true;
@@ -433,7 +589,18 @@ template <typename ELFT> void Relocation
}
template <typename ELFT>
-const PLTAtom *RelocationPass<ELFT>::getPLTEntry(const Atom *a) {
+void RelocationPass<ELFT>::addSingleReference(SimpleELFDefinedAtom *src,
+ const Atom *tgt,
+ uint16_t relocType) {
+ for (const auto &r : *src)
+ if (r->kindNamespace() == lld::Reference::KindNamespace::ELF &&
+ r->kindValue() == relocType && r->target() == tgt)
+ break;
+ src->addReferenceELF_Mips(relocType, 0, tgt, 0);
+}
+
+template <typename ELFT>
+PLTAtom *RelocationPass<ELFT>::getPLTEntry(const Atom *a) {
auto plt = _pltMap.find(a);
if (plt != _pltMap.end())
return plt->second;
Modified: lld/trunk/lib/ReaderWriter/ELF/Mips/MipsSectionChunks.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/Mips/MipsSectionChunks.h?rev=207494&r1=207493&r2=207494&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/Mips/MipsSectionChunks.h (original)
+++ lld/trunk/lib/ReaderWriter/ELF/Mips/MipsSectionChunks.h Tue Apr 29 00:21:54 2014
@@ -79,6 +79,42 @@ private:
llvm::DenseMap<const Atom *, std::size_t> _posMap;
};
+/// \brief Handle Mips PLT section
+template <class ELFType> class MipsPLTSection : public AtomSection<ELFType> {
+public:
+ MipsPLTSection(const MipsLinkingContext &context)
+ : AtomSection<ELFType>(context, ".plt", DefinedAtom::typeGOT,
+ DefinedAtom::permR_X,
+ MipsTargetLayout<ELFType>::ORDER_PLT) {}
+
+ const AtomLayout *findPLTLayout(const Atom *plt) const {
+ auto it = _pltLayoutMap.find(plt);
+ return it != _pltLayoutMap.end() ? it->second : nullptr;
+ }
+
+ const lld::AtomLayout &appendAtom(const Atom *atom) override {
+ const auto &layout = AtomSection<ELFType>::appendAtom(atom);
+
+ const DefinedAtom *da = cast<DefinedAtom>(atom);
+
+ for (const auto &r : *da) {
+ if (r->kindNamespace() != lld::Reference::KindNamespace::ELF)
+ continue;
+ assert(r->kindArch() == Reference::KindArch::Mips);
+ if (r->kindValue() == LLD_R_MIPS_STO_PLT) {
+ _pltLayoutMap[r->target()] = &layout;
+ break;
+ }
+ }
+
+ return layout;
+ }
+
+private:
+ /// \brief Map PLT Atoms to their layouts.
+ std::unordered_map<const Atom *, const AtomLayout *> _pltLayoutMap;
+};
+
} // elf
} // lld
Modified: lld/trunk/lib/ReaderWriter/ELF/Mips/MipsTargetHandler.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/Mips/MipsTargetHandler.cpp?rev=207494&r1=207493&r2=207494&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/Mips/MipsTargetHandler.cpp (original)
+++ lld/trunk/lib/ReaderWriter/ELF/Mips/MipsTargetHandler.cpp Tue Apr 29 00:21:54 2014
@@ -49,6 +49,7 @@ void MipsTargetHandler::registerRelocati
const Registry::KindStrings MipsTargetHandler::kindStrings[] = {
LLD_KIND_STRING_ENTRY(R_MIPS_NONE),
LLD_KIND_STRING_ENTRY(R_MIPS_32),
+ LLD_KIND_STRING_ENTRY(R_MIPS_REL32),
LLD_KIND_STRING_ENTRY(R_MIPS_26),
LLD_KIND_STRING_ENTRY(R_MIPS_HI16),
LLD_KIND_STRING_ENTRY(R_MIPS_LO16),
@@ -63,5 +64,6 @@ const Registry::KindStrings MipsTargetHa
LLD_KIND_STRING_ENTRY(LLD_R_MIPS_GLOBAL_26),
LLD_KIND_STRING_ENTRY(LLD_R_MIPS_HI16),
LLD_KIND_STRING_ENTRY(LLD_R_MIPS_LO16),
+ LLD_KIND_STRING_ENTRY(LLD_R_MIPS_STO_PLT),
LLD_KIND_STRING_END
};
Modified: lld/trunk/lib/ReaderWriter/ELF/Mips/MipsTargetHandler.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/Mips/MipsTargetHandler.h?rev=207494&r1=207493&r2=207494&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/Mips/MipsTargetHandler.h (original)
+++ lld/trunk/lib/ReaderWriter/ELF/Mips/MipsTargetHandler.h Tue Apr 29 00:21:54 2014
@@ -26,9 +26,11 @@ public:
MipsTargetLayout(const MipsLinkingContext &ctx)
: TargetLayout<ELFType>(ctx),
_gotSection(new (_alloc) MipsGOTSection<ELFType>(ctx)),
+ _pltSection(new (_alloc) MipsPLTSection<ELFType>(ctx)),
_cachedGP(false) {}
const MipsGOTSection<ELFType> &getGOTSection() const { return *_gotSection; }
+ const MipsPLTSection<ELFType> &getPLTSection() const { return *_pltSection; }
AtomSection<ELFType> *
createSection(StringRef name, int32_t type,
@@ -36,6 +38,8 @@ public:
Layout::SectionOrder order) override {
if (type == DefinedAtom::typeGOT && name == ".got")
return _gotSection;
+ if (type == DefinedAtom::typeStub && name == ".plt")
+ return _pltSection;
return DefaultLayout<ELFType>::createSection(name, type, permissions,
order);
}
@@ -56,6 +60,7 @@ public:
private:
llvm::BumpPtrAllocator _alloc;
MipsGOTSection<ELFType> *_gotSection;
+ MipsPLTSection<ELFType> *_pltSection;
AtomLayout *_gp;
bool _cachedGP;
};
@@ -119,6 +124,26 @@ public:
});
}
+ void finalize() override {
+ const auto &pltSection = _targetLayout.getPLTSection();
+
+ // Under some conditions a dynamic symbol table record should hold a symbol
+ // value of the corresponding PLT entry. For details look at the PLT entry
+ // creation code in the class MipsRelocationPass. Let's update atomLayout
+ // fields for such symbols.
+ for (auto &ste : this->_symbolTable) {
+ if (!ste._atom || ste._atomLayout)
+ continue;
+ auto *layout = pltSection.findPLTLayout(ste._atom);
+ if (layout) {
+ ste._symbol.st_value = layout->_virtualAddr;
+ ste._symbol.st_other |= ELF::STO_MIPS_PLT;
+ }
+ }
+
+ DynamicSymbolTable<Mips32ElELFType>::finalize();
+ }
+
private:
MipsTargetLayout<ELFT> &_targetLayout;
};
Removed: lld/trunk/test/elf/Mips/plt-1.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf/Mips/plt-1.test?rev=207493&view=auto
==============================================================================
--- lld/trunk/test/elf/Mips/plt-1.test (original)
+++ lld/trunk/test/elf/Mips/plt-1.test (removed)
@@ -1,136 +0,0 @@
-# REQUIRES: mips
-
-# Test1. Check PLT entries creation when:
-# a) Linking non-shared executable file
-# b) Relocations' targets are symbols defined in the shared object.
-#
-# RUN: yaml2obj -format=elf %S/Inputs/pic-obj.yaml > %t-so-obj
-# RUN: lld -flavor gnu -target mipsel -shared -o %t-so %t-so-obj
-# RUN: yaml2obj -format=elf %s > %t-obj
-# RUN: lld -flavor gnu -target mipsel -e T0 -o %t1-exe %t-obj %t-so
-# RUN: llvm-objdump -disassemble %t1-exe | FileCheck -check-prefix=PLT1 %s
-
-# PLT1: Disassembly of section .plt:
-# PLT1-NEXT: .plt:
-# PLT1-NEXT: 400210: 40 00 1c 3c lui $gp, 64
-# PLT1-NEXT: 400214: 00 20 99 8f lw $25, 8192($gp)
-# PLT1-NEXT: 400218: 00 20 9c 27 addiu $gp, $gp, 8192
-# PLT1-NEXT: 40021c: 23 c0 1c 03 subu $24, $24, $gp
-# PLT1-NEXT: 400220: 21 78 e0 03 move $15, $ra
-# PLT1-NEXT: 400224: 82 c0 18 00 srl $24, $24, 2
-# PLT1-NEXT: 400228: 09 f8 20 03 jalr $25
-# PLT1-NEXT: 40022c: fe ff 18 27 addiu $24, $24, -2
-#
-# PLT1-NEXT: 400230: 40 00 0f 3c lui $15, 64
-# PLT1-NEXT: 400234: 08 20 f9 8d lw $25, 8200($15)
-# PLT1-NEXT: 400238: 08 00 20 03 jr $25
-# PLT1-NEXT: 40023c: 08 20 f8 25 addiu $24, $15, 8200
-#
-# PLT1-NEXT: 400240: 40 00 0f 3c lui $15, 64
-# PLT1-NEXT: 400244: 0c 20 f9 8d lw $25, 8204($15)
-# PLT1-NEXT: 400248: 08 00 20 03 jr $25
-# PLT1-NEXT: 40024c: 0c 20 f8 25 addiu $24, $15, 8204
-#
-# PLT1-NEXT: 400250: 40 00 0f 3c lui $15, 64
-# PLT1-NEXT: 400254: 10 20 f9 8d lw $25, 8208($15)
-# PLT1-NEXT: 400258: 08 00 20 03 jr $25
-# PLT1-NEXT: 40025c: 10 20 f8 25 addiu $24, $15, 8208
-
-# Test2. Check PLT entries creation when:
-# a) Linking non-shared executable file
-# b) Relocations' targets are undefined symbols
-#
-# RUN: yaml2obj -format=elf %s > %t-obj
-# RUN: lld -flavor gnu -target mipsel --noinhibit-exec -e T0 -o %t2-exe %t-obj
-# RUN: llvm-objdump -disassemble %t2-exe | FileCheck -check-prefix=PLT2 %s
-
-# PLT2-NOT: Disassembly of section .plt:
-
-# Test3. Check PLT entries creation when:
-# a) Linking non-shared executable file
-# b) Relocations' targets are symbols defined in the other object.
-#
-# RUN: yaml2obj -format=elf %s > %t-obj1
-# RUN: yaml2obj -format=elf %S/Inputs/pic-obj.yaml > %t-obj2
-# RUN: lld -flavor gnu -target mipsel -e T0 -o %t3-exe %t-obj1 %t-obj2
-# RUN: llvm-objdump -disassemble %t3-exe | FileCheck -check-prefix=PLT3 %s
-
-# PLT3-NOT: Disassembly of section .plt:
-
-!ELF
-FileHeader: !FileHeader
- Class: ELFCLASS32
- Data: ELFDATA2LSB
- Type: ET_REL
- Machine: EM_MIPS
- Flags: [EF_MIPS_CPIC]
-
-Sections:
-- Name: .text
- Type: SHT_PROGBITS
- Content: "0000000000000000"
- AddressAlign: 16
- Flags: [SHF_EXECINSTR, SHF_ALLOC]
-
-- Name: .data
- Type: SHT_PROGBITS
- Content: "0000000000000000"
- AddressAlign: 16
- Flags: [SHF_WRITE, SHF_ALLOC]
-
-- Name: .rel.text
- Type: SHT_REL
- Info: .text
- AddressAlign: 4
- Relocations:
- - Offset: 0x04
- Symbol: T3
- Type: R_MIPS_26
-
-- Name: .rel.data
- Type: SHT_REL
- Info: .data
- AddressAlign: 4
- Relocations:
- - Offset: 0x00
- Symbol: T1
- Type: R_MIPS_HI16
- - Offset: 0x00
- Symbol: T1
- Type: R_MIPS_LO16
- - Offset: 0x04
- Symbol: T2
- Type: R_MIPS_32
-
- - Offset: 0x04
- Symbol: D1
- Type: R_MIPS_HI16
- - Offset: 0x04
- Symbol: D1
- Type: R_MIPS_LO16
- - Offset: 0x04
- Symbol: D2
- Type: R_MIPS_32
-
-Symbols:
- Global:
- - Name: T0
- Section: .text
- Type: STT_FUNC
- Value: 0x0
- Size: 8
- - Name: T1
- Type: STT_FUNC
- - Name: T2
- Type: STT_FUNC
- - Name: T3
- Type: STT_FUNC
- - Name: D0
- Section: .data
- Type: STT_OBJECT
- Value: 0x0
- Size: 8
- - Name: D1
- Type: STT_OBJECT
- - Name: D2
- Type: STT_OBJECT
Removed: lld/trunk/test/elf/Mips/plt-2.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf/Mips/plt-2.test?rev=207493&view=auto
==============================================================================
--- lld/trunk/test/elf/Mips/plt-2.test (original)
+++ lld/trunk/test/elf/Mips/plt-2.test (removed)
@@ -1,48 +0,0 @@
-# Test1. Check PLT entries creation when:
-# a) Linking shared object file
-# b) Relocations' targets are undefined symbols
-#
-# RUN: yaml2obj -format=elf %s > %t-obj
-# RUN: lld -flavor gnu -target mipsel -shared --noinhibit-exec -o %t1-so %t-obj
-# RUN: llvm-objdump -disassemble %t1-so | FileCheck -check-prefix=PLT1 %s
-
-# PLT1-NOT: Disassembly of section .plt:
-
-!ELF
-FileHeader: !FileHeader
- Class: ELFCLASS32
- Data: ELFDATA2LSB
- Type: ET_REL
- Machine: EM_MIPS
- Flags: [EF_MIPS_PIC, EF_MIPS_CPIC]
-
-Sections:
-- Name: .text
- Type: SHT_PROGBITS
- Content: "0000000000000000"
- AddressAlign: 16
- Flags: [SHF_EXECINSTR, SHF_ALLOC]
-
-- Name: .data
- Type: SHT_PROGBITS
- Content: "0000000000000000"
- AddressAlign: 16
- Flags: [SHF_WRITE, SHF_ALLOC]
-
-- Name: .rel.text
- Type: SHT_REL
- Info: .text
- AddressAlign: 4
- Relocations:
- - Offset: 0x00
- Symbol: T1
- Type: R_MIPS_32
-
-Symbols:
- Global:
- - Name: T0
- Section: .text
- Type: STT_FUNC
- Value: 0x0
- Size: 4
- - Name: T1
Modified: lld/trunk/test/elf/Mips/rel-copy.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf/Mips/rel-copy.test?rev=207494&r1=207493&r2=207494&view=diff
==============================================================================
--- lld/trunk/test/elf/Mips/rel-copy.test (original)
+++ lld/trunk/test/elf/Mips/rel-copy.test Tue Apr 29 00:21:54 2014
@@ -11,8 +11,8 @@
# CHECK: Relocations [
# CHECK-NEXT: Section (5) .rel.dyn {
+# CHECK-NEXT: 0x402004 R_MIPS_REL32 D2 0x0
# CHECK-NEXT: 0x402008 R_MIPS_COPY D1 0x0
-# CHECK-NEXT: 0x402010 R_MIPS_COPY D2 0x0
# CHECK-NEXT: }
# CHECK-NEXT: ]
@@ -32,15 +32,6 @@
# CHECK-NEXT: Size: 4
# CHECK-NEXT: Binding: Global (0x1)
# CHECK-NEXT: Type: Object (0x1)
-# CHECK-NEXT: Other: 0
-# CHECK-NEXT: Section: .bss (0xA)
-# CHECK-NEXT: }
-# CHECK-NEXT: Symbol {
-# CHECK-NEXT: Name: D2@ (4)
-# CHECK-NEXT: Value: 0x402010
-# CHECK-NEXT: Size: 4
-# CHECK-NEXT: Binding: Global (0x1)
-# CHECK-NEXT: Type: Object (0x1)
# CHECK-NEXT: Other: 0
# CHECK-NEXT: Section: .bss (0xA)
# CHECK-NEXT: }
Added: lld/trunk/test/elf/Mips/rel-dynamic-01.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf/Mips/rel-dynamic-01.test?rev=207494&view=auto
==============================================================================
--- lld/trunk/test/elf/Mips/rel-dynamic-01.test (added)
+++ lld/trunk/test/elf/Mips/rel-dynamic-01.test Tue Apr 29 00:21:54 2014
@@ -0,0 +1,194 @@
+# REQUIRES: mips
+
+# Conditions:
+# a) Linking a non-shared executable file.
+# b) Relocations' targets are symbols defined in the shared object.
+# Check:
+# a) Emitting R_MIPS_REL32, R_MIPS_COPY, R_MIPS_JUMP_SLOT relocations.
+# b) PLT entries creation.
+# c) STO_MIPS_PLT flag in the dynamic symbol table for symbols require
+# a pointer equality.
+#
+# RUN: yaml2obj -format=elf %S/Inputs/pic-obj.yaml > %t-so-obj
+# RUN: lld -flavor gnu -target mipsel -shared -o %t-so %t-so-obj
+# RUN: yaml2obj -format=elf %s > %t-obj
+# RUN: lld -flavor gnu -target mipsel -e T0 -o %t1-exe %t-obj %t-so
+# RUN: llvm-objdump -disassemble %t1-exe | FileCheck -check-prefix=PLT %s
+# RUN: llvm-readobj -dt -r %t1-exe | FileCheck -check-prefix=PLT-SYM %s
+
+# PLT: Disassembly of section .plt:
+# PLT-NEXT: .plt:
+# PLT-NEXT: 400210: 40 00 1c 3c lui $gp, 64
+# PLT-NEXT: 400214: 00 20 99 8f lw $25, 8192($gp)
+# PLT-NEXT: 400218: 00 20 9c 27 addiu $gp, $gp, 8192
+# PLT-NEXT: 40021c: 23 c0 1c 03 subu $24, $24, $gp
+# PLT-NEXT: 400220: 21 78 e0 03 move $15, $ra
+# PLT-NEXT: 400224: 82 c0 18 00 srl $24, $24, 2
+# PLT-NEXT: 400228: 09 f8 20 03 jalr $25
+# PLT-NEXT: 40022c: fe ff 18 27 addiu $24, $24, -2
+#
+# PLT-NEXT: 400230: 40 00 0f 3c lui $15, 64
+# PLT-NEXT: 400234: 08 20 f9 8d lw $25, 8200($15)
+# PLT-NEXT: 400238: 08 00 20 03 jr $25
+# PLT-NEXT: 40023c: 08 20 f8 25 addiu $24, $15, 8200
+#
+# PLT-NEXT: 400240: 40 00 0f 3c lui $15, 64
+# PLT-NEXT: 400244: 0c 20 f9 8d lw $25, 8204($15)
+# PLT-NEXT: 400248: 08 00 20 03 jr $25
+# PLT-NEXT: 40024c: 0c 20 f8 25 addiu $24, $15, 8204
+
+# PLT-SYM: Relocations [
+# PLT-SYM-NEXT: Section (5) .rel.dyn {
+# PLT-SYM-NEXT: 0x402014 R_MIPS_REL32 T2 0x0
+# PLT-SYM-NEXT: 0x402014 R_MIPS_REL32 D2 0x0
+# PLT-SYM-NEXT: 0x402018 R_MIPS_COPY D1 0x0
+# PLT-SYM-NEXT: }
+# PLT-SYM-NEXT: Section (6) .rel.plt {
+# PLT-SYM-NEXT: 0x402008 R_MIPS_JUMP_SLOT T3 0x0
+# PLT-SYM-NEXT: 0x40200C R_MIPS_JUMP_SLOT T1 0x0
+# PLT-SYM-NEXT: }
+# PLT-SYM-NEXT: ]
+
+# PLT-SYM: DynamicSymbols [
+# PLT-SYM-NEXT: Symbol {
+# PLT-SYM-NEXT: Name: @ (0)
+# PLT-SYM-NEXT: Value: 0x0
+# PLT-SYM-NEXT: Size: 0
+# PLT-SYM-NEXT: Binding: Local (0x0)
+# PLT-SYM-NEXT: Type: None (0x0)
+# PLT-SYM-NEXT: Other: 0
+# PLT-SYM-NEXT: Section: Undefined (0x0)
+# PLT-SYM-NEXT: }
+# PLT-SYM-NEXT: Symbol {
+# PLT-SYM-NEXT: Name: D1@ (1)
+# PLT-SYM-NEXT: Value: 0x402018
+# PLT-SYM-NEXT: Size: 4
+# PLT-SYM-NEXT: Binding: Global (0x1)
+# PLT-SYM-NEXT: Type: Object (0x1)
+# PLT-SYM-NEXT: Other: 0
+# PLT-SYM-NEXT: Section: .bss (0xD)
+# PLT-SYM-NEXT: }
+# PLT-SYM-NEXT: Symbol {
+# PLT-SYM-NEXT: Name: T3@ (7)
+# PLT-SYM-NEXT: Value: 0x0
+# PLT-SYM-NEXT: Size: 0
+# PLT-SYM-NEXT: Binding: Global (0x1)
+# PLT-SYM-NEXT: Type: Function (0x2)
+# PLT-SYM-NEXT: Other: 0
+# PLT-SYM-NEXT: Section: Undefined (0x0)
+# PLT-SYM-NEXT: }
+# PLT-SYM-NEXT: Symbol {
+# PLT-SYM-NEXT: Name: T1@ (10)
+# PLT-SYM-NEXT: Value: 0x400240
+# PLT-SYM-NEXT: Size: 0
+# PLT-SYM-NEXT: Binding: Global (0x1)
+# PLT-SYM-NEXT: Type: Function (0x2)
+# PLT-SYM-NEXT: Other: 8
+# PLT-SYM-NEXT: Section: Undefined (0x0)
+# PLT-SYM-NEXT: }
+# PLT-SYM-NEXT: Symbol {
+# PLT-SYM-NEXT: Name: D1@ (1)
+# PLT-SYM-NEXT: Value: 0x0
+# PLT-SYM-NEXT: Size: 4
+# PLT-SYM-NEXT: Binding: Global (0x1)
+# PLT-SYM-NEXT: Type: Object (0x1)
+# PLT-SYM-NEXT: Other: 0
+# PLT-SYM-NEXT: Section: Undefined (0x0)
+# PLT-SYM-NEXT: }
+# PLT-SYM-NEXT: Symbol {
+# PLT-SYM-NEXT: Name: T2@ (4)
+# PLT-SYM-NEXT: Value: 0x0
+# PLT-SYM-NEXT: Size: 0
+# PLT-SYM-NEXT: Binding: Global (0x1)
+# PLT-SYM-NEXT: Type: Function (0x2)
+# PLT-SYM-NEXT: Other: 0
+# PLT-SYM-NEXT: Section: Undefined (0x0)
+# PLT-SYM-NEXT: }
+# PLT-SYM-NEXT: Symbol {
+# PLT-SYM-NEXT: Name: D2@ (13)
+# PLT-SYM-NEXT: Value: 0x0
+# PLT-SYM-NEXT: Size: 4
+# PLT-SYM-NEXT: Binding: Global (0x1)
+# PLT-SYM-NEXT: Type: Object (0x1)
+# PLT-SYM-NEXT: Other: 0
+# PLT-SYM-NEXT: Section: Undefined (0x0)
+# PLT-SYM-NEXT: }
+# PLT-SYM-NEXT: ]
+
+!ELF
+FileHeader: !FileHeader
+ Class: ELFCLASS32
+ Data: ELFDATA2LSB
+ Type: ET_REL
+ Machine: EM_MIPS
+ Flags: [EF_MIPS_CPIC]
+
+Sections:
+- Name: .text
+ Type: SHT_PROGBITS
+ Content: "0000000000000000"
+ AddressAlign: 16
+ Flags: [SHF_EXECINSTR, SHF_ALLOC]
+
+- Name: .data
+ Type: SHT_PROGBITS
+ Content: "0000000000000000"
+ AddressAlign: 16
+ Flags: [SHF_WRITE, SHF_ALLOC]
+
+- Name: .rel.text
+ Type: SHT_REL
+ Info: .text
+ AddressAlign: 4
+ Relocations:
+ - Offset: 0x04
+ Symbol: T3
+ Type: R_MIPS_26
+
+- Name: .rel.data
+ Type: SHT_REL
+ Info: .data
+ AddressAlign: 4
+ Relocations:
+ - Offset: 0x00
+ Symbol: T1
+ Type: R_MIPS_HI16
+ - Offset: 0x00
+ Symbol: T1
+ Type: R_MIPS_LO16
+ - Offset: 0x04
+ Symbol: T2
+ Type: R_MIPS_32
+
+ - Offset: 0x04
+ Symbol: D1
+ Type: R_MIPS_HI16
+ - Offset: 0x04
+ Symbol: D1
+ Type: R_MIPS_LO16
+ - Offset: 0x04
+ Symbol: D2
+ Type: R_MIPS_32
+
+Symbols:
+ Global:
+ - Name: T0
+ Section: .text
+ Type: STT_FUNC
+ Value: 0x0
+ Size: 8
+ - Name: T1
+ Type: STT_FUNC
+ - Name: T2
+ Type: STT_FUNC
+ - Name: T3
+ Type: STT_FUNC
+ - Name: D0
+ Section: .data
+ Type: STT_OBJECT
+ Value: 0x0
+ Size: 8
+ - Name: D1
+ Type: STT_OBJECT
+ - Name: D2
+ Type: STT_OBJECT
Added: lld/trunk/test/elf/Mips/rel-dynamic-02.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf/Mips/rel-dynamic-02.test?rev=207494&view=auto
==============================================================================
--- lld/trunk/test/elf/Mips/rel-dynamic-02.test (added)
+++ lld/trunk/test/elf/Mips/rel-dynamic-02.test Tue Apr 29 00:21:54 2014
@@ -0,0 +1,82 @@
+# Conditions:
+# a) Linking a shared library.
+# b) Relocations' targets are undefined symbols.
+# Check:
+# a) Emitting R_MIPS_REL32 relocations for both undefined symbols.
+# b) There should be no PLT entries.
+#
+# RUN: yaml2obj -format=elf %s > %t-obj
+# RUN: lld -flavor gnu -target mipsel -shared --noinhibit-exec -o %t1-so %t-obj
+# RUN: llvm-readobj -dt -r -s %t1-so | FileCheck -check-prefix=PLT-SYM %s
+
+# PLT-SYM: Sections [
+# PLT-SYM: Section {
+# PLT-SYM-NOT: Name: .plt ({{[0-9]+}})
+#
+# PLT-SYM: Relocations [
+# PLT-SYM-NEXT: Section (4) .rel.dyn {
+# PLT-SYM-NEXT: 0x2000 R_MIPS_REL32 T1 0x0
+# PLT-SYM-NEXT: 0x140 R_MIPS_REL32 T1 0x0
+# PLT-SYM-NEXT: }
+# PLT-SYM-NEXT: ]
+#
+# PLT-SYM: Name: T1@ (7)
+# PLT-SYM-NEXT: Value: 0x0
+# PLT-SYM-NEXT: Size: 0
+# PLT-SYM-NEXT: Binding: Global (0x1)
+# PLT-SYM-NEXT: Type: None (0x0)
+# PLT-SYM-NEXT: Other: 0
+# PLT-SYM-NEXT: Section: Undefined (0x0)
+
+!ELF
+FileHeader: !FileHeader
+ Class: ELFCLASS32
+ Data: ELFDATA2LSB
+ Type: ET_REL
+ Machine: EM_MIPS
+ Flags: [EF_MIPS_PIC, EF_MIPS_CPIC]
+
+Sections:
+- Name: .text
+ Type: SHT_PROGBITS
+ Content: "0000000000000000"
+ AddressAlign: 16
+ Flags: [SHF_EXECINSTR, SHF_ALLOC]
+
+- Name: .data
+ Type: SHT_PROGBITS
+ Content: "0000000000000000"
+ AddressAlign: 16
+ Flags: [SHF_WRITE, SHF_ALLOC]
+
+- Name: .rel.text
+ Type: SHT_REL
+ Info: .text
+ AddressAlign: 4
+ Relocations:
+ - Offset: 0x00
+ Symbol: T1
+ Type: R_MIPS_32
+
+- Name: .rel.data
+ Type: SHT_REL
+ Info: .data
+ AddressAlign: 4
+ Relocations:
+ - Offset: 0x00
+ Symbol: T1
+ Type: R_MIPS_32
+
+Symbols:
+ Global:
+ - Name: T0
+ Section: .text
+ Type: STT_FUNC
+ Value: 0x0
+ Size: 4
+ - Name: T1
+ - Name: D0
+ Section: .data
+ Type: STT_OBJECT
+ Value: 0x0
+ Size: 8
Added: lld/trunk/test/elf/Mips/rel-dynamic-03.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf/Mips/rel-dynamic-03.test?rev=207494&view=auto
==============================================================================
--- lld/trunk/test/elf/Mips/rel-dynamic-03.test (added)
+++ lld/trunk/test/elf/Mips/rel-dynamic-03.test Tue Apr 29 00:21:54 2014
@@ -0,0 +1,103 @@
+# REQUIRES: mips
+
+# Conditions:
+# a) Linking a non-shared executable file.
+# b) Relocations' target is a symbol defined in the shared object.
+# c) The target symbol is referenced by both branch (R_MIPS_26)
+# and regular (R_MIPS_32) relocations.
+# Check:
+# a) There should be no R_MIPS_REL32 relocation.
+# b) Linker creates a single PLT entry.
+# c) STO_MIPS_PLT flag in the dynamic symbol table for symbols require
+# a pointer equality.
+#
+# RUN: yaml2obj -format=elf %S/Inputs/pic-obj.yaml > %t-so-obj
+# RUN: lld -flavor gnu -target mipsel -shared -o %t-so %t-so-obj
+# RUN: yaml2obj -format=elf %s > %t-obj
+# RUN: lld -flavor gnu -target mipsel -e T0 -o %t-exe %t-obj %t-so
+# RUN: llvm-objdump -disassemble %t-exe | FileCheck -check-prefix=PLT %s
+# RUN: llvm-readobj -dt -r %t-exe | FileCheck -check-prefix=PLT-SYM %s
+
+# PLT: Disassembly of section .plt:
+# PLT-NEXT: .plt:
+# PLT-NEXT: 400170: 40 00 1c 3c lui $gp, 64
+# PLT-NEXT: 400174: 00 20 99 8f lw $25, 8192($gp)
+# PLT-NEXT: 400178: 00 20 9c 27 addiu $gp, $gp, 8192
+# PLT-NEXT: 40017c: 23 c0 1c 03 subu $24, $24, $gp
+# PLT-NEXT: 400180: 21 78 e0 03 move $15, $ra
+# PLT-NEXT: 400184: 82 c0 18 00 srl $24, $24, 2
+# PLT-NEXT: 400188: 09 f8 20 03 jalr $25
+# PLT-NEXT: 40018c: fe ff 18 27 addiu $24, $24, -2
+#
+# PLT-NEXT: 400190: 40 00 0f 3c lui $15, 64
+# PLT-NEXT: 400194: 08 20 f9 8d lw $25, 8200($15)
+# PLT-NEXT: 400198: 08 00 20 03 jr $25
+# PLT-NEXT: 40019c: 08 20 f8 25 addiu $24, $15, 8200
+#
+# PLT-SYM: Relocations [
+# PLT-SYM-NEXT: Section (5) .rel.plt {
+# PLT-SYM-NEXT: 0x402008 R_MIPS_JUMP_SLOT T1 0x0
+# PLT-SYM-NEXT: }
+# PLT-SYM-NEXT: ]
+
+# PLT-SYM: Name: T1@ (1)
+# PLT-SYM-NEXT: Value: 0x400190
+# PLT-SYM-NEXT: Size: 0
+# PLT-SYM-NEXT: Binding: Global (0x1)
+# PLT-SYM-NEXT: Type: Function (0x2)
+# PLT-SYM-NEXT: Other: 8
+# PLT-SYM-NEXT: Section: Undefined (0x0)
+
+!ELF
+FileHeader: !FileHeader
+ Class: ELFCLASS32
+ Data: ELFDATA2LSB
+ Type: ET_REL
+ Machine: EM_MIPS
+ Flags: [EF_MIPS_CPIC]
+
+Sections:
+- Name: .text
+ Type: SHT_PROGBITS
+ Content: "0000000000000000"
+ AddressAlign: 16
+ Flags: [SHF_EXECINSTR, SHF_ALLOC]
+
+- Name: .data
+ Type: SHT_PROGBITS
+ Content: "0000000000000000"
+ AddressAlign: 16
+ Flags: [SHF_WRITE, SHF_ALLOC]
+
+- Name: .rel.text
+ Type: SHT_REL
+ Info: .text
+ AddressAlign: 4
+ Relocations:
+ - Offset: 0x04
+ Symbol: T1
+ Type: R_MIPS_26
+
+- Name: .rel.data
+ Type: SHT_REL
+ Info: .data
+ AddressAlign: 4
+ Relocations:
+ - Offset: 0x04
+ Symbol: T1
+ Type: R_MIPS_32
+
+Symbols:
+ Global:
+ - Name: T0
+ Section: .text
+ Type: STT_FUNC
+ Value: 0x0
+ Size: 8
+ - Name: T1
+ Type: STT_FUNC
+ - Name: D0
+ Section: .data
+ Type: STT_OBJECT
+ Value: 0x0
+ Size: 8
Added: lld/trunk/test/elf/Mips/rel-dynamic-04.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf/Mips/rel-dynamic-04.test?rev=207494&view=auto
==============================================================================
--- lld/trunk/test/elf/Mips/rel-dynamic-04.test (added)
+++ lld/trunk/test/elf/Mips/rel-dynamic-04.test Tue Apr 29 00:21:54 2014
@@ -0,0 +1,170 @@
+# Conditions:
+# a) Linking a non-shared executable file.
+# b) Relocations' targets are symbols defined in the shared object.
+# c) Relocations modify a writable section.
+# d) The first symbol is referenced by R_MIPS32 relocation only
+# e) The second symbol is referenced by R_MIPS_32 and R_MIPS26 relocations.
+# f) The third symbol is referenced by R_MIPS26 and R_MIPS_32 relocations.
+# Check:
+# a) There should be the only R_MIPS_REL32 relocation.
+# b) Linker creates a couple of PLT entry for both symbols referenced
+# by the R_MIPS_26 branch relocation.
+# c) STO_MIPS_PLT flag in the dynamic symbol table for symbols require
+# a pointer equality.
+#
+# RUN: yaml2obj -format=elf %S/Inputs/pic-obj.yaml > %t-so-obj
+# RUN: lld -flavor gnu -target mipsel -shared -o %t-so %t-so-obj
+# RUN: yaml2obj -format=elf %s > %t-obj
+# RUN: lld -flavor gnu -target mipsel -e T0 -o %t1-exe %t-obj %t-so
+# RUN: llvm-readobj -dt -r -s %t1-exe | FileCheck -check-prefix=PLT %s
+
+# PLT: Section {
+# PLT: Index: 5
+# PLT-NEXT: Name: .rel.dyn (31)
+# PLT-NEXT: Type: SHT_REL (0x9)
+# PLT-NEXT: Flags [ (0x2)
+# PLT-NEXT: SHF_ALLOC (0x2)
+# PLT-NEXT: ]
+# PLT-NEXT: Address: 0x40109C
+# PLT-NEXT: Offset: 0x109C
+# PLT-NEXT: Size: 8
+# PLT-NEXT: Link: 3
+# PLT-NEXT: Info: 0
+# PLT-NEXT: AddressAlignment: 4
+# PLT-NEXT: EntrySize: 8
+# PLT-NEXT: }
+# PLT-NEXT: Section {
+# PLT-NEXT: Index: 6
+# PLT-NEXT: Name: .rel.plt (40)
+# PLT-NEXT: Type: SHT_REL (0x9)
+# PLT-NEXT: Flags [ (0x2)
+# PLT-NEXT: SHF_ALLOC (0x2)
+# PLT-NEXT: ]
+# PLT-NEXT: Address: 0x4010A4
+# PLT-NEXT: Offset: 0x10A4
+# PLT-NEXT: Size: 16
+# PLT-NEXT: Link: 3
+# PLT-NEXT: Info: 0
+# PLT-NEXT: AddressAlignment: 4
+# PLT-NEXT: EntrySize: 8
+# PLT-NEXT: }
+# PLT-NEXT: Section {
+# PLT-NEXT: Index: 7
+# PLT-NEXT: Name: .plt (49)
+# PLT-NEXT: Type: SHT_PROGBITS (0x1)
+# PLT-NEXT: Flags [ (0x6)
+# PLT-NEXT: SHF_ALLOC (0x2)
+# PLT-NEXT: SHF_EXECINSTR (0x4)
+# PLT-NEXT: ]
+# PLT-NEXT: Address: 0x4010C0
+# PLT-NEXT: Offset: 0x10C0
+# PLT-NEXT: Size: 64
+# PLT-NEXT: Link: 0
+# PLT-NEXT: Info: 0
+# PLT-NEXT: AddressAlignment: 16
+# PLT-NEXT: EntrySize: 0
+# PLT-NEXT: }
+
+# PLT: Relocations [
+# PLT-NEXT: Section (5) .rel.dyn {
+# PLT-NEXT: 0x400120 R_MIPS_REL32 T1 0x0
+# PLT-NEXT: }
+# PLT-NEXT: Section (6) .rel.plt {
+# PLT-NEXT: 0x403008 R_MIPS_JUMP_SLOT T2 0x0
+# PLT-NEXT: 0x40300C R_MIPS_JUMP_SLOT T3 0x0
+# PLT-NEXT: }
+# PLT-NEXT: ]
+
+# PLT: DynamicSymbols [
+# PLT-NEXT: Symbol {
+# PLT-NEXT: Name: @ (0)
+# PLT-NEXT: Value: 0x0
+# PLT-NEXT: Size: 0
+# PLT-NEXT: Binding: Local (0x0)
+# PLT-NEXT: Type: None (0x0)
+# PLT-NEXT: Other: 0
+# PLT-NEXT: Section: Undefined (0x0)
+# PLT-NEXT: }
+# PLT-NEXT: Symbol {
+# PLT-NEXT: Name: T2@ (1)
+# PLT-NEXT: Value: 0x4010E0
+# PLT-NEXT: Size: 0
+# PLT-NEXT: Binding: Global (0x1)
+# PLT-NEXT: Type: Function (0x2)
+# PLT-NEXT: Other: 8
+# PLT-NEXT: Section: Undefined (0x0)
+# PLT-NEXT: }
+# PLT-NEXT: Symbol {
+# PLT-NEXT: Name: T3@ (4)
+# PLT-NEXT: Value: 0x4010F0
+# PLT-NEXT: Size: 0
+# PLT-NEXT: Binding: Global (0x1)
+# PLT-NEXT: Type: Function (0x2)
+# PLT-NEXT: Other: 8
+# PLT-NEXT: Section: Undefined (0x0)
+# PLT-NEXT: }
+# PLT-NEXT: Symbol {
+# PLT-NEXT: Name: T1@ (7)
+# PLT-NEXT: Value: 0x0
+# PLT-NEXT: Size: 0
+# PLT-NEXT: Binding: Global (0x1)
+# PLT-NEXT: Type: Function (0x2)
+# PLT-NEXT: Other: 0
+# PLT-NEXT: Section: Undefined (0x0)
+# PLT-NEXT: }
+# PLT-NEXT: ]
+
+!ELF
+FileHeader: !FileHeader
+ Class: ELFCLASS32
+ Data: ELFDATA2LSB
+ Type: ET_REL
+ Machine: EM_MIPS
+ Flags: [EF_MIPS_CPIC]
+
+Sections:
+- Name: .text
+ Type: SHT_PROGBITS
+ Content: "0000000000000000"
+ AddressAlign: 16
+ Flags: [SHF_WRITE, SHF_EXECINSTR, SHF_ALLOC]
+
+- Name: .rel.text
+ Type: SHT_REL
+ Info: .text
+ AddressAlign: 4
+ Relocations:
+ # There is no branch relocation for T1.
+ - Offset: 0x00
+ Symbol: T1
+ Type: R_MIPS_32
+ # The R_MIPS_32 relocation for T2 might produce R_MIPS_REL32 ...
+ - Offset: 0x00
+ Symbol: T2
+ Type: R_MIPS_32
+ # ... but R_MIPS_26 creates PLT entry and makes R_MIPS_REL32 redundant.
+ - Offset: 0x04
+ Symbol: T2
+ Type: R_MIPS_26
+ # Create PLT entry for T3 symbol.
+ - Offset: 0x00
+ Symbol: T3
+ Type: R_MIPS_26
+ # Take in account existing PLT entry and do not create R_MIPS_REL32.
+ - Offset: 0x04
+ Symbol: T3
+ Type: R_MIPS_32
+
+Symbols:
+ Global:
+ - Name: T0
+ Section: .text
+ Type: STT_FUNC
+ Value: 0x0
+ Size: 8
+ - Name: T1
+ Type: STT_FUNC
+ - Name: T2
+ Type: STT_FUNC
+ - Name: T3
+ Type: STT_FUNC
Added: lld/trunk/test/elf/Mips/rel-dynamic-05.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf/Mips/rel-dynamic-05.test?rev=207494&view=auto
==============================================================================
--- lld/trunk/test/elf/Mips/rel-dynamic-05.test (added)
+++ lld/trunk/test/elf/Mips/rel-dynamic-05.test Tue Apr 29 00:21:54 2014
@@ -0,0 +1,152 @@
+# Conditions:
+# a) Linking a non-shared executable file.
+# b) Relocations' targets are symbols defined in the shared object.
+# c) Relocations modify a read-only section.
+# d) The first symbol is referenced by R_MIPS32 relocation only
+# e) The second symbol is referenced by R_MIPS_32 and R_MIPS26 relocations.
+# f) The third symbol is referenced by R_MIPS26 and R_MIPS_32 relocations.
+# Check:
+# a) There should be no R_MIPS_REL32 relocations.
+# b) Linker creates PLT entries for all three relocations.
+# c) STO_MIPS_PLT flag in the dynamic symbol table for symbols require
+# a pointer equality.
+#
+# RUN: yaml2obj -format=elf %S/Inputs/pic-obj.yaml > %t-so-obj
+# RUN: lld -flavor gnu -target mipsel -shared -o %t-so %t-so-obj
+# RUN: yaml2obj -format=elf %s > %t-obj
+# RUN: lld -flavor gnu -target mipsel -e T0 -o %t1-exe %t-obj %t-so
+# RUN: llvm-readobj -dt -r -s %t1-exe | FileCheck -check-prefix=PLT %s
+
+# PLT: Section {
+# PLT: Index: 5
+# PLT-NEXT: Name: .rel.plt (31)
+# PLT-NEXT: Type: SHT_REL (0x9)
+# PLT-NEXT: Flags [ (0x2)
+# PLT-NEXT: SHF_ALLOC (0x2)
+# PLT-NEXT: ]
+# PLT-NEXT: Address: 0x40019C
+# PLT-NEXT: Offset: 0x19C
+# PLT-NEXT: Size: 24
+# PLT-NEXT: Link: 3
+# PLT-NEXT: Info: 0
+# PLT-NEXT: AddressAlignment: 4
+# PLT-NEXT: EntrySize: 8
+# PLT-NEXT: }
+# PLT-NEXT: Section {
+# PLT-NEXT: Index: 6
+# PLT-NEXT: Name: .plt (40)
+# PLT-NEXT: Type: SHT_PROGBITS (0x1)
+# PLT-NEXT: Flags [ (0x6)
+# PLT-NEXT: SHF_ALLOC (0x2)
+# PLT-NEXT: SHF_EXECINSTR (0x4)
+# PLT-NEXT: ]
+# PLT-NEXT: Address: 0x4001C0
+# PLT-NEXT: Offset: 0x1C0
+# PLT-NEXT: Size: 80
+# PLT-NEXT: Link: 0
+# PLT-NEXT: Info: 0
+# PLT-NEXT: AddressAlignment: 16
+# PLT-NEXT: EntrySize: 0
+# PLT-NEXT: }
+
+# PLT: Relocations [
+# PLT-NEXT: Section (5) .rel.plt {
+# PLT-NEXT: 0x402008 R_MIPS_JUMP_SLOT T1 0x0
+# PLT-NEXT: 0x40200C R_MIPS_JUMP_SLOT T2 0x0
+# PLT-NEXT: 0x402010 R_MIPS_JUMP_SLOT T3 0x0
+# PLT-NEXT: }
+# PLT-NEXT: ]
+
+# PLT: DynamicSymbols [
+# PLT-NEXT: Symbol {
+# PLT-NEXT: Name: @ (0)
+# PLT-NEXT: Value: 0x0
+# PLT-NEXT: Size: 0
+# PLT-NEXT: Binding: Local (0x0)
+# PLT-NEXT: Type: None (0x0)
+# PLT-NEXT: Other: 0
+# PLT-NEXT: Section: Undefined (0x0)
+# PLT-NEXT: }
+# PLT-NEXT: Symbol {
+# PLT-NEXT: Name: T2@ (1)
+# PLT-NEXT: Value: 0x4001F0
+# PLT-NEXT: Size: 0
+# PLT-NEXT: Binding: Global (0x1)
+# PLT-NEXT: Type: Function (0x2)
+# PLT-NEXT: Other: 8
+# PLT-NEXT: Section: Undefined (0x0)
+# PLT-NEXT: }
+# PLT-NEXT: Symbol {
+# PLT-NEXT: Name: T3@ (4)
+# PLT-NEXT: Value: 0x400200
+# PLT-NEXT: Size: 0
+# PLT-NEXT: Binding: Global (0x1)
+# PLT-NEXT: Type: Function (0x2)
+# PLT-NEXT: Other: 8
+# PLT-NEXT: Section: Undefined (0x0)
+# PLT-NEXT: }
+# PLT-NEXT: Symbol {
+# PLT-NEXT: Name: T1@ (7)
+# PLT-NEXT: Value: 0x4001E0
+# PLT-NEXT: Size: 0
+# PLT-NEXT: Binding: Global (0x1)
+# PLT-NEXT: Type: Function (0x2)
+# PLT-NEXT: Other: 8
+# PLT-NEXT: Section: Undefined (0x0)
+# PLT-NEXT: }
+# PLT-NEXT: ]
+
+!ELF
+FileHeader: !FileHeader
+ Class: ELFCLASS32
+ Data: ELFDATA2LSB
+ Type: ET_REL
+ Machine: EM_MIPS
+ Flags: [EF_MIPS_CPIC]
+
+Sections:
+- Name: .text
+ Type: SHT_PROGBITS
+ Content: "0000000000000000"
+ AddressAlign: 16
+ Flags: [SHF_EXECINSTR, SHF_ALLOC]
+
+- Name: .rel.text
+ Type: SHT_REL
+ Info: .text
+ AddressAlign: 4
+ Relocations:
+ # There is no branch relocation for T1.
+ - Offset: 0x00
+ Symbol: T1
+ Type: R_MIPS_32
+ # The R_MIPS_32 relocation for T2 might produce R_MIPS_REL32 ...
+ - Offset: 0x00
+ Symbol: T2
+ Type: R_MIPS_32
+ # ... but R_MIPS_26 creates PLT entry and makes R_MIPS_REL32 redundant.
+ - Offset: 0x04
+ Symbol: T2
+ Type: R_MIPS_26
+ # Create PLT entry for T3 symbol.
+ - Offset: 0x00
+ Symbol: T3
+ Type: R_MIPS_26
+ # Take in account existing PLT entry and do not create R_MIPS_REL32.
+ - Offset: 0x04
+ Symbol: T3
+ Type: R_MIPS_32
+
+Symbols:
+ Global:
+ - Name: T0
+ Section: .text
+ Type: STT_FUNC
+ Value: 0x0
+ Size: 8
+ - Name: T1
+ Type: STT_FUNC
+ - Name: T2
+ Type: STT_FUNC
+ - Name: T3
+ Type: STT_FUNC
Added: lld/trunk/test/elf/Mips/rel-dynamic-06.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf/Mips/rel-dynamic-06.test?rev=207494&view=auto
==============================================================================
--- lld/trunk/test/elf/Mips/rel-dynamic-06.test (added)
+++ lld/trunk/test/elf/Mips/rel-dynamic-06.test Tue Apr 29 00:21:54 2014
@@ -0,0 +1,103 @@
+# Conditions:
+# a) Linking a shared library.
+# b) The first relocation modifies a regular .text section.
+# c) The second relocation modifies a .pdr section without SHF_ALLOC flag.
+# Check:
+# a) There should be no PLT entries.
+# b) Linker creates a single R_MIPS_REL32 relocation.
+#
+# RUN: yaml2obj -format=elf %s > %t-obj
+# RUN: lld -flavor gnu -target mipsel -shared -o %t1-so %t-obj
+# RUN: llvm-readobj -dt -r -s %t1-so | FileCheck -check-prefix=PLT1 %s
+
+# PLT1-SYM: Sections [
+# PLT1-SYM: Section {
+# PLT1-SYM-NOT: Name: .plt ({{[0-9]+}})
+
+# PLT1: Relocations [
+# PLT1-NEXT: Section (4) .rel.dyn {
+# PLT1-NEXT: 0x100 R_MIPS_REL32 T0 0x0
+# PLT1-NEXT: }
+# PLT1-NEXT: ]
+
+# PLT1: DynamicSymbols [
+# PLT1-NEXT: Symbol {
+# PLT1-NEXT: Name: @ (0)
+# PLT1-NEXT: Value: 0x0
+# PLT1-NEXT: Size: 0
+# PLT1-NEXT: Binding: Local (0x0)
+# PLT1-NEXT: Type: None (0x0)
+# PLT1-NEXT: Other: 0
+# PLT1-NEXT: Section: Undefined (0x0)
+# PLT1-NEXT: }
+# PLT1-NEXT: Symbol {
+# PLT1-NEXT: Name: T1@ (4)
+# PLT1-NEXT: Value: 0x104
+# PLT1-NEXT: Size: 4
+# PLT1-NEXT: Binding: Global (0x1)
+# PLT1-NEXT: Type: Function (0x2)
+# PLT1-NEXT: Other: 0
+# PLT1-NEXT: Section: .text (0x5)
+# PLT1-NEXT: }
+# PLT1-NEXT: Symbol {
+# PLT1-NEXT: Name: T0@ (1)
+# PLT1-NEXT: Value: 0x100
+# PLT1-NEXT: Size: 4
+# PLT1-NEXT: Binding: Global (0x1)
+# PLT1-NEXT: Type: Function (0x2)
+# PLT1-NEXT: Other: 0
+# PLT1-NEXT: Section: .text (0x5)
+# PLT1-NEXT: }
+# PLT1-NEXT: ]
+
+!ELF
+FileHeader: !FileHeader
+ Class: ELFCLASS32
+ Data: ELFDATA2LSB
+ Type: ET_REL
+ Machine: EM_MIPS
+ Flags: [EF_MIPS_PIC, EF_MIPS_CPIC]
+
+Sections:
+- Name: .text
+ Type: SHT_PROGBITS
+ Content: "0000000000000000"
+ AddressAlign: 16
+ Flags: [SHF_EXECINSTR, SHF_ALLOC]
+
+- Name: .rel.text
+ Type: SHT_REL
+ Info: .text
+ AddressAlign: 4
+ Relocations:
+ - Offset: 0x00
+ Symbol: T0
+ Type: R_MIPS_32
+
+- Name: .pdr
+ Type: SHT_PROGBITS
+ Content: "0000000000000000"
+ AddressAlign: 16
+ Flags: []
+
+- Name: .rel.pdr
+ Type: SHT_REL
+ Info: .pdr
+ AddressAlign: 4
+ Relocations:
+ - Offset: 0x00
+ Symbol: T1
+ Type: R_MIPS_32
+
+Symbols:
+ Global:
+ - Name: T0
+ Section: .text
+ Type: STT_FUNC
+ Value: 0x0
+ Size: 4
+ - Name: T1
+ Section: .text
+ Type: STT_FUNC
+ Value: 0x4
+ Size: 4
Added: lld/trunk/test/elf/Mips/rel-dynamic-07.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf/Mips/rel-dynamic-07.test?rev=207494&view=auto
==============================================================================
--- lld/trunk/test/elf/Mips/rel-dynamic-07.test (added)
+++ lld/trunk/test/elf/Mips/rel-dynamic-07.test Tue Apr 29 00:21:54 2014
@@ -0,0 +1,230 @@
+# Conditions:
+# a) Linking a shared library.
+# b) There ars multiple R_MIPS_32 relocations with various targets.
+# Check:
+# a) Emitting of R_MIPS_REL32 relocations.
+# b) There should be no R_MIPS_REL32 relocations for the _gp_disp symbol.
+#
+# RUN: yaml2obj -format=elf %S/Inputs/pic-obj.yaml > %t-so-obj
+# RUN: lld -flavor gnu -target mipsel -shared -o %t-so %t-so-obj
+# RUN: yaml2obj -format=elf %s > %t-obj
+# RUN: lld -flavor gnu -target mipsel -shared --noinhibit-exec \
+# RUN: -o %t1-so %t-obj %t-so
+# RUN: llvm-readobj -dt -r -sections %t1-so | FileCheck %s
+
+# CHECK: Sections [
+# CHECK: Section {
+# CHECK-NOT: Name: .plt ({{[0-9]+}})
+
+# CHECK: Relocations [
+# CHECK-NEXT: Section (4) .rel.dyn {
+# CHECK-NEXT: 0x2000 R_MIPS_REL32 T0 0x0
+# CHECK-NEXT: 0x2000 R_MIPS_REL32 T4 0x0
+# CHECK-NEXT: 0x2000 R_MIPS_REL32 D2 0x0
+# CHECK-NEXT: 0x2004 R_MIPS_REL32 T1 0x0
+# CHECK-NEXT: 0x2008 R_MIPS_REL32 T2 0x0
+# CHECK-NEXT: 0x2004 R_MIPS_REL32 D0 0x0
+# CHECK-NEXT: 0x2008 R_MIPS_REL32 D1 0x0
+# CHECK-NEXT: 0x2004 R_MIPS_REL32 D4 0x0
+# CHECK-NEXT: 0x2008 R_MIPS_REL32 U1 0x0
+# CHECK-NEXT: }
+# CHECK-NEXT: ]
+
+# CHECK: DynamicSymbols [
+# CHECK-NEXT: Symbol {
+# CHECK-NEXT: Name: @ (0)
+# CHECK-NEXT: Value: 0x0
+# CHECK-NEXT: Size: 0
+# CHECK-NEXT: Binding: Local (0x0)
+# CHECK-NEXT: Type: None (0x0)
+# CHECK-NEXT: Other: 0
+# CHECK-NEXT: Section: Undefined (0x0)
+# CHECK-NEXT: }
+# CHECK-NEXT: Symbol {
+# CHECK-NEXT: Name: T0@ (1)
+# CHECK-NEXT: Value: 0x224
+# CHECK-NEXT: Size: 8
+# CHECK-NEXT: Binding: Global (0x1)
+# CHECK-NEXT: Type: Function (0x2)
+# CHECK-NEXT: Other: 0
+# CHECK-NEXT: Section: .text (0x5)
+# CHECK-NEXT: }
+# CHECK-NEXT: Symbol {
+# CHECK-NEXT: Name: T4@ (7)
+# CHECK-NEXT: Value: 0x0
+# CHECK-NEXT: Size: 0
+# CHECK-NEXT: Binding: Global (0x1)
+# CHECK-NEXT: Type: None (0x0)
+# CHECK-NEXT: Other: 0
+# CHECK-NEXT: Section: Undefined (0x0)
+# CHECK-NEXT: }
+# CHECK-NEXT: Symbol {
+# CHECK-NEXT: Name: D2@ (25)
+# CHECK-NEXT: Value: 0x0
+# CHECK-NEXT: Size: 4
+# CHECK-NEXT: Binding: Global (0x1)
+# CHECK-NEXT: Type: Object (0x1)
+# CHECK-NEXT: Other: 0
+# CHECK-NEXT: Section: Undefined (0x0)
+# CHECK-NEXT: }
+# CHECK-NEXT: Symbol {
+# CHECK-NEXT: Name: T1@ (16)
+# CHECK-NEXT: Value: 0x0
+# CHECK-NEXT: Size: 0
+# CHECK-NEXT: Binding: Global (0x1)
+# CHECK-NEXT: Type: Function (0x2)
+# CHECK-NEXT: Other: 0
+# CHECK-NEXT: Section: Undefined (0x0)
+# CHECK-NEXT: }
+# CHECK-NEXT: Symbol {
+# CHECK-NEXT: Name: T2@ (19)
+# CHECK-NEXT: Value: 0x0
+# CHECK-NEXT: Size: 0
+# CHECK-NEXT: Binding: Global (0x1)
+# CHECK-NEXT: Type: Function (0x2)
+# CHECK-NEXT: Other: 0
+# CHECK-NEXT: Section: Undefined (0x0)
+# CHECK-NEXT: }
+# CHECK-NEXT: Symbol {
+# CHECK-NEXT: Name: D0@ (4)
+# CHECK-NEXT: Value: 0x2004
+# CHECK-NEXT: Size: 8
+# CHECK-NEXT: Binding: Global (0x1)
+# CHECK-NEXT: Type: Object (0x1)
+# CHECK-NEXT: Other: 0
+# CHECK-NEXT: Section: .data (0x8)
+# CHECK-NEXT: }
+# CHECK-NEXT: Symbol {
+# CHECK-NEXT: Name: D1@ (22)
+# CHECK-NEXT: Value: 0x0
+# CHECK-NEXT: Size: 4
+# CHECK-NEXT: Binding: Global (0x1)
+# CHECK-NEXT: Type: Object (0x1)
+# CHECK-NEXT: Other: 0
+# CHECK-NEXT: Section: Undefined (0x0)
+# CHECK-NEXT: }
+# CHECK-NEXT: Symbol {
+# CHECK-NEXT: Name: D4@ (10)
+# CHECK-NEXT: Value: 0x0
+# CHECK-NEXT: Size: 0
+# CHECK-NEXT: Binding: Global (0x1)
+# CHECK-NEXT: Type: None (0x0)
+# CHECK-NEXT: Other: 0
+# CHECK-NEXT: Section: Undefined (0x0)
+# CHECK-NEXT: }
+# CHECK-NEXT: Symbol {
+# CHECK-NEXT: Name: U1@ (13)
+# CHECK-NEXT: Value: 0x0
+# CHECK-NEXT: Size: 0
+# CHECK-NEXT: Binding: Global (0x1)
+# CHECK-NEXT: Type: None (0x0)
+# CHECK-NEXT: Other: 0
+# CHECK-NEXT: Section: Undefined (0x0)
+# CHECK-NEXT: }
+# CHECK-NEXT: ]
+
+!ELF
+FileHeader: !FileHeader
+ Class: ELFCLASS32
+ Data: ELFDATA2LSB
+ Type: ET_REL
+ Machine: EM_MIPS
+ Flags: [EF_MIPS_PIC, EF_MIPS_CPIC]
+
+Sections:
+- Name: .text
+ Type: SHT_PROGBITS
+ Content: "000000000000000000000000"
+ AddressAlign: 16
+ Flags: [SHF_EXECINSTR, SHF_ALLOC]
+
+- Name: .data
+ Type: SHT_PROGBITS
+ Content: "000000000000000000000000"
+ AddressAlign: 16
+ Flags: [SHF_WRITE, SHF_ALLOC]
+
+- Name: .rel.text
+ Type: SHT_REL
+ Info: .text
+ AddressAlign: 4
+ Relocations:
+ - Offset: 0x00
+ Symbol: _gp_disp
+ Type: R_MIPS_HI16
+ - Offset: 0x00
+ Symbol: _gp_disp
+ Type: R_MIPS_LO16
+
+- Name: .rel.data
+ Type: SHT_REL
+ Info: .data
+ AddressAlign: 4
+ Relocations:
+ - Offset: 0x00 # T0 is a defined function
+ Symbol: T0
+ Type: R_MIPS_32
+ - Offset: 0x04 # T1 is a function from shared lib
+ Symbol: T1
+ Type: R_MIPS_32
+ - Offset: 0x08 # T2 has unknown type and defined in shared lib
+ Symbol: T2
+ Type: R_MIPS_32
+ - Offset: 0x00 # T4 is an undefined function
+ Symbol: T4
+ Type: R_MIPS_32
+ - Offset: 0x04 # D0 is a defined data object
+ Symbol: D0
+ Type: R_MIPS_32
+ - Offset: 0x08 # D1 is a data object from shared lib
+ Symbol: D1
+ Type: R_MIPS_32
+ - Offset: 0x00 # D2 has unknown type and defined in shared lib
+ Symbol: D2
+ Type: R_MIPS_32
+ - Offset: 0x04 # D4 is an undefined data object
+ Symbol: D4
+ Type: R_MIPS_32
+ - Offset: 0x08 # U1 is undefined and has unknown type
+ Symbol: U1
+ Type: R_MIPS_32
+
+Symbols:
+ Local:
+ - Name: LT0
+ Section: .text
+ Type: STT_FUNC
+ Value: 0x0
+ Size: 4
+ - Name: LD0
+ Section: .data
+ Type: STT_OBJECT
+ Value: 0x0
+ Size: 4
+
+ Global:
+ - Name: _gp_disp
+ Type: STT_OBJECT
+
+ - Name: T0
+ Section: .text
+ Type: STT_FUNC
+ Value: 0x4
+ Size: 8
+ - Name: T1
+ Type: STT_FUNC
+ - Name: T2
+ - Name: T4
+ Type: STT_FUNC
+
+ - Name: D0
+ Section: .data
+ Type: STT_OBJECT
+ Value: 0x4
+ Size: 8
+ - Name: D1
+ Type: STT_OBJECT
+ - Name: D2
+ - Name: D4
+ Type: STT_OBJECT
+ - Name: U1
Added: lld/trunk/test/elf/Mips/rel-dynamic-08.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf/Mips/rel-dynamic-08.test?rev=207494&view=auto
==============================================================================
--- lld/trunk/test/elf/Mips/rel-dynamic-08.test (added)
+++ lld/trunk/test/elf/Mips/rel-dynamic-08.test Tue Apr 29 00:21:54 2014
@@ -0,0 +1,186 @@
+# Conditions:
+# a) Linking a non-shared executable file.
+# b) There ars multiple R_MIPS_32/R_MIPS_HI16/R_MIPS_LO16 relocations
+# with various targets.
+# Check:
+# a) Emitting of R_MIPS_REL32 relocations.
+#
+# RUN: yaml2obj -format=elf %S/Inputs/pic-obj.yaml > %t-so-obj
+# RUN: lld -flavor gnu -target mipsel -shared -o %t-so %t-so-obj
+# RUN: yaml2obj -format=elf %s > %t-obj
+# RUN: lld -flavor gnu -target mipsel -e T0 --noinhibit-exec \
+# RUN: -o %t1-exe %t-obj %t-so
+# RUN: llvm-readobj -dt -r -sections %t1-exe | FileCheck %s
+
+# CHECK: Sections [
+# CHECK: Section {
+# CHECK-NOT: Name: .plt ({{[0-9]+}})
+
+# CHECK: Relocations [
+# CHECK-NEXT: Section (5) .rel.dyn {
+# CHECK-NEXT: 0x402000 R_MIPS_REL32 D2 0x0
+# CHECK-NEXT: 0x402004 R_MIPS_REL32 T1 0x0
+# CHECK-NEXT: 0x402008 R_MIPS_REL32 T2 0x0
+# CHECK-NEXT: 0x402008 R_MIPS_REL32 D1 0x0
+# CHECK-NEXT: }
+# CHECK-NEXT: ]
+
+# CHECK: DynamicSymbols [
+# CHECK-NEXT: Symbol {
+# CHECK-NEXT: Name: @ (0)
+# CHECK-NEXT: Value: 0x0
+# CHECK-NEXT: Size: 0
+# CHECK-NEXT: Binding: Local (0x0)
+# CHECK-NEXT: Type: None (0x0)
+# CHECK-NEXT: Other: 0
+# CHECK-NEXT: Section: Undefined (0x0)
+# CHECK-NEXT: }
+# CHECK-NEXT: Symbol {
+# CHECK-NEXT: Name: D2@ (10)
+# CHECK-NEXT: Value: 0x0
+# CHECK-NEXT: Size: 4
+# CHECK-NEXT: Binding: Global (0x1)
+# CHECK-NEXT: Type: Object (0x1)
+# CHECK-NEXT: Other: 0
+# CHECK-NEXT: Section: Undefined (0x0)
+# CHECK-NEXT: }
+# CHECK-NEXT: Symbol {
+# CHECK-NEXT: Name: T1@ (4)
+# CHECK-NEXT: Value: 0x0
+# CHECK-NEXT: Size: 0
+# CHECK-NEXT: Binding: Global (0x1)
+# CHECK-NEXT: Type: Function (0x2)
+# CHECK-NEXT: Other: 0
+# CHECK-NEXT: Section: Undefined (0x0)
+# CHECK-NEXT: }
+# CHECK-NEXT: Symbol {
+# CHECK-NEXT: Name: T2@ (1)
+# CHECK-NEXT: Value: 0x0
+# CHECK-NEXT: Size: 0
+# CHECK-NEXT: Binding: Global (0x1)
+# CHECK-NEXT: Type: Function (0x2)
+# CHECK-NEXT: Other: 0
+# CHECK-NEXT: Section: Undefined (0x0)
+# CHECK-NEXT: }
+# CHECK-NEXT: Symbol {
+# CHECK-NEXT: Name: D1@ (7)
+# CHECK-NEXT: Value: 0x0
+# CHECK-NEXT: Size: 4
+# CHECK-NEXT: Binding: Global (0x1)
+# CHECK-NEXT: Type: Object (0x1)
+# CHECK-NEXT: Other: 0
+# CHECK-NEXT: Section: Undefined (0x0)
+# CHECK-NEXT: }
+# CHECK-NEXT: ]
+
+!ELF
+FileHeader: !FileHeader
+ Class: ELFCLASS32
+ Data: ELFDATA2LSB
+ Type: ET_REL
+ Machine: EM_MIPS
+ Flags: [EF_MIPS_CPIC]
+
+Sections:
+- Name: .text
+ Type: SHT_PROGBITS
+ Content: "000000000000000000000000"
+ AddressAlign: 16
+ Flags: [SHF_EXECINSTR, SHF_ALLOC]
+
+- Name: .data
+ Type: SHT_PROGBITS
+ Content: "000000000000000000000000"
+ AddressAlign: 16
+ Flags: [SHF_WRITE, SHF_ALLOC]
+
+- Name: .rel.text
+ Type: SHT_REL
+ Info: .text
+ AddressAlign: 4
+ Relocations:
+ - Offset: 0x00
+ Symbol: _gp_disp
+ Type: R_MIPS_HI16
+ - Offset: 0x00
+ Symbol: _gp_disp
+ Type: R_MIPS_LO16
+
+- Name: .rel.data
+ Type: SHT_REL
+ Info: .data
+ AddressAlign: 4
+ Relocations:
+ - Offset: 0x00 # LT0 is a locally defined function
+ Symbol: LT0
+ Type: R_MIPS_32
+ - Offset: 0x00 # LD0 is a locally defined data object
+ Symbol: LD0
+ Type: R_MIPS_32
+ - Offset: 0x00 # T0 is a defined function
+ Symbol: T0
+ Type: R_MIPS_32
+ - Offset: 0x04 # T1 is a function from shared lib
+ Symbol: T1
+ Type: R_MIPS_32
+ - Offset: 0x08 # T2 has unknown type and defined in shared lib
+ Symbol: T2
+ Type: R_MIPS_32
+ - Offset: 0x00 # T4 is an undefined function
+ Symbol: T4
+ Type: R_MIPS_32
+ - Offset: 0x04 # D0 is a defined data object
+ Symbol: D0
+ Type: R_MIPS_32
+ - Offset: 0x08 # D1 is a data object from shared lib
+ Symbol: D1
+ Type: R_MIPS_32
+ - Offset: 0x00 # D2 has unknown type and defined in shared lib
+ Symbol: D2
+ Type: R_MIPS_32
+ - Offset: 0x04 # D4 is an undefined data object
+ Symbol: D4
+ Type: R_MIPS_32
+ - Offset: 0x08 # U1 is undefined and has unknown type
+ Symbol: U1
+ Type: R_MIPS_32
+
+Symbols:
+ Local:
+ - Name: LT0
+ Section: .text
+ Type: STT_FUNC
+ Value: 0x0
+ Size: 4
+ - Name: LD0
+ Section: .data
+ Type: STT_OBJECT
+ Value: 0x0
+ Size: 4
+
+ Global:
+ - Name: _gp_disp
+ Type: STT_OBJECT
+
+ - Name: T0
+ Section: .text
+ Type: STT_FUNC
+ Value: 0x4
+ Size: 8
+ - Name: T1
+ Type: STT_FUNC
+ - Name: T2
+ - Name: T4
+ Type: STT_FUNC
+
+ - Name: D0
+ Section: .data
+ Type: STT_OBJECT
+ Value: 0x4
+ Size: 8
+ - Name: D1
+ Type: STT_OBJECT
+ - Name: D2
+ - Name: D4
+ Type: STT_OBJECT
+ - Name: U1
Added: lld/trunk/test/elf/Mips/rel-dynamic-09.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf/Mips/rel-dynamic-09.test?rev=207494&view=auto
==============================================================================
--- lld/trunk/test/elf/Mips/rel-dynamic-09.test (added)
+++ lld/trunk/test/elf/Mips/rel-dynamic-09.test Tue Apr 29 00:21:54 2014
@@ -0,0 +1,107 @@
+# Conditions:
+# a) Linking a non-shared executable file.
+# b) Relocations' targets are undefined symbols.
+# Check:
+# a) There should be no dynamic relocations.
+# b) There should be no PLT entries.
+#
+# RUN: yaml2obj -format=elf %s > %t-obj
+# RUN: lld -flavor gnu -target mipsel --noinhibit-exec -e T0 -o %t2-exe %t-obj
+# RUN: llvm-readobj -dt -r -s %t2-exe | FileCheck -check-prefix=PLT-SYM %s
+
+# PLT-SYM: Sections [
+# PLT-SYM: Section {
+# PLT-SYM-NOT: Name: .plt ({{[0-9]+}})
+
+# PLT-SYM: Relocations [
+# PLT-SYM-NEXT: ]
+
+# PLT-SYM: DynamicSymbols [
+# PLT-SYM-NEXT: Symbol {
+# PLT-SYM-NEXT: Name: @ (0)
+# PLT-SYM-NEXT: Value: 0x0
+# PLT-SYM-NEXT: Size: 0
+# PLT-SYM-NEXT: Binding: Local (0x0)
+# PLT-SYM-NEXT: Type: None (0x0)
+# PLT-SYM-NEXT: Other: 0
+# PLT-SYM-NEXT: Section: Undefined (0x0)
+# PLT-SYM-NEXT: }
+# PLT-SYM-NEXT: ]
+
+!ELF
+FileHeader: !FileHeader
+ Class: ELFCLASS32
+ Data: ELFDATA2LSB
+ Type: ET_REL
+ Machine: EM_MIPS
+ Flags: [EF_MIPS_CPIC]
+
+Sections:
+- Name: .text
+ Type: SHT_PROGBITS
+ Content: "0000000000000000"
+ AddressAlign: 16
+ Flags: [SHF_EXECINSTR, SHF_ALLOC]
+
+- Name: .data
+ Type: SHT_PROGBITS
+ Content: "0000000000000000"
+ AddressAlign: 16
+ Flags: [SHF_WRITE, SHF_ALLOC]
+
+- Name: .rel.text
+ Type: SHT_REL
+ Info: .text
+ AddressAlign: 4
+ Relocations:
+ - Offset: 0x04
+ Symbol: T3
+ Type: R_MIPS_26
+
+- Name: .rel.data
+ Type: SHT_REL
+ Info: .data
+ AddressAlign: 4
+ Relocations:
+ - Offset: 0x00
+ Symbol: T1
+ Type: R_MIPS_HI16
+ - Offset: 0x00
+ Symbol: T1
+ Type: R_MIPS_LO16
+ - Offset: 0x04
+ Symbol: T2
+ Type: R_MIPS_32
+
+ - Offset: 0x04
+ Symbol: D1
+ Type: R_MIPS_HI16
+ - Offset: 0x04
+ Symbol: D1
+ Type: R_MIPS_LO16
+ - Offset: 0x04
+ Symbol: D2
+ Type: R_MIPS_32
+
+Symbols:
+ Global:
+ - Name: T0
+ Section: .text
+ Type: STT_FUNC
+ Value: 0x0
+ Size: 8
+ - Name: T1
+ Type: STT_FUNC
+ - Name: T2
+ Type: STT_FUNC
+ - Name: T3
+ Type: STT_FUNC
+ - Name: D0
+ Section: .data
+ Type: STT_OBJECT
+ Value: 0x0
+ Size: 8
+ - Name: D1
+ Type: STT_OBJECT
+ - Name: D2
+ Type: STT_OBJECT
Added: lld/trunk/test/elf/Mips/rel-dynamic-10.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf/Mips/rel-dynamic-10.test?rev=207494&view=auto
==============================================================================
--- lld/trunk/test/elf/Mips/rel-dynamic-10.test (added)
+++ lld/trunk/test/elf/Mips/rel-dynamic-10.test Tue Apr 29 00:21:54 2014
@@ -0,0 +1,108 @@
+# Conditions:
+# a) Linking a non-shared executable file.
+# b) Relocations' targets are symbols defined in the other object.
+# Check:
+# a) There should be no dynamic relocations.
+# b) There should be no PLT entries.
+#
+# RUN: yaml2obj -format=elf %s > %t-obj1
+# RUN: yaml2obj -format=elf %S/Inputs/pic-obj.yaml > %t-obj2
+# RUN: lld -flavor gnu -target mipsel -e T0 -o %t3-exe %t-obj1 %t-obj2
+# RUN: llvm-readobj -dt -r -s %t3-exe | FileCheck -check-prefix=PLT-SYM %s
+
+# PLT-SYM: Sections [
+# PLT-SYM: Section {
+# PLT-SYM-NOT: Name: .plt ({{[0-9]+}})
+
+# PLT-SYM: Relocations [
+# PLT-SYM-NEXT: ]
+
+# PLT-SYM: DynamicSymbols [
+# PLT-SYM-NEXT: Symbol {
+# PLT-SYM-NEXT: Name: @ (0)
+# PLT-SYM-NEXT: Value: 0x0
+# PLT-SYM-NEXT: Size: 0
+# PLT-SYM-NEXT: Binding: Local (0x0)
+# PLT-SYM-NEXT: Type: None (0x0)
+# PLT-SYM-NEXT: Other: 0
+# PLT-SYM-NEXT: Section: Undefined (0x0)
+# PLT-SYM-NEXT: }
+# PLT-SYM-NEXT: ]
+
+!ELF
+FileHeader: !FileHeader
+ Class: ELFCLASS32
+ Data: ELFDATA2LSB
+ Type: ET_REL
+ Machine: EM_MIPS
+ Flags: [EF_MIPS_CPIC]
+
+Sections:
+- Name: .text
+ Type: SHT_PROGBITS
+ Content: "0000000000000000"
+ AddressAlign: 16
+ Flags: [SHF_EXECINSTR, SHF_ALLOC]
+
+- Name: .data
+ Type: SHT_PROGBITS
+ Content: "0000000000000000"
+ AddressAlign: 16
+ Flags: [SHF_WRITE, SHF_ALLOC]
+
+- Name: .rel.text
+ Type: SHT_REL
+ Info: .text
+ AddressAlign: 4
+ Relocations:
+ - Offset: 0x04
+ Symbol: T3
+ Type: R_MIPS_26
+
+- Name: .rel.data
+ Type: SHT_REL
+ Info: .data
+ AddressAlign: 4
+ Relocations:
+ - Offset: 0x00
+ Symbol: T1
+ Type: R_MIPS_HI16
+ - Offset: 0x00
+ Symbol: T1
+ Type: R_MIPS_LO16
+ - Offset: 0x04
+ Symbol: T2
+ Type: R_MIPS_32
+
+ - Offset: 0x04
+ Symbol: D1
+ Type: R_MIPS_HI16
+ - Offset: 0x04
+ Symbol: D1
+ Type: R_MIPS_LO16
+ - Offset: 0x04
+ Symbol: D2
+ Type: R_MIPS_32
+
+Symbols:
+ Global:
+ - Name: T0
+ Section: .text
+ Type: STT_FUNC
+ Value: 0x0
+ Size: 8
+ - Name: T1
+ Type: STT_FUNC
+ - Name: T2
+ Type: STT_FUNC
+ - Name: T3
+ Type: STT_FUNC
+ - Name: D0
+ Section: .data
+ Type: STT_OBJECT
+ Value: 0x0
+ Size: 8
+ - Name: D1
+ Type: STT_OBJECT
+ - Name: D2
+ Type: STT_OBJECT
Added: lld/trunk/test/elf/Mips/rel-dynamic-11.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf/Mips/rel-dynamic-11.test?rev=207494&view=auto
==============================================================================
--- lld/trunk/test/elf/Mips/rel-dynamic-11.test (added)
+++ lld/trunk/test/elf/Mips/rel-dynamic-11.test Tue Apr 29 00:21:54 2014
@@ -0,0 +1,84 @@
+# Conditions:
+# a) Linking a shared library.
+# b) Relocations' targets are symbols defined in the other shared object.
+# Check:
+# a) Emitting R_MIPS_REL32 relocations for both symbols.
+# b) There should be no PLT entries.
+#
+# RUN: yaml2obj -format=elf %S/Inputs/pic-obj.yaml > %t-so-obj
+# RUN: lld -flavor gnu -target mipsel -shared -o %t-so %t-so-obj
+# RUN: yaml2obj -format=elf %s > %t-obj
+# RUN: lld -flavor gnu -target mipsel -shared -o %t2-so %t-obj %t-so
+# RUN: llvm-readobj -dt -r -s %t2-so | FileCheck -check-prefix=PLT-SYM %s
+
+# PLT-SYM: Sections [
+# PLT-SYM: Section {
+# PLT-SYM-NOT: Name: .plt ({{[0-9]+}})
+#
+# PLT-SYM: Relocations [
+# PLT-SYM-NEXT: Section (4) .rel.dyn {
+# PLT-SYM-NEXT: 0x2000 R_MIPS_REL32 T1 0x0
+# PLT-SYM-NEXT: 0x160 R_MIPS_REL32 T1 0x0
+# PLT-SYM-NEXT: }
+# PLT-SYM-NEXT: ]
+#
+# PLT-SYM: Name: T1@ (7)
+# PLT-SYM-NEXT: Value: 0x0
+# PLT-SYM-NEXT: Size: 0
+# PLT-SYM-NEXT: Binding: Global (0x1)
+# PLT-SYM-NEXT: Type: Function (0x2)
+# PLT-SYM-NEXT: Other: 0
+# PLT-SYM-NEXT: Section: Undefined (0x0)
+
+!ELF
+FileHeader: !FileHeader
+ Class: ELFCLASS32
+ Data: ELFDATA2LSB
+ Type: ET_REL
+ Machine: EM_MIPS
+ Flags: [EF_MIPS_PIC, EF_MIPS_CPIC]
+
+Sections:
+- Name: .text
+ Type: SHT_PROGBITS
+ Content: "0000000000000000"
+ AddressAlign: 16
+ Flags: [SHF_EXECINSTR, SHF_ALLOC]
+
+- Name: .data
+ Type: SHT_PROGBITS
+ Content: "0000000000000000"
+ AddressAlign: 16
+ Flags: [SHF_WRITE, SHF_ALLOC]
+
+- Name: .rel.text
+ Type: SHT_REL
+ Info: .text
+ AddressAlign: 4
+ Relocations:
+ - Offset: 0x00
+ Symbol: T1
+ Type: R_MIPS_32
+
+- Name: .rel.data
+ Type: SHT_REL
+ Info: .data
+ AddressAlign: 4
+ Relocations:
+ - Offset: 0x00
+ Symbol: T1
+ Type: R_MIPS_32
+
+Symbols:
+ Global:
+ - Name: T0
+ Section: .text
+ Type: STT_FUNC
+ Value: 0x0
+ Size: 4
+ - Name: T1
+ - Name: D0
+ Section: .data
+ Type: STT_OBJECT
+ Value: 0x0
+ Size: 8
More information about the llvm-commits
mailing list