forked from OSchip/llvm-project
parent
e0b34f366f
commit
ebb04b9eb6
|
@ -142,6 +142,8 @@ getSymVA(uint32_t Type, typename ELFT::uint A, typename ELFT::uint P,
|
|||
const elf::ObjectFile<ELFT> &File, RelExpr Expr) {
|
||||
typedef typename ELFT::uint uintX_t;
|
||||
switch (Expr) {
|
||||
case R_HINT:
|
||||
llvm_unreachable("cannot relocate hint relocs");
|
||||
case R_TLSLD:
|
||||
return Out<ELFT>::Got->getTlsIndexOff() + A -
|
||||
Out<ELFT>::Got->getNumEntries() * sizeof(uintX_t);
|
||||
|
|
|
@ -35,6 +35,7 @@ enum RelExpr {
|
|||
R_GOT_OFF,
|
||||
R_GOT_PAGE_PC,
|
||||
R_GOT_PC,
|
||||
R_HINT,
|
||||
R_MIPS_GOT,
|
||||
R_MIPS_GOT_LOCAL,
|
||||
R_NEG_TLS,
|
||||
|
|
|
@ -179,7 +179,6 @@ public:
|
|||
bool needsThunk(uint32_t Type, const InputFile &File,
|
||||
const SymbolBody &S) const override;
|
||||
void relocateOne(uint8_t *Loc, uint32_t Type, uint64_t Val) const override;
|
||||
bool isHintRel(uint32_t Type) const override;
|
||||
bool usesOnlyLowPageBits(uint32_t Type) const override;
|
||||
};
|
||||
} // anonymous namespace
|
||||
|
@ -224,7 +223,6 @@ uint64_t TargetInfo::getImplicitAddend(const uint8_t *Buf,
|
|||
|
||||
uint64_t TargetInfo::getVAStart() const { return Config->Pic ? 0 : VAStart; }
|
||||
|
||||
bool TargetInfo::isHintRel(uint32_t Type) const { return false; }
|
||||
bool TargetInfo::usesOnlyLowPageBits(uint32_t Type) const { return false; }
|
||||
|
||||
bool TargetInfo::needsThunk(uint32_t Type, const InputFile &File,
|
||||
|
@ -1266,6 +1264,8 @@ RelExpr MipsTargetInfo<ELFT>::getRelExpr(uint32_t Type,
|
|||
switch (Type) {
|
||||
default:
|
||||
return R_ABS;
|
||||
case R_MIPS_JALR:
|
||||
return R_HINT;
|
||||
case R_MIPS_GPREL16:
|
||||
case R_MIPS_GPREL32:
|
||||
return R_GOTREL;
|
||||
|
@ -1534,11 +1534,6 @@ void MipsTargetInfo<ELFT>::relocateOne(uint8_t *Loc, uint32_t Type,
|
|||
}
|
||||
}
|
||||
|
||||
template <class ELFT>
|
||||
bool MipsTargetInfo<ELFT>::isHintRel(uint32_t Type) const {
|
||||
return Type == R_MIPS_JALR;
|
||||
}
|
||||
|
||||
template <class ELFT>
|
||||
bool MipsTargetInfo<ELFT>::usesOnlyLowPageBits(uint32_t Type) const {
|
||||
return Type == R_MIPS_LO16;
|
||||
|
|
|
@ -42,11 +42,6 @@ public:
|
|||
uint64_t PltEntryAddr, int32_t Index,
|
||||
unsigned RelOff) const {}
|
||||
|
||||
// Returns true if a relocation is just a hint for linker to make for example
|
||||
// some code optimization. Such relocations should not be handled as a regular
|
||||
// ones and lead to dynamic relocation creation etc.
|
||||
virtual bool isHintRel(uint32_t Type) const;
|
||||
|
||||
// Returns true if a relocation only uses the low bits of a value such that
|
||||
// all those bits are in in the same page. For example, if the relocation
|
||||
// only uses the low 12 bits in a system with 4k pages. If this is true, the
|
||||
|
|
|
@ -587,16 +587,15 @@ void Writer<ELFT>::scanRelocs(InputSectionBase<ELFT> &C, ArrayRef<RelTy> Rels) {
|
|||
SymbolBody &Body = File.getRelocTargetSym(RI);
|
||||
uint32_t Type = RI.getType(Config->Mips64EL);
|
||||
|
||||
RelExpr Expr = Target->getRelExpr(Type, Body);
|
||||
// Ignore "hint" relocation because it is for optional code optimization.
|
||||
if (Target->isHintRel(Type))
|
||||
if (Expr == R_HINT)
|
||||
continue;
|
||||
|
||||
uintX_t Offset = C.getOffset(RI.r_offset);
|
||||
if (Offset == (uintX_t)-1)
|
||||
continue;
|
||||
|
||||
RelExpr Expr = Target->getRelExpr(Type, Body);
|
||||
|
||||
Expr = adjustExpr(Body, IsWrite, Expr, Type);
|
||||
if (HasError)
|
||||
continue;
|
||||
|
|
Loading…
Reference in New Issue