[lld] [llvm] [LLD][COFF] Add more variety of CET and hotpatch flags (PR #150761)
Martin Storsjö via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 30 01:09:45 PDT 2025
================
@@ -0,0 +1,33 @@
+RUN: yaml2obj %p/Inputs/ret42.yaml -o %t.obj
+RUN: lld-link /out:%t.exe /entry:main /hotpatchcompatible /functionpadmin:6 %t.obj
+RUN: llvm-readobj --coff-debug-directory %t.exe | FileCheck -check-prefix=CHECK1 %s
+
+CHECK1: DebugEntry {
+CHECK1: Characteristics: 0x0
+CHECK1: Type: ExtendedDLLCharacteristics (0x14)
+CHECK1: ExtendedCharacteristics [ (0x80)
+CHECK1: IMAGE_DLL_CHARACTERISTICS_EX_HOTPATCH_COMPATIBLE (0x80)
+CHECK1: ]
+CHECK1: RawData (
+CHECK1: 0000: 80000000 |....|
+CHECK1: )
+CHECK1: }
+
+// ---- more than 6 bytes is accepted
+RUN: lld-link /out:%t.exe /entry:main /hotpatchcompatible /functionpadmin:10 %t.obj
+RUN: llvm-readobj --coff-debug-directory %t.exe | FileCheck -check-prefix=CHECK2 %s
+
+CHECK2: DebugEntry {
+CHECK2: Characteristics: 0x0
+CHECK2: Type: ExtendedDLLCharacteristics (0x14)
+CHECK2: ExtendedCharacteristics [ (0x80)
+CHECK2: IMAGE_DLL_CHARACTERISTICS_EX_HOTPATCH_COMPATIBLE (0x80)
+CHECK2: ]
+CHECK2: RawData (
+CHECK2: 0000: 80000000 |....|
+CHECK2: )
+CHECK2: }
+
+// ---- hotpach compatible image requires at least 6 bytes function padding
+RUN: not lld-link /out:%t.exe /entry:main /hotpatchcompatible /functionpadmin:5 %t.obj
----------------
mstorsjo wrote:
This `RUN` line seems to lack a `FileCheck` invocation, actually checking the error message below.
For reasons relating to how lld is invoked in the tests, you may need to wrap it in `env LLD_IN_TEST=1 not lld-link ... 2>&1 | FileCheck` to get the error message output available for checking.
https://github.com/llvm/llvm-project/pull/150761
More information about the llvm-commits
mailing list