1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00
cdt/releng/scripts/check_dll_dependencies.sh
Jonah Graham a588063b23 Bug 521515: Automatically check .so, .dll, .exe files for valid deps
Because we build cross platform, we want to make sure no unexpected
dependencies are introduced on newer or non-universal libraries
in the native code.

Change-Id: Ib8ffeb5f374bcd04514c31dca9d8297fed70343a
2020-08-18 21:43:21 -04:00

23 lines
821 B
Bash
Executable file

#!/bin/bash
set -eu
# This is the current set of allowed DLL dependencies for CDT code. Additional entries here are permitted,
# provided they are found on all Windows machines by default.
ALLOWED_DLLS="KERNEL32.DLL MSVCRT.DLL USER32.DLL PSAPI.DLL SHELL32.DLL ADVAPI32.DLL"
# In addition, the WINPTY.DLL is something CDT ships so is allowed to be a dependency
ALLOWED_DLLS+=" WINPTY.DLL"
exit_code=0
while read line; do
while read import; do
dllname=${import//DLL Name: /}
dllname_upper=${dllname^^}
if [[ ! " ${ALLOWED_DLLS} " =~ " ${dllname_upper} " ]]; then
echo "ERROR: $line has illegal import of ${dllname}"
exit_code=1
fi
done <<<$(x86_64-w64-mingw32-objdump -p $line | grep "DLL Name")
done <<<$(git ls-files -- \*.exe \*.dll)
exit ${exit_code}