mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 12:02:48 +01:00
merge bitcoin#23148: Fix guix linker-loader path and add check_ELF_interpreter
This commit is contained in:
parent
e39a1de731
commit
f2a5b472fd
@ -11,6 +11,7 @@ Example usage:
|
||||
find ../path/to/binaries -type f -executable | xargs python3 contrib/devtools/symbol-check.py
|
||||
'''
|
||||
import sys
|
||||
from typing import Dict
|
||||
|
||||
import lief
|
||||
|
||||
@ -66,6 +67,30 @@ IGNORE_EXPORTS = {
|
||||
'__cxa_demangle'
|
||||
}
|
||||
|
||||
# Expected linker-loader names can be found here:
|
||||
# https://sourceware.org/glibc/wiki/ABIList?action=recall&rev=16
|
||||
ELF_INTERPRETER_NAMES: Dict[lief.ELF.ARCH, Dict[lief.ENDIANNESS, str]] = {
|
||||
lief.ELF.ARCH.i386: {
|
||||
lief.ENDIANNESS.LITTLE: "/lib/ld-linux.so.2",
|
||||
},
|
||||
lief.ELF.ARCH.x86_64: {
|
||||
lief.ENDIANNESS.LITTLE: "/lib64/ld-linux-x86-64.so.2",
|
||||
},
|
||||
lief.ELF.ARCH.ARM: {
|
||||
lief.ENDIANNESS.LITTLE: "/lib/ld-linux-armhf.so.3",
|
||||
},
|
||||
lief.ELF.ARCH.AARCH64: {
|
||||
lief.ENDIANNESS.LITTLE: "/lib/ld-linux-aarch64.so.1",
|
||||
},
|
||||
lief.ELF.ARCH.PPC64: {
|
||||
lief.ENDIANNESS.BIG: "/lib64/ld64.so.1",
|
||||
lief.ENDIANNESS.LITTLE: "/lib64/ld64.so.2",
|
||||
},
|
||||
LIEF_ELF_ARCH_RISCV: {
|
||||
lief.ENDIANNESS.LITTLE: "/lib/ld-linux-riscv64-lp64d.so.1",
|
||||
},
|
||||
}
|
||||
|
||||
# Allowed NEEDED libraries
|
||||
ELF_ALLOWED_LIBRARIES = {
|
||||
# dashd and dash-qt
|
||||
@ -221,11 +246,17 @@ def check_PE_subsystem_version(binary) -> bool:
|
||||
return True
|
||||
return False
|
||||
|
||||
def check_ELF_interpreter(binary) -> bool:
|
||||
expected_interpreter = ELF_INTERPRETER_NAMES[binary.header.machine_type][binary.abstract.header.endianness]
|
||||
|
||||
return binary.concrete.interpreter == expected_interpreter
|
||||
|
||||
CHECKS = {
|
||||
lief.EXE_FORMATS.ELF: [
|
||||
('IMPORTED_SYMBOLS', check_imported_symbols),
|
||||
('EXPORTED_SYMBOLS', check_exported_symbols),
|
||||
('LIBRARY_DEPENDENCIES', check_ELF_libraries)
|
||||
('LIBRARY_DEPENDENCIES', check_ELF_libraries),
|
||||
('INTERPRETER_NAME', check_ELF_interpreter),
|
||||
],
|
||||
lief.EXE_FORMATS.MACHO: [
|
||||
('DYNAMIC_LIBRARIES', check_MACHO_libraries),
|
||||
|
@ -168,8 +168,8 @@ case "$HOST" in
|
||||
arm-linux-gnueabihf) echo /lib/ld-linux-armhf.so.3 ;;
|
||||
aarch64-linux-gnu) echo /lib/ld-linux-aarch64.so.1 ;;
|
||||
riscv64-linux-gnu) echo /lib/ld-linux-riscv64-lp64d.so.1 ;;
|
||||
powerpc64-linux-gnu) echo /lib/ld64.so.1;;
|
||||
powerpc64le-linux-gnu) echo /lib/ld64.so.2;;
|
||||
powerpc64-linux-gnu) echo /lib64/ld64.so.1;;
|
||||
powerpc64le-linux-gnu) echo /lib64/ld64.so.2;;
|
||||
*) exit 1 ;;
|
||||
esac
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user