Skip to content

Commit af90402

Browse files
committed
Check multiple errors emitted
1 parent 07d26fa commit af90402

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
@@ -1339,9 +1339,10 @@ unsigned RelocationScanner::handleTlsRelocation(RelExpr expr, RelType type,
13391339
if (oneof<RE_AARCH64_AUTH_TLSDESC_PAGE, RE_AARCH64_AUTH_TLSDESC>(
13401340
expr)) {
13411341
assert(ctx.arg.emachine == EM_AARCH64);
1342-
if (!sym.hasFlag(NEEDS_TLSDESC)) {
1342+
uint16_t flags = sym.flags.load(std::memory_order_relaxed);
1343+
if (!(flags & NEEDS_TLSDESC)) {
13431344
sym.setFlags(NEEDS_TLSDESC | NEEDS_TLSDESC_AUTH);
1344-
} else if (!sym.hasFlag(NEEDS_TLSDESC_AUTH)) {
1345+
} else if (!(flags & NEEDS_TLSDESC_AUTH)) {
13451346
errBothAuthAndNonAuth();
13461347
return 1;
13471348
}

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)