[Mips] Do not use standard relocation identifier R_MIPS_NONE for

internal purpose. Use special LLD_R_MIPS_GLOBAL_GOT constant for that.

llvm-svn: 198787
This commit is contained in:
Simon Atanasyan 2014-01-08 20:42:38 +00:00
parent fc2e4e6a76
commit 50cf77bc2f
5 changed files with 20 additions and 6 deletions

View File

@ -14,6 +14,12 @@
namespace lld {
namespace elf {
/// \brief Mips internal references.
enum {
/// \brief Do nothing but mark GOT entry as a global one.
LLD_R_MIPS_GLOBAL_GOT = 1024
};
typedef llvm::object::ELFType<llvm::support::little, 2, false> Mips32ElELFType;
template <class ELFType> class MipsTargetLayout;

View File

@ -177,6 +177,9 @@ error_code MipsTargetRelocationHandler::applyRelocation(
case R_MIPS_JALR:
// We do not do JALR optimization now.
break;
case LLD_R_MIPS_GLOBAL_GOT:
// Do nothing.
break;
default: {
std::string str;
llvm::raw_string_ostream s(str);

View File

@ -138,7 +138,7 @@ private:
if (da)
ga->addReferenceELF_Mips(R_MIPS_32, 0, a, 0);
else
ga->addReferenceELF_Mips(R_MIPS_NONE, 0, a, 0);
ga->addReferenceELF_Mips(LLD_R_MIPS_GLOBAL_GOT, 0, a, 0);
_globalGotVector.push_back(ga);
}

View File

@ -55,7 +55,7 @@ public:
continue;
assert(r->kindArch() == Reference::KindArch::Mips);
if (r->kindValue() == llvm::ELF::R_MIPS_32 ||
r->kindValue() == llvm::ELF::R_MIPS_NONE) {
r->kindValue() == LLD_R_MIPS_GLOBAL_GOT) {
ta = r->target();
break;
}

View File

@ -180,8 +180,13 @@ void MipsTargetHandler::registerRelocationNames(Registry &registry) {
}
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_HI16), LLD_KIND_STRING_ENTRY(R_MIPS_LO16),
LLD_KIND_STRING_ENTRY(R_MIPS_GOT16), LLD_KIND_STRING_ENTRY(R_MIPS_CALL16),
LLD_KIND_STRING_ENTRY(R_MIPS_JALR), LLD_KIND_STRING_END
LLD_KIND_STRING_ENTRY(R_MIPS_NONE),
LLD_KIND_STRING_ENTRY(R_MIPS_32),
LLD_KIND_STRING_ENTRY(R_MIPS_HI16),
LLD_KIND_STRING_ENTRY(R_MIPS_LO16),
LLD_KIND_STRING_ENTRY(R_MIPS_GOT16),
LLD_KIND_STRING_ENTRY(R_MIPS_CALL16),
LLD_KIND_STRING_ENTRY(R_MIPS_JALR),
LLD_KIND_STRING_ENTRY(LLD_R_MIPS_GLOBAL_GOT),
LLD_KIND_STRING_END
};