@@ -913,6 +913,7 @@ void elf::addGotEntry(Ctx &ctx, Symbol &sym) {
913
913
914
914
static void addGotAuthEntry (Ctx &ctx, Symbol &sym) {
915
915
ctx.in .got ->addEntry (sym);
916
+ ctx.in .got ->addAuthEntry (sym);
916
917
uint64_t off = sym.getGotOffset (ctx);
917
918
918
919
// If preemptible, emit a GLOB_DAT relocation.
@@ -1095,18 +1096,10 @@ void RelocationScanner::processAux(RelExpr expr, RelType type, uint64_t offset,
1095
1096
} else if (!sym.isTls () || ctx.arg .emachine != EM_LOONGARCH) {
1096
1097
// Many LoongArch TLS relocs reuse the RE_LOONGARCH_GOT type, in which
1097
1098
// case the NEEDS_GOT flag shouldn't get set.
1098
- bool needsGotAuth =
1099
- (expr == RE_AARCH64_AUTH_GOT || expr == RE_AARCH64_AUTH_GOT_PAGE_PC);
1100
- uint16_t flags = sym.flags .load (std::memory_order_relaxed);
1101
- if (!(flags & NEEDS_GOT)) {
1102
- sym.setFlags (needsGotAuth ? (NEEDS_GOT | NEEDS_GOT_AUTH) : NEEDS_GOT);
1103
- } else if (needsGotAuth != static_cast <bool >(flags & NEEDS_GOT_AUTH)) {
1104
- auto diag = Err (ctx);
1105
- diag << " both AUTH and non-AUTH GOT entries for '" << sym.getName ()
1106
- << " ' requested, but only one type of GOT entry per symbol is "
1107
- " supported" ;
1108
- printLocation (diag, *sec, sym, offset);
1109
- }
1099
+ if (expr == RE_AARCH64_AUTH_GOT || expr == RE_AARCH64_AUTH_GOT_PAGE_PC)
1100
+ sym.setFlags (NEEDS_GOT | NEEDS_GOT_AUTH);
1101
+ else
1102
+ sym.setFlags (NEEDS_GOT | NEEDS_GOT_NONAUTH);
1110
1103
}
1111
1104
} else if (needsPlt (expr)) {
1112
1105
sym.setFlags (NEEDS_PLT);
@@ -1807,6 +1800,12 @@ void elf::postScanRelocations(Ctx &ctx) {
1807
1800
sym.allocateAux (ctx);
1808
1801
1809
1802
if (flags & NEEDS_GOT) {
1803
+ if ((flags & NEEDS_GOT_AUTH) && (flags & NEEDS_GOT_NONAUTH)) {
1804
+ auto diag = Err (ctx);
1805
+ diag << " both AUTH and non-AUTH GOT entries for '" << sym.getName ()
1806
+ << " ' requested, but only one type of GOT entry per symbol is "
1807
+ " supported" ;
1808
+ }
1810
1809
if (flags & NEEDS_GOT_AUTH)
1811
1810
addGotAuthEntry (ctx, sym);
1812
1811
else
0 commit comments