static RelExpr adjustExpr(SymbolBody &Body, RelExpr Expr, uint32_t Type,
const uint8_t *Data, InputSectionBase &S,
typename ELFT::uint RelOff) {
- bool Preemptible = isPreemptible(Body, Type);
if (Body.isGnuIFunc()) {
Expr = toPlt(Expr);
- } else if (!Preemptible) {
+ } else if (!isPreemptible(Body, Type)) {
if (needsPlt(Expr))
Expr = fromPlt(Expr);
if (Expr == R_GOT_PC && !isAbsoluteValue(Body))
" defined in " + toString(Body.File));
return Expr;
}
+
if (Body.getVisibility() != STV_DEFAULT) {
error(S.getLocation<ELFT>(RelOff) + ": cannot preempt symbol '" +
toString(Body) + "' defined in " + toString(Body.File));
return Expr;
}
+
if (Body.isObject()) {
// Produce a copy relocation.
auto *B = cast<SharedSymbol>(&Body);
}
return Expr;
}
+
if (Body.isFunc()) {
// This handles a non PIC program call to function in a shared library. In
// an ideal world, we could just report an error saying the relocation can
Body.NeedsPltAddr = true;
return toPlt(Expr);
}
+
error("symbol '" + toString(Body) + "' defined in " + toString(Body.File) +
" is missing type");
-
return Expr;
}
return RelExpr;
const uint8_t Op = Data[-2];
const uint8_t ModRm = Data[-1];
+
// FIXME: When PIC is disabled and foo is defined locally in the
// lower 32 bit address space, memory operand in mov can be converted into
// immediate operand. Otherwise, mov must be changed to lea. We support only
// latter relaxation at this moment.
if (Op == 0x8b)
return R_RELAX_GOT_PC;
+
// Relax call and jmp.
if (Op == 0xff && (ModRm == 0x15 || ModRm == 0x25))
return R_RELAX_GOT_PC;