@@ -1065,9 +1065,8 @@ void MipsGotSection::build() {
10651065 // for the TP-relative offset as we don't know how much other data will
10661066 // be allocated before us in the static TLS block.
10671067 if (s->isPreemptible || ctx.arg .shared )
1068- ctx.mainPart ->relaDyn ->addReloc (
1069- {ctx.target ->tlsGotRel , this , offset,
1070- DynamicReloc::AgainstSymbolWithTargetVA, *s, 0 , R_ABS});
1068+ ctx.mainPart ->relaDyn ->addAddendOnlyRelocIfNonPreemptible (
1069+ ctx.target ->tlsGotRel , *this , offset, *s, ctx.target ->symbolicRel );
10711070 }
10721071 for (std::pair<Symbol *, size_t > &p : got.dynTlsSymbols ) {
10731072 Symbol *s = p.first ;
@@ -1160,6 +1159,7 @@ void MipsGotSection::writeTo(uint8_t *buf) {
11601159 // if we had to do this.
11611160 writeUint (ctx, buf + ctx.arg .wordsize ,
11621161 (uint64_t )1 << (ctx.arg .wordsize * 8 - 1 ));
1162+ ctx.target ->relocateAlloc (*this , buf);
11631163 for (const FileGot &g : gots) {
11641164 auto write = [&](size_t i, const Symbol *s, int64_t a) {
11651165 uint64_t va = a;
@@ -1189,9 +1189,10 @@ void MipsGotSection::writeTo(uint8_t *buf) {
11891189 write (p.second , p.first , 0 );
11901190 for (const std::pair<Symbol *, size_t > &p : g.relocs )
11911191 write (p.second , p.first , 0 );
1192- for (const std::pair<Symbol *, size_t > &p : g.tls )
1193- write (p.second , p.first ,
1194- p.first ->isPreemptible || ctx.arg .shared ? 0 : -0x7000 );
1192+ for (const std::pair<Symbol *, size_t > &p : g.tls ) {
1193+ if (!p.first ->isPreemptible && !ctx.arg .shared )
1194+ write (p.second , p.first , -0x7000 );
1195+ }
11951196 for (const std::pair<Symbol *, size_t > &p : g.dynTlsSymbols ) {
11961197 if (p.first == nullptr && !ctx.arg .shared )
11971198 write (p.second , nullptr , 1 );
@@ -1653,8 +1654,7 @@ int64_t DynamicReloc::computeAddend(Ctx &ctx) const {
16531654 case AgainstSymbol:
16541655 assert (sym != nullptr );
16551656 return addend;
1656- case AddendOnlyWithTargetVA:
1657- case AgainstSymbolWithTargetVA: {
1657+ case AddendOnlyWithTargetVA: {
16581658 uint64_t ca = inputSec->getRelocTargetVA (
16591659 ctx, Relocation{expr, type, 0 , addend, sym}, getOffset ());
16601660 return ctx.arg .is64 ? ca : SignExtend64<32 >(ca);
0 commit comments