-
Notifications
You must be signed in to change notification settings - Fork 14.7k
[llvm-readobj][COFF] Improve extended DLL characteristics test #151978
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
@llvm/pr-subscribers-llvm-binary-utilities Author: None (kkent030315) ChangesAs mentioned in this comment (#150967), this PR removes the need for the input binary by replacing it with a yaml2obj-generated file. Full diff: https://github.com/llvm/llvm-project/pull/151978.diff 3 Files Affected:
diff --git a/llvm/test/tools/llvm-readobj/COFF/Inputs/has-exdllcharacteristics.exe b/llvm/test/tools/llvm-readobj/COFF/Inputs/has-exdllcharacteristics.exe
deleted file mode 100644
index 9c36817b6a474..0000000000000
Binary files a/llvm/test/tools/llvm-readobj/COFF/Inputs/has-exdllcharacteristics.exe and /dev/null differ
diff --git a/llvm/test/tools/llvm-readobj/COFF/Inputs/has-exdllcharacteristics.yaml b/llvm/test/tools/llvm-readobj/COFF/Inputs/has-exdllcharacteristics.yaml
new file mode 100644
index 0000000000000..3ee7fbe657555
--- /dev/null
+++ b/llvm/test/tools/llvm-readobj/COFF/Inputs/has-exdllcharacteristics.yaml
@@ -0,0 +1,75 @@
+--- !COFF
+OptionalHeader:
+ AddressOfEntryPoint: 0
+ ImageBase: 0x180000000
+ SectionAlignment: 4096
+ FileAlignment: 512
+ MajorOperatingSystemVersion: 6
+ MinorOperatingSystemVersion: 0
+ MajorImageVersion: 0
+ MinorImageVersion: 0
+ MajorSubsystemVersion: 6
+ MinorSubsystemVersion: 0
+ Subsystem: IMAGE_SUBSYSTEM_WINDOWS_CUI
+ DLLCharacteristics: [ IMAGE_DLL_CHARACTERISTICS_HIGH_ENTROPY_VA, IMAGE_DLL_CHARACTERISTICS_DYNAMIC_BASE, IMAGE_DLL_CHARACTERISTICS_NX_COMPAT, IMAGE_DLL_CHARACTERISTICS_TERMINAL_SERVER_AWARE ]
+ SizeOfStackReserve: 1048576
+ SizeOfStackCommit: 4096
+ SizeOfHeapReserve: 1048576
+ SizeOfHeapCommit: 4096
+ ExportTable:
+ RelativeVirtualAddress: 0
+ Size: 0
+ ImportTable:
+ RelativeVirtualAddress: 0
+ Size: 0
+ ResourceTable:
+ RelativeVirtualAddress: 0
+ Size: 0
+ ExceptionTable:
+ RelativeVirtualAddress: 0
+ Size: 0
+ CertificateTable:
+ RelativeVirtualAddress: 0
+ Size: 0
+ BaseRelocationTable:
+ RelativeVirtualAddress: 0
+ Size: 0
+ Debug:
+ RelativeVirtualAddress: 8192
+ Size: 56
+ Architecture:
+ RelativeVirtualAddress: 0
+ Size: 0
+ GlobalPtr:
+ RelativeVirtualAddress: 0
+ Size: 0
+ TlsTable:
+ RelativeVirtualAddress: 0
+ Size: 0
+ LoadConfigTable:
+ RelativeVirtualAddress: 0
+ Size: 0
+ BoundImport:
+ RelativeVirtualAddress: 0
+ Size: 0
+ IAT:
+ RelativeVirtualAddress: 0
+ Size: 0
+ DelayImportDescriptor:
+ RelativeVirtualAddress: 0
+ Size: 0
+ ClrRuntimeHeader:
+ RelativeVirtualAddress: 0
+ Size: 0
+header:
+ Machine: IMAGE_FILE_MACHINE_AMD64
+ Characteristics: [ IMAGE_FILE_EXECUTABLE_IMAGE, IMAGE_FILE_DLL, IMAGE_FILE_LARGE_ADDRESS_AWARE ]
+sections:
+ - Name: .rdata
+ Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ ]
+ VirtualAddress: 8192
+ VirtualSize: 180
+ SectionData: 0000000091BE906800000000020000005500000058200000580400000000000091BE9068000000001400000004000000B0200000B0040000180000000380038000000000000000005020000008000000101000000300000052534453867E6BCADB53244591DEC582FAB540DB10000000433A5C55736572735C73756E675C446F63756D656E74735C636F64655C636574657865635C7836345C52656C656173655C636574657865632E706462000000008F000000
+ SizeOfRawData: 512
+symbols: []
+...
diff --git a/llvm/test/tools/llvm-readobj/COFF/exdllcharacteristics.test b/llvm/test/tools/llvm-readobj/COFF/exdllcharacteristics.test
index ef35aea50171a..13bd6159bfd88 100644
--- a/llvm/test/tools/llvm-readobj/COFF/exdllcharacteristics.test
+++ b/llvm/test/tools/llvm-readobj/COFF/exdllcharacteristics.test
@@ -1,9 +1,5 @@
-# To regenerate has-exdllcharacteristics.exe
-# $ echo int main() { return 0; } > has-exdllcharacteristics.c
-# To make minimum possible stub file (to decrease the binary size)
-# $ echo -n '4D5A00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000' | xxd -r -p > stub
-# $ cl has-exdllcharacteristics.c /link /entry:main /STUB:stub /NOCOFFGRPINFO /EMITTOOLVERSIONINFO:NO /EMITPOGOPHASEINFO /NOVCFEATURE /MANIFEST:NO /cetcompat /cetcompatstrict /cetdynamicapisinproc /cetipvalidationrelaxed /hotpatchcompatible /functionpadmin:6
-RUN: llvm-readobj --coff-debug-directory %p/Inputs/has-exdllcharacteristics.exe | FileCheck %s
+RUN: yaml2obj %p/Inputs/has-exdllcharacteristics.yaml > %t.obj
+RUN: llvm-readobj --coff-debug-directory %t.obj | FileCheck %s
CHECK: DebugEntry {
CHECK: Characteristics: 0x0
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks generally good, thanks! One minor comment+question.
As mentioned in this comment (#150967), this PR removes the need for the input binary by replacing it with a yaml2obj-generated file.