@@ -885,10 +885,12 @@ static void addPltEntry(Ctx &ctx, PltSection &plt, GotPltSection &gotPlt,
885
885
RelocationBaseSection &rel, RelType type, Symbol &sym) {
886
886
plt.addEntry (sym);
887
887
gotPlt.addEntry (sym);
888
- rel.addReloc ({type, &gotPlt, sym.getGotPltOffset (ctx),
889
- sym.isPreemptible ? DynamicReloc::AgainstSymbol
890
- : DynamicReloc::AddendOnlyWithTargetVA,
891
- sym, 0 , R_ABS});
888
+ if (sym.isPreemptible )
889
+ rel.addReloc ({type, &gotPlt, sym.getGotPltOffset (ctx),
890
+ DynamicReloc::AgainstSymbol, sym, 0 , R_ADDEND});
891
+ else
892
+ rel.addReloc ({type, &gotPlt, sym.getGotPltOffset (ctx),
893
+ DynamicReloc::AddendOnly, sym, 0 , R_ABS});
892
894
}
893
895
894
896
void elf::addGotEntry (Ctx &ctx, Symbol &sym) {
@@ -899,7 +901,7 @@ void elf::addGotEntry(Ctx &ctx, Symbol &sym) {
899
901
if (sym.isPreemptible ) {
900
902
ctx.mainPart ->relaDyn ->addReloc ({ctx.target ->gotRel , ctx.in .got .get (), off,
901
903
DynamicReloc::AgainstSymbol, sym, 0 ,
902
- R_ABS });
904
+ R_ADDEND });
903
905
return ;
904
906
}
905
907
@@ -921,14 +923,14 @@ static void addGotAuthEntry(Ctx &ctx, Symbol &sym) {
921
923
if (sym.isPreemptible ) {
922
924
ctx.mainPart ->relaDyn ->addReloc ({R_AARCH64_AUTH_GLOB_DAT, ctx.in .got .get (),
923
925
off, DynamicReloc::AgainstSymbol, sym, 0 ,
924
- R_ABS });
926
+ R_ADDEND });
925
927
return ;
926
928
}
927
929
928
930
// Signed GOT requires dynamic relocation.
929
931
ctx.in .got ->getPartition (ctx).relaDyn ->addReloc (
930
- {R_AARCH64_AUTH_RELATIVE, ctx.in .got .get (), off,
931
- DynamicReloc::AddendOnlyWithTargetVA, sym, 0 , R_ABS});
932
+ {R_AARCH64_AUTH_RELATIVE, ctx.in .got .get (), off, DynamicReloc::AddendOnly,
933
+ sym, 0 , R_ABS});
932
934
}
933
935
934
936
static void addTpOffsetGotEntry (Ctx &ctx, Symbol &sym) {
@@ -1160,8 +1162,8 @@ void RelocationScanner::processAux(RelExpr expr, RelType type, uint64_t offset,
1160
1162
part.relrAuthDyn ->relocs .push_back ({sec, sec->relocs ().size () - 1 });
1161
1163
} else {
1162
1164
part.relaDyn ->addReloc ({R_AARCH64_AUTH_RELATIVE, sec, offset,
1163
- DynamicReloc::AddendOnlyWithTargetVA , sym,
1164
- addend, R_ABS});
1165
+ DynamicReloc::AddendOnly , sym, addend ,
1166
+ R_ABS});
1165
1167
}
1166
1168
return ;
1167
1169
}
@@ -1948,13 +1950,12 @@ void elf::postScanRelocations(Ctx &ctx) {
1948
1950
1949
1951
GotSection *got = ctx.in .got .get ();
1950
1952
if (ctx.needsTlsLd .load (std::memory_order_relaxed) && got->addTlsIndex ()) {
1951
- static Undefined dummy (ctx.internalFile , " " , STB_LOCAL, 0 , 0 );
1952
1953
if (ctx.arg .shared )
1953
1954
ctx.mainPart ->relaDyn ->addReloc (
1954
1955
{ctx.target ->tlsModuleIndexRel , got, got->getTlsIndexOff ()});
1955
1956
else
1956
1957
got->addConstant ({R_ADDEND, ctx.target ->symbolicRel ,
1957
- got->getTlsIndexOff (), 1 , &dummy });
1958
+ got->getTlsIndexOff (), 1 , ctx. dummySym });
1958
1959
}
1959
1960
1960
1961
assert (ctx.symAux .size () == 1 );
0 commit comments