@@ -1065,9 +1065,8 @@ void MipsGotSection::build() {
1065
1065
// for the TP-relative offset as we don't know how much other data will
1066
1066
// be allocated before us in the static TLS block.
1067
1067
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 );
1071
1070
}
1072
1071
for (std::pair<Symbol *, size_t > &p : got.dynTlsSymbols ) {
1073
1072
Symbol *s = p.first ;
@@ -1160,6 +1159,7 @@ void MipsGotSection::writeTo(uint8_t *buf) {
1160
1159
// if we had to do this.
1161
1160
writeUint (ctx, buf + ctx.arg .wordsize ,
1162
1161
(uint64_t )1 << (ctx.arg .wordsize * 8 - 1 ));
1162
+ ctx.target ->relocateAlloc (*this , buf);
1163
1163
for (const FileGot &g : gots) {
1164
1164
auto write = [&](size_t i, const Symbol *s, int64_t a) {
1165
1165
uint64_t va = a;
@@ -1189,9 +1189,10 @@ void MipsGotSection::writeTo(uint8_t *buf) {
1189
1189
write (p.second , p.first , 0 );
1190
1190
for (const std::pair<Symbol *, size_t > &p : g.relocs )
1191
1191
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
+ }
1195
1196
for (const std::pair<Symbol *, size_t > &p : g.dynTlsSymbols ) {
1196
1197
if (p.first == nullptr && !ctx.arg .shared )
1197
1198
write (p.second , nullptr , 1 );
@@ -1653,8 +1654,7 @@ int64_t DynamicReloc::computeAddend(Ctx &ctx) const {
1653
1654
case AgainstSymbol:
1654
1655
assert (sym != nullptr );
1655
1656
return addend;
1656
- case AddendOnlyWithTargetVA:
1657
- case AgainstSymbolWithTargetVA: {
1657
+ case AddendOnlyWithTargetVA: {
1658
1658
uint64_t ca = inputSec->getRelocTargetVA (
1659
1659
ctx, Relocation{expr, type, 0 , addend, sym}, getOffset ());
1660
1660
return ctx.arg .is64 ? ca : SignExtend64<32 >(ca);
0 commit comments