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