Lines Matching +defs:t +defs:expr
19 // symbols if they don't exist, and fix up locations with GOT entry
36 // Note that the functions in this file don't actually apply relocations
37 // because it doesn't know about the output file nor the output file buffer.
155 // expr and use a simple shift and bitwise-and to test for membership.
156 template <RelExpr... Exprs> static bool oneof(RelExpr expr) {
157 assert(0 <= expr && (int)expr < 128 &&
160 if (expr >= 64)
161 return (uint64_t(1) << (expr - 64)) & buildMask((Exprs - 64)...);
162 return (uint64_t(1) << expr) & buildMask(Exprs...);
205 static bool needsPlt(RelExpr expr) {
208 R_PPC64_CALL_PLT>(expr);
211 bool lld::elf::needsGot(RelExpr expr) {
215 expr);
220 static bool isRelExpr(RelExpr expr) {
224 R_LOONGARCH_PAGE_PC>(expr);
227 static RelExpr toPlt(RelExpr expr) {
228 switch (expr) {
240 return expr;
244 static RelExpr fromPlt(RelExpr expr) {
247 switch (expr) {
262 return expr;
304 // non-default version symbols. If ss has a non-default version, ret won't
362 // functions from your library. You shouldn't export variables.
367 // end of T even though doing that doesn't change the layout of the
375 // Copy relocation against zero-sized symbol doesn't make sense.
409 // output offset. That isn't cheap.
415 // For sections other than .eh_frame, this class doesn't do anything.
474 int64_t computeMipsAddend(const RelTy &rel, RelExpr expr, bool isLocal) const;
477 void processAux(RelExpr expr, RelType type, uint64_t offset, Symbol &sym,
490 int64_t RelocationScanner::computeMipsAddend(const RelTy &rel, RelExpr expr,
492 if (expr == R_MIPS_GOTREL && isLocal)
516 warn("can't find matching " + toString(pairTy) + " relocation for " +
604 // will give an error. Don't suggest an alternative spelling.
823 // If versioned, issue an error (even if the symbol is weak) because we don't
873 Symbol &sym, int64_t addend, RelExpr expr,
880 addend, type, expr);
890 isec.relocations.push_back({expr, type, offsetInSec, addend, &sym});
897 // relrDyn sections don't support odd offsets. Also, relrDyn sections
898 // don't store the addend values, so we must write it to the relocated
901 isec.addReloc({expr, type, offsetInSec, addend, &sym});
910 sym, addend, type, expr);
1055 void RelocationScanner::processAux(RelExpr expr, RelType type, uint64_t offset,
1061 if (expr != R_GOT_PC) {
1064 if (config->emachine == EM_PPC && expr == R_PPC32_PLTREL)
1072 expr = fromPlt(expr);
1074 expr =
1077 // needing the GOT if we can't relax everything.
1078 if (expr == R_RELAX_GOT_PC)
1092 if (needsGot(expr)) {
1094 // MIPS ABI has special rules to process GOT entries and doesn't
1101 in.mipsGot->addEntry(*sec->file, sym, addend, expr);
1104 // case the NEEDS_GOT flag shouldn't get set.
1107 } else if (needsPlt(expr)) {
1127 if (isStaticLinkTimeConstant(expr, type, sym, offset) ||
1129 sec->addReloc({expr, type, offset, addend, &sym});
1137 // For MIPS, we don't implement GNU ld's DW_EH_PE_absptr to DW_EH_PE_pcrel
1144 if (oneof<R_GOT, R_LOONGARCH_GOT>(expr) ||
1146 addRelativeReloc<true>(*sec, offset, sym, addend, expr, type);
1155 // For a preemptible symbol, we can't use a relative relocation. For an
1156 // undefined symbol, we can't compute offset at link-time and use a
1164 sec->addReloc({expr, type, offset, addend, &sym});
1191 in.mipsGot->addEntry(*sec->file, sym, addend, expr);
1218 sec->addReloc({expr, type, offset, addend, &sym});
1230 // For the static linking part, we just return a plt expr and everything
1246 // compiled without -fPIE/-fPIC and doesn't maintain ebx.
1255 sec->addReloc({expr, type, offset, addend, &sym});
1274 int64_t addend, RelExpr expr) {
1275 if (expr == R_MIPS_TLSLD) {
1277 c.addReloc({expr, type, offset, addend, &sym});
1280 if (expr == R_MIPS_TLSGD) {
1282 c.addReloc({expr, type, offset, addend, &sym});
1297 int64_t addend, RelExpr expr) {
1298 if (expr == R_TPREL || expr == R_TPREL_NEG) {
1308 return handleMipsTlsRelocation(type, sym, c, offset, addend, expr);
1314 R_TLSDESC_CALL>(expr)) {
1315 if (expr != R_TLSDESC_CALL) {
1317 c.addReloc({expr, type, offset, addend, &sym});
1325 R_TLSDESC_GOTPLT>(expr) &&
1329 if (expr != R_TLSDESC_CALL) {
1332 c.addReloc({expr, type, offset, addend, &sym});
1345 !(isRISCV && expr != R_TLSDESC_PC && expr != R_TLSDESC_CALL) &&
1361 if (oneof<R_TLSLD_GOT, R_TLSLD_GOTPLT, R_TLSLD_PC, R_TLSLD_HINT>(expr)) {
1368 if (expr == R_TLSLD_HINT)
1371 c.addReloc({expr, type, offset, addend, &sym});
1376 if (expr == R_DTPREL) {
1378 expr = target->adjustTlsExpr(type, R_RELAX_TLS_LD_TO_LE);
1379 c.addReloc({expr, type, offset, addend, &sym});
1386 if (expr == R_TLSLD_GOT_OFF) {
1388 c.addReloc({expr, type, offset, addend, &sym});
1394 R_LOONGARCH_TLSGD_PAGE_PC>(expr)) {
1397 c.addReloc({expr, type, offset, addend, &sym});
1419 R_LOONGARCH_GOT_PAGE_PC, R_GOT_OFF, R_TLSIE_HINT>(expr)) {
1425 } else if (expr != R_TLSIE_HINT) {
1428 if (expr == R_GOT && config->isPic && !target->usesOnlyLowPageBits(type))
1429 addRelativeReloc<true>(c, offset, sym, addend, expr, type);
1431 c.addReloc({expr, type, offset, addend, &sym});
1462 RelExpr expr = target->getRelExpr(type, sym, sec->content().data() + offset);
1468 addend += computeMipsAddend<ELFT>(rel, expr, sym.isLocal());
1473 if (expr == R_NONE)
1477 // marker relocations, e.g. R_*_NONE and R_ARM_V4BX. Don't error on them.
1486 // lld allocates got entries to symbols on demand. Since we don't try to
1487 // sort the got entries in any way, we don't have to track which objects
1500 if ((type == R_PPC64_TLSGD && expr == R_TLSDESC_CALL) ||
1501 (type == R_PPC64_TLSLD && expr == R_TLSLD_HINT)) {
1524 R_TLSDESC_GOTPLT, R_TLSGD_GOTPLT>(expr)) {
1527 R_PPC64_RELAX_TOC>(expr)) {
1536 if (sym.isTls() || oneof<R_TLSDESC_PC, R_TLSDESC_CALL>(expr)) {
1538 handleTlsRelocation(type, sym, *sec, offset, addend, expr)) {
1544 processAux(expr, type, offset, sym, addend);
1756 // don't try to call the PLT as if it were an ifunc resolver.
1789 // later iterations aliases won't cause redundant copies.
1870 // handling. They don't need regular PLT.
2211 // We can't reuse thunks in different loadable partitions because they might
2241 for (Thunk *t : *thunkVec)
2242 if (isThunkSectionCompatible(isec, t->getThunkTargetSym()->section) &&
2243 t->isCompatibleWith(*isec, rel) &&
2245 t->getThunkTargetSym()->getVA(-pcBias)))
2246 return std::make_pair(t, false);
2249 Thunk *t = addThunk(*isec, rel);
2250 thunkVec->push_back(t);
2251 return std::make_pair(t, true);
2259 if (Thunk *t = thunks.lookup(rel.sym)) {
2262 rel.sym = &t->destination;
2263 rel.addend = t->addend;
2265 rel.expr = toPlt(rel.expr);
2320 if (!target->needsThunk(rel.expr, rel.type, isec->file, src,
2324 Thunk *t;
2326 std::tie(t, isNew) = getThunk(isec, rel, src);
2331 if (auto *tis = t->getTargetInputSection())
2335 ts->addThunk(t);
2336 thunks[t->getThunkTargetSym()] = t;
2340 rel.sym = t->getThunkTargetSym();
2341 rel.expr = fromPlt(rel.expr);
2372 if (rel.sym->type == llvm::ELF::STT_TLS && rel.expr == R_PLT_PC) {
2389 if (rel.sym->type == llvm::ELF::STT_TLS && rel.expr == R_PLT_PC) {