[ELF] Make -z *-report=unknown error message conventional

This commit is contained in:
Fangrui Song 2025-02-28 23:53:28 -08:00
parent cab738bea1
commit 7e8a06cfa4
6 changed files with 12 additions and 10 deletions

View File

@ -1632,8 +1632,8 @@ static void readConfigs(Ctx &ctx, opt::InputArgList &args) {
continue;
arg->claim();
if (!isValidReportString(option.second)) {
ErrAlways(ctx) << "-z " << reportArg.first << "= parameter "
<< option.second << " is not recognized";
ErrAlways(ctx) << "unknown -z " << reportArg.first
<< "= value: " << option.second;
continue;
}
*reportArg.second = option.second;

View File

@ -13,11 +13,5 @@
# CHECK-NEXT: error: -z bti-report only supported on AArch64
# CHECK-NEXT: error: -z pauth-report only supported on AArch64
# RUN: not ld.lld -z bti-report=something -z pauth-report=something \
# RUN: %t.o -o /dev/null 2>&1 | FileCheck --check-prefix=REPORT_INVALID %s
# REPORT_INVALID: error: -z bti-report= parameter something is not recognized
# REPORT_INVALID: error: -z pauth-report= parameter something is not recognized
# REPORT_INVALID-EMPTY:
.globl start
start: ret

View File

@ -258,6 +258,10 @@
# FORCE-NEXT: nop
# FORCE-NEXT: nop
# RUN: not ld.lld %t.o -z bti-report=u -o /dev/null 2>&1 | FileCheck --check-prefix=REPORT-ERR %s
# REPORT-ERR: error: unknown -z bti-report= value: u{{$}}
# REPORT-EMPTY:
.section ".note.gnu.property", "a"
.long 4
.long 0x10

View File

@ -83,6 +83,10 @@
# HINT-NEXT: br x17
# PACPLT-NEXT: nop
# RUN: not ld.lld tag1.o -z pauth-report=u 2>&1 | FileCheck --check-prefix=REPORT-ERR %s
# REPORT-ERR: error: unknown -z pauth-report= value: u{{$}}
# REPORT-EMPTY:
#--- abi-tag-short.s
.section ".note.gnu.property", "a"

View File

@ -25,7 +25,7 @@
# RUN: not ld.lld -e func1 %t.o %t3.o -o /dev/null -z cet-report=something 2>&1 \
# RUN: | FileCheck --check-prefix=REPORT_INVALID %s
# REPORT_INVALID: error: -z cet-report= parameter something is not recognized
# REPORT_INVALID: error: unknown -z cet-report= value: something
# REPORT_INVALID-EMPTY:
# RUN: ld.lld -e func1 %t.o %t3.o -o /dev/null -z cet-report=warning 2>&1 \

View File

@ -25,7 +25,7 @@
# RUN:not ld.lld -e func1 %t.o %t3.o -o /dev/null -z cet-report=something 2>&1 \
# RUN: | FileCheck --check-prefix=REPORT_INVALID %s
# REPORT_INVALID: error: -z cet-report= parameter something is not recognized
# REPORT_INVALID: error: unknown -z cet-report= value: something
# REPORT_INVALID-EMPTY:
# RUN: ld.lld -e func1 %t.o %t3.o -o /dev/null -z force-ibt -z cet-report=warning 2>&1 \