[lld] 7e8a06c - [ELF] Make -z *-report=unknown error message conventional
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Fri Feb 28 23:53:33 PST 2025
Author: Fangrui Song
Date: 2025-02-28T23:53:28-08:00
New Revision: 7e8a06cfa4a2951b8ee77e19e34926e6e535b4d1
URL: https://github.com/llvm/llvm-project/commit/7e8a06cfa4a2951b8ee77e19e34926e6e535b4d1
DIFF: https://github.com/llvm/llvm-project/commit/7e8a06cfa4a2951b8ee77e19e34926e6e535b4d1.diff
LOG: [ELF] Make -z *-report=unknown error message conventional
Added:
Modified:
lld/ELF/Driver.cpp
lld/test/ELF/aarch64-bti-pac-cli-error.s
lld/test/ELF/aarch64-feature-bti.s
lld/test/ELF/aarch64-feature-pauth.s
lld/test/ELF/i386-feature-cet.s
lld/test/ELF/x86-64-feature-cet.s
Removed:
################################################################################
diff --git a/lld/ELF/Driver.cpp b/lld/ELF/Driver.cpp
index 70a293875f27b..862195098c1aa 100644
--- a/lld/ELF/Driver.cpp
+++ b/lld/ELF/Driver.cpp
@@ -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;
diff --git a/lld/test/ELF/aarch64-bti-pac-cli-error.s b/lld/test/ELF/aarch64-bti-pac-cli-error.s
index 703c0aac6ea5a..6355298fb788f 100644
--- a/lld/test/ELF/aarch64-bti-pac-cli-error.s
+++ b/lld/test/ELF/aarch64-bti-pac-cli-error.s
@@ -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
diff --git a/lld/test/ELF/aarch64-feature-bti.s b/lld/test/ELF/aarch64-feature-bti.s
index e4768dff0e69d..8d7c1f2826c17 100644
--- a/lld/test/ELF/aarch64-feature-bti.s
+++ b/lld/test/ELF/aarch64-feature-bti.s
@@ -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
diff --git a/lld/test/ELF/aarch64-feature-pauth.s b/lld/test/ELF/aarch64-feature-pauth.s
index c50f38f4a7c97..bc58f69d32f2b 100644
--- a/lld/test/ELF/aarch64-feature-pauth.s
+++ b/lld/test/ELF/aarch64-feature-pauth.s
@@ -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"
diff --git a/lld/test/ELF/i386-feature-cet.s b/lld/test/ELF/i386-feature-cet.s
index d748a98e997c7..a7de05a1870dc 100644
--- a/lld/test/ELF/i386-feature-cet.s
+++ b/lld/test/ELF/i386-feature-cet.s
@@ -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 \
diff --git a/lld/test/ELF/x86-64-feature-cet.s b/lld/test/ELF/x86-64-feature-cet.s
index cf90d9708e119..6a88463ff8bfd 100644
--- a/lld/test/ELF/x86-64-feature-cet.s
+++ b/lld/test/ELF/x86-64-feature-cet.s
@@ -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 \
More information about the llvm-commits
mailing list