@@ -885,10 +885,12 @@ static void addPltEntry(Ctx &ctx, PltSection &plt, GotPltSection &gotPlt,
885885 RelocationBaseSection &rel, RelType type, Symbol &sym) {
886886 plt.addEntry (sym);
887887 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});
892894}
893895
894896void elf::addGotEntry (Ctx &ctx, Symbol &sym) {
@@ -899,7 +901,7 @@ void elf::addGotEntry(Ctx &ctx, Symbol &sym) {
899901 if (sym.isPreemptible ) {
900902 ctx.mainPart ->relaDyn ->addReloc ({ctx.target ->gotRel , ctx.in .got .get (), off,
901903 DynamicReloc::AgainstSymbol, sym, 0 ,
902- R_ABS });
904+ R_ADDEND });
903905 return ;
904906 }
905907
@@ -921,14 +923,14 @@ static void addGotAuthEntry(Ctx &ctx, Symbol &sym) {
921923 if (sym.isPreemptible ) {
922924 ctx.mainPart ->relaDyn ->addReloc ({R_AARCH64_AUTH_GLOB_DAT, ctx.in .got .get (),
923925 off, DynamicReloc::AgainstSymbol, sym, 0 ,
924- R_ABS });
926+ R_ADDEND });
925927 return ;
926928 }
927929
928930 // Signed GOT requires dynamic relocation.
929931 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});
932934}
933935
934936static void addTpOffsetGotEntry (Ctx &ctx, Symbol &sym) {
@@ -1160,8 +1162,8 @@ void RelocationScanner::processAux(RelExpr expr, RelType type, uint64_t offset,
11601162 part.relrAuthDyn ->relocs .push_back ({sec, sec->relocs ().size () - 1 });
11611163 } else {
11621164 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});
11651167 }
11661168 return ;
11671169 }
@@ -1948,13 +1950,12 @@ void elf::postScanRelocations(Ctx &ctx) {
19481950
19491951 GotSection *got = ctx.in .got .get ();
19501952 if (ctx.needsTlsLd .load (std::memory_order_relaxed) && got->addTlsIndex ()) {
1951- static Undefined dummy (ctx.internalFile , " " , STB_LOCAL, 0 , 0 );
19521953 if (ctx.arg .shared )
19531954 ctx.mainPart ->relaDyn ->addReloc (
19541955 {ctx.target ->tlsModuleIndexRel , got, got->getTlsIndexOff ()});
19551956 else
19561957 got->addConstant ({R_ADDEND, ctx.target ->symbolicRel ,
1957- got->getTlsIndexOff (), 1 , &dummy });
1958+ got->getTlsIndexOff (), 1 , ctx. dummySym });
19581959 }
19591960
19601961 assert (ctx.symAux .size () == 1 );
0 commit comments