Skip to content

Commit b14271d

Browse files
committed
Check multiple errors emitted
1 parent 7a3eabc commit b14271d

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
@@ -1344,9 +1344,10 @@ unsigned RelocationScanner::handleTlsRelocation(RelExpr expr, RelType type,
13441344
if (oneof<R_AARCH64_AUTH_TLSDESC_PAGE, RelExpr::R_AARCH64_AUTH_TLSDESC>(
13451345
expr)) {
13461346
assert(ctx.arg.emachine == EM_AARCH64);
1347-
if (!sym.hasFlag(NEEDS_TLSDESC)) {
1347+
uint16_t flags = sym.flags.load(std::memory_order_relaxed);
1348+
if (!(flags & NEEDS_TLSDESC)) {
13481349
sym.setFlags(NEEDS_TLSDESC | NEEDS_TLSDESC_AUTH);
1349-
} else if (!sym.hasFlag(NEEDS_TLSDESC_AUTH)) {
1350+
} else if (!(flags & NEEDS_TLSDESC_AUTH)) {
13501351
errBothAuthAndNonAuth();
13511352
return 1;
13521353
}

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)