Use objdump for dll dependencies (#18027)

This commit is contained in:
Kai Pastor 2021-06-02 06:32:19 +02:00 committed by GitHub
parent 835f1613b5
commit 3394bed96e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -90,8 +90,10 @@ function resolve([string]$targetBinary) {
$a = $(dumpbin /DEPENDENTS $targetBinary | ? { $_ -match "^ [^ ].*\.dll" } | % { $_ -replace "^ ","" }) $a = $(dumpbin /DEPENDENTS $targetBinary | ? { $_ -match "^ [^ ].*\.dll" } | % { $_ -replace "^ ","" })
} elseif (Get-Command "llvm-objdump" -ErrorAction SilentlyContinue) { } elseif (Get-Command "llvm-objdump" -ErrorAction SilentlyContinue) {
$a = $(llvm-objdump -p $targetBinary| ? { $_ -match "^ {4}DLL Name: .*\.dll" } | % { $_ -replace "^ {4}DLL Name: ","" }) $a = $(llvm-objdump -p $targetBinary| ? { $_ -match "^ {4}DLL Name: .*\.dll" } | % { $_ -replace "^ {4}DLL Name: ","" })
} elseif (Get-Command "objdump" -ErrorAction SilentlyContinue) {
$a = $(objdump -p $targetBinary| ? { $_ -match "^\tDLL Name: .*\.dll" } | % { $_ -replace "^\tDLL Name: ","" })
} else { } else {
Write-Error "Neither dumpbin nor llvm-objdump could be found. Can not take care of dll dependencies." Write-Error "Neither dumpbin, llvm-objdump nor objdump could be found. Can not take care of dll dependencies."
} }
$a | % { $a | % {
if ([string]::IsNullOrEmpty($_)) { if ([string]::IsNullOrEmpty($_)) {