Skip to content

Commit be2f895

Browse files
committed
Use Err(ctx) instead of fatal and use getLocation in error message
1 parent 4d51c70 commit be2f895

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

lld/ELF/Relocations.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1110,9 +1110,10 @@ void RelocationScanner::processAux(RelExpr expr, RelType type, uint64_t offset,
11101110
if (!(flags & NEEDS_GOT)) {
11111111
sym.setFlags(needsGotAuth ? (NEEDS_GOT | NEEDS_GOT_AUTH) : NEEDS_GOT);
11121112
} else if (needsGotAuth != static_cast<bool>(flags & NEEDS_GOT_AUTH)) {
1113-
fatal("both AUTH and non-AUTH GOT entries for '" + sym.getName() +
1114-
"' requested, but only one type of GOT entry per symbol is "
1115-
"supported");
1113+
Err(ctx) << "both AUTH and non-AUTH GOT entries for '" << sym.getName()
1114+
<< "' requested, but only one type of GOT entry per symbol is "
1115+
"supported"
1116+
<< getLocation(ctx, *sec, sym, offset);
11161117
}
11171118
}
11181119
} else if (needsPlt(expr)) {

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

Lines changed: 6 additions & 1 deletion
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)