Skip to content

Commit 1af224b

Browse files
committed
Check multiple errors emitted
1 parent b262e69 commit 1af224b

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

lld/ELF/Relocations.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1340,9 +1340,10 @@ unsigned RelocationScanner::handleTlsRelocation(RelExpr expr, RelType type,
13401340
if (oneof<RE_AARCH64_AUTH_TLSDESC_PAGE, RE_AARCH64_AUTH_TLSDESC>(
13411341
expr)) {
13421342
assert(ctx.arg.emachine == EM_AARCH64);
1343-
if (!sym.hasFlag(NEEDS_TLSDESC)) {
1343+
uint16_t flags = sym.flags.load(std::memory_order_relaxed);
1344+
if (!(flags & NEEDS_TLSDESC)) {
13441345
sym.setFlags(NEEDS_TLSDESC | NEEDS_TLSDESC_AUTH);
1345-
} else if (!sym.hasFlag(NEEDS_TLSDESC_AUTH)) {
1346+
} else if (!(flags & NEEDS_TLSDESC_AUTH)) {
13461347
errBothAuthAndNonAuth();
13471348
return 1;
13481349
}

lld/test/ELF/aarch64-tlsdesc-pauth.s

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,12 @@ local2:
104104
// ERR1: error: both AUTH and non-AUTH TLSDESC entries for 'a' requested, but only one type of TLSDESC entry per symbol is supported
105105
// ERR1-NEXT: >>> defined in err1.o
106106
// ERR1-NEXT: >>> referenced by err1.o:(.text+0x10)
107+
// ERR1: error: both AUTH and non-AUTH TLSDESC entries for 'a' requested, but only one type of TLSDESC entry per symbol is supported
108+
// ERR1-NEXT: >>> defined in err1.o
109+
// ERR1-NEXT: >>> referenced by err1.o:(.text+0x14)
110+
// ERR1: error: both AUTH and non-AUTH TLSDESC entries for 'a' requested, but only one type of TLSDESC entry per symbol is supported
111+
// ERR1-NEXT: >>> defined in err1.o
112+
// ERR1-NEXT: >>> referenced by err1.o:(.text+0x18)
107113
.text
108114
adrp x0, :tlsdesc_auth:a
109115
ldr x16, [x0, :tlsdesc_auth_lo12:a]
@@ -124,6 +130,12 @@ local2:
124130
// ERR2: error: both AUTH and non-AUTH TLSDESC entries for 'a' requested, but only one type of TLSDESC entry per symbol is supported
125131
// ERR2-NEXT: >>> defined in err2.o
126132
// ERR2-NEXT: >>> referenced by err2.o:(.text+0x10)
133+
// ERR2: error: both AUTH and non-AUTH TLSDESC entries for 'a' requested, but only one type of TLSDESC entry per symbol is supported
134+
// ERR2-NEXT: >>> defined in err2.o
135+
// ERR2-NEXT: >>> referenced by err2.o:(.text+0x14)
136+
// ERR2: error: both AUTH and non-AUTH TLSDESC entries for 'a' requested, but only one type of TLSDESC entry per symbol is supported
137+
// ERR2-NEXT: >>> defined in err2.o
138+
// ERR2-NEXT: >>> referenced by err2.o:(.text+0x18)
127139
.text
128140
adrp x0, :tlsdesc:a
129141
ldr x1, [x0, :tlsdesc_lo12:a]

0 commit comments

Comments
 (0)