Skip to content

Commit 1621897

Browse files
committed
Use Err(ctx) instead of fatal and use getLocation in error message
1 parent 42ca2d9 commit 1621897

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

lld/ELF/Relocations.cpp

+4-3
Original file line numberDiff line numberDiff line change
@@ -1131,9 +1131,10 @@ void RelocationScanner::processAux(RelExpr expr, RelType type, uint64_t offset,
11311131
if (!(flags & NEEDS_GOT)) {
11321132
sym.setFlags(needsGotAuth ? (NEEDS_GOT | NEEDS_GOT_AUTH) : NEEDS_GOT);
11331133
} else if (needsGotAuth != static_cast<bool>(flags & NEEDS_GOT_AUTH)) {
1134-
fatal("both AUTH and non-AUTH GOT entries for '" + sym.getName() +
1135-
"' requested, but only one type of GOT entry per symbol is "
1136-
"supported");
1134+
Err(ctx) << "both AUTH and non-AUTH GOT entries for '" << sym.getName()
1135+
<< "' requested, but only one type of GOT entry per symbol is "
1136+
"supported"
1137+
<< getLocation(ctx, *sec, sym, offset);
11371138
}
11381139
}
11391140
} else if (needsPlt(expr)) {

lld/test/ELF/aarch64-got-relocations-pauth.s

+6-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,12 @@ _start:
8484

8585
# RUN: not ld.lld err.o a.so -pie -o /dev/null 2>&1 | FileCheck %s --check-prefix=ERR
8686

87-
# ERR: error: both AUTH and non-AUTH GOT entries for 'bar' requested, but only one type of GOT entry per symbol is supported
87+
# ERR: error: both AUTH and non-AUTH GOT entries for 'bar' requested, but only one type of GOT entry per symbol is supported
88+
# ERR-NEXT: >>> defined in a.so
89+
# ERR-NEXT: >>> referenced by err.o:(.text+0x8)
90+
# ERR: error: both AUTH and non-AUTH GOT entries for 'bar' requested, but only one type of GOT entry per symbol is supported
91+
# ERR-NEXT: >>> defined in a.so
92+
# ERR-NEXT: >>> referenced by err.o:(.text+0xC)
8893

8994
.globl _start
9095
_start:

0 commit comments

Comments
 (0)