Skip to content

Commit 3d28626

Browse files
committed
add test which assert that import list for executable not changed silently
1 parent dda102c commit 3d28626

File tree

6 files changed

+215
-0
lines changed

6 files changed

+215
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# only-x86_64-pc-windows-msvc
2+
3+
include ../tools.mk
4+
5+
# assert that import list for simple executable not changed silently
6+
# FIXME: remove "File:" from diff by making path reproducible: now it's broken
7+
8+
all:
9+
$(RUSTC) empty.rs
10+
"$(LLVM_BIN_DIR)"/llvm-readobj --coff-imports $(TMPDIR)/empty.exe > "$(TMPDIR)/actual.empty.txt"
11+
diff -u -I "File:" -I "ImportLookupTableRVA:" -I "ImportAddressTableRVA:" expected.empty.txt "$(TMPDIR)/actual.empty.txt"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
2+
File: empty.exe
3+
Format: COFF-x86-64
4+
Arch: x86_64
5+
AddressSize: 64bit
6+
Import {
7+
Name: KERNEL32.dll
8+
ImportLookupTableRVA: 0x207C0
9+
ImportAddressTableRVA: 0x19000
10+
Symbol: GetLastError (619)
11+
Symbol: AddVectoredExceptionHandler (19)
12+
Symbol: SetThreadStackGuarantee (1408)
13+
Symbol: WaitForSingleObject (1528)
14+
Symbol: QueryPerformanceCounter (1115)
15+
Symbol: AcquireSRWLockExclusive (0)
16+
Symbol: RtlCaptureContext (1247)
17+
Symbol: RtlVirtualUnwind (1262)
18+
Symbol: RtlLookupFunctionEntry (1255)
19+
Symbol: SetLastError (1357)
20+
Symbol: GetCurrentDirectoryW (539)
21+
Symbol: GetEnvironmentVariableW (580)
22+
Symbol: GetCurrentProcess (545)
23+
Symbol: GetStdHandle (737)
24+
Symbol: GetCurrentProcessId (546)
25+
Symbol: TryAcquireSRWLockExclusive (1477)
26+
Symbol: HeapFree (862)
27+
Symbol: HeapReAlloc (865)
28+
Symbol: AcquireSRWLockShared (1)
29+
Symbol: ReleaseSRWLockShared (1219)
30+
Symbol: ReleaseMutex (1216)
31+
Symbol: GetModuleHandleA (639)
32+
Symbol: GetProcAddress (700)
33+
Symbol: GetProcessHeap (707)
34+
Symbol: GetConsoleMode (518)
35+
Symbol: GetModuleHandleW (642)
36+
Symbol: MultiByteToWideChar (1023)
37+
Symbol: WriteConsoleW (1586)
38+
Symbol: GetCurrentThread (549)
39+
Symbol: GetSystemTimeAsFileTime (760)
40+
Symbol: WaitForSingleObjectEx (1529)
41+
Symbol: LoadLibraryA (977)
42+
Symbol: CreateMutexA (218)
43+
Symbol: ReleaseSRWLockExclusive (1218)
44+
Symbol: HeapAlloc (858)
45+
Symbol: CloseHandle (137)
46+
Symbol: SetUnhandledExceptionFilter (1421)
47+
Symbol: UnhandledExceptionFilter (1486)
48+
Symbol: IsDebuggerPresent (910)
49+
Symbol: InitializeSListHead (888)
50+
Symbol: GetCurrentThreadId (550)
51+
Symbol: IsProcessorFeaturePresent (917)
52+
}
53+
Import {
54+
Name: ntdll.dll
55+
ImportLookupTableRVA: 0x20A50
56+
ImportAddressTableRVA: 0x19290
57+
Symbol: RtlNtStatusToDosError (1294)
58+
Symbol: NtWriteFile (665)
59+
}
60+
Import {
61+
Name: VCRUNTIME140.dll
62+
ImportLookupTableRVA: 0x20918
63+
ImportAddressTableRVA: 0x19158
64+
Symbol: __current_exception_context (28)
65+
Symbol: __current_exception (27)
66+
Symbol: __C_specific_handler (8)
67+
Symbol: _CxxThrowException (1)
68+
Symbol: memcmp (59)
69+
Symbol: memmove (61)
70+
Symbol: memset (62)
71+
Symbol: memcpy (60)
72+
Symbol: __CxxFrameHandler3 (14)
73+
}
74+
Import {
75+
Name: api-ms-win-crt-runtime-l1-1-0.dll
76+
ImportLookupTableRVA: 0x209A0
77+
ImportAddressTableRVA: 0x191E0
78+
Symbol: _initterm_e (55)
79+
Symbol: exit (85)
80+
Symbol: _exit (35)
81+
Symbol: _initterm (54)
82+
Symbol: _get_initial_narrow_environment (40)
83+
Symbol: __p___argc (4)
84+
Symbol: __p___argv (5)
85+
Symbol: _cexit (22)
86+
Symbol: _c_exit (21)
87+
Symbol: _register_thread_local_exe_atexit_callback (61)
88+
Symbol: _configure_narrow_argv (24)
89+
Symbol: _set_app_type (66)
90+
Symbol: _initialize_narrow_environment (51)
91+
Symbol: _initialize_onexit_table (52)
92+
Symbol: _register_onexit_function (60)
93+
Symbol: _crt_atexit (30)
94+
Symbol: terminate (103)
95+
Symbol: _seh_filter_exe (64)
96+
}
97+
Import {
98+
Name: api-ms-win-crt-math-l1-1-0.dll
99+
ImportLookupTableRVA: 0x20990
100+
ImportAddressTableRVA: 0x191D0
101+
Symbol: __setusermatherr (9)
102+
}
103+
Import {
104+
Name: api-ms-win-crt-stdio-l1-1-0.dll
105+
ImportLookupTableRVA: 0x20A38
106+
ImportAddressTableRVA: 0x19278
107+
Symbol: _set_fmode (84)
108+
Symbol: __p__commode (1)
109+
}
110+
Import {
111+
Name: api-ms-win-crt-locale-l1-1-0.dll
112+
ImportLookupTableRVA: 0x20980
113+
ImportAddressTableRVA: 0x191C0
114+
Symbol: _configthreadlocale (8)
115+
}
116+
Import {
117+
Name: api-ms-win-crt-heap-l1-1-0.dll
118+
ImportLookupTableRVA: 0x20968
119+
ImportAddressTableRVA: 0x191A8
120+
Symbol: free (24)
121+
Symbol: _set_new_mode (22)
122+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# only-x86_64-unknown-linux-gnu
2+
3+
include ../tools.mk
4+
5+
# assert that import list for simple executable not changed silently
6+
# FIXME: remove "file format elf64-x86-64" from diff by making path reproducible: now it's broken
7+
# "diff -b" space/tab number unstable, ignore it
8+
9+
all:
10+
$(RUSTC) empty.rs
11+
"$(LLVM_BIN_DIR)"/llvm-objdump --dynamic-syms $(TMPDIR)/empty > "$(TMPDIR)/actual.empty.txt"
12+
diff -u -b -I "file format elf64-x86-64" expected.empty.txt "$(TMPDIR)/actual.empty.txt"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
2+
empty: file format elf64-x86-64
3+
4+
DYNAMIC SYMBOL TABLE:
5+
0000000000000000 DF *UND* 0000000000000000 (GLIBC_2.2.5) getenv
6+
0000000000000000 DF *UND* 0000000000000000 (GLIBC_2.2.5) dl_iterate_phdr
7+
0000000000000000 DF *UND* 0000000000000000 (GLIBC_2.2.5) free
8+
0000000000000000 DF *UND* 0000000000000000 (GLIBC_2.34) __libc_start_main
9+
0000000000000000 DF *UND* 0000000000000000 (GLIBC_2.2.5) abort
10+
0000000000000000 DF *UND* 0000000000000000 (GCC_3.3) _Unwind_Backtrace
11+
0000000000000000 DF *UND* 0000000000000000 (GLIBC_2.2.5) __errno_location
12+
0000000000000000 w D *UND* 0000000000000000 _ITM_deregisterTMCloneTable
13+
0000000000000000 DF *UND* 0000000000000000 (GLIBC_2.2.5) writev
14+
0000000000000000 DF *UND* 0000000000000000 (GLIBC_2.32) pthread_getattr_np
15+
0000000000000000 DF *UND* 0000000000000000 (GLIBC_2.2.5) sigaction
16+
0000000000000000 w DF *UND* 0000000000000000 (GLIBC_2.18) __cxa_thread_atexit_impl
17+
0000000000000000 DF *UND* 0000000000000000 (GLIBC_2.3.4) __xpg_strerror_r
18+
0000000000000000 DF *UND* 0000000000000000 (GLIBC_2.34) pthread_getspecific
19+
0000000000000000 DF *UND* 0000000000000000 (GLIBC_2.2.5) readlink
20+
0000000000000000 DF *UND* 0000000000000000 (GLIBC_2.2.5) fcntl
21+
0000000000000000 DF *UND* 0000000000000000 (GCC_3.0) _Unwind_GetRegionStart
22+
0000000000000000 DF *UND* 0000000000000000 (GLIBC_2.2.5) write
23+
0000000000000000 DF *UND* 0000000000000000 (GCC_3.0) _Unwind_GetTextRelBase
24+
0000000000000000 DF *UND* 0000000000000000 (GCC_3.0) _Unwind_RaiseException
25+
0000000000000000 DF *UND* 0000000000000000 (GLIBC_2.2.5) strlen
26+
0000000000000000 DF *UND* 0000000000000000 (GLIBC_2.33) stat64
27+
0000000000000000 DF *UND* 0000000000000000 (GLIBC_2.34) pthread_key_create
28+
0000000000000000 DF *UND* 0000000000000000 (GLIBC_2.2.5) memset
29+
0000000000000000 DF *UND* 0000000000000000 (GLIBC_2.2.5) getcwd
30+
0000000000000000 DF *UND* 0000000000000000 (GCC_4.2.0) _Unwind_GetIPInfo
31+
0000000000000000 DF *UND* 0000000000000000 (GLIBC_2.2.5) close
32+
0000000000000000 DF *UND* 0000000000000000 (GCC_3.0) _Unwind_GetLanguageSpecificData
33+
0000000000000000 DF *UND* 0000000000000000 (GLIBC_2.34) pthread_key_delete
34+
0000000000000000 DF *UND* 0000000000000000 (GLIBC_2.2.5) read
35+
0000000000000000 DF *UND* 0000000000000000 (GLIBC_2.3) __tls_get_addr
36+
0000000000000000 DF *UND* 0000000000000000 (GLIBC_2.2.5) calloc
37+
0000000000000000 DF *UND* 0000000000000000 (GLIBC_2.2.5) signal
38+
0000000000000000 DF *UND* 0000000000000000 (GLIBC_2.2.5) syscall
39+
0000000000000000 DF *UND* 0000000000000000 (GLIBC_2.34) pthread_attr_getstack
40+
0000000000000000 w D *UND* 0000000000000000 __gmon_start__
41+
0000000000000000 DF *UND* 0000000000000000 (GLIBC_2.3) realpath
42+
0000000000000000 DF *UND* 0000000000000000 (GLIBC_2.14) memcpy
43+
0000000000000000 DF *UND* 0000000000000000 (GCC_3.0) _Unwind_GetIP
44+
0000000000000000 DF *UND* 0000000000000000 (GLIBC_2.2.5) mmap64
45+
0000000000000000 DF *UND* 0000000000000000 (GLIBC_2.2.5) malloc
46+
0000000000000000 DF *UND* 0000000000000000 (GLIBC_2.2.5) bcmp
47+
0000000000000000 DF *UND* 0000000000000000 (GLIBC_2.2.5) realloc
48+
0000000000000000 DF *UND* 0000000000000000 (GLIBC_2.2.5) munmap
49+
0000000000000000 w DF *UND* 0000000000000000 (GLIBC_2.28) statx
50+
0000000000000000 DF *UND* 0000000000000000 (GCC_3.0) _Unwind_GetDataRelBase
51+
0000000000000000 DF *UND* 0000000000000000 (GLIBC_2.2.5) poll
52+
0000000000000000 DF *UND* 0000000000000000 (GCC_3.0) _Unwind_SetGR
53+
0000000000000000 DF *UND* 0000000000000000 (GLIBC_2.2.5) open64
54+
0000000000000000 DF *UND* 0000000000000000 (GLIBC_2.2.5) memmove
55+
0000000000000000 DF *UND* 0000000000000000 (GLIBC_2.2.5) pthread_self
56+
0000000000000000 DF *UND* 0000000000000000 (GLIBC_2.2.5) mprotect
57+
0000000000000000 DF *UND* 0000000000000000 (GLIBC_2.2.5) sysconf
58+
0000000000000000 DF *UND* 0000000000000000 (GLIBC_2.2.5) pthread_attr_destroy
59+
0000000000000000 DF *UND* 0000000000000000 (GLIBC_2.2.5) lseek64
60+
0000000000000000 DF *UND* 0000000000000000 (GLIBC_2.33) fstat64
61+
0000000000000000 DF *UND* 0000000000000000 (GLIBC_2.2.5) posix_memalign
62+
0000000000000000 w D *UND* 0000000000000000 _ITM_registerTMCloneTable
63+
0000000000000000 DF *UND* 0000000000000000 (GCC_3.0) _Unwind_DeleteException
64+
0000000000000000 DF *UND* 0000000000000000 (GLIBC_2.2.5) sigaltstack
65+
0000000000000000 DF *UND* 0000000000000000 (GCC_3.0) _Unwind_Resume
66+
0000000000000000 DF *UND* 0000000000000000 (GLIBC_2.34) pthread_setspecific
67+
0000000000000000 DF *UND* 0000000000000000 (GCC_3.0) _Unwind_SetIP
68+
0000000000000000 w DF *UND* 0000000000000000 (GLIBC_2.2.5) __cxa_finalize

0 commit comments

Comments
 (0)