Skip to content

Commit

Permalink
merge bitcoin#24561: use LIEF 0.12.0
Browse files Browse the repository at this point in the history
  • Loading branch information
kwvg committed May 13, 2023
1 parent b015e37 commit 891608e
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 25 deletions.
2 changes: 1 addition & 1 deletion contrib/containers/ci/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ RUN pip3 install \
codespell==1.17.1 \
flake8==3.8.3 \
jinja2 \
lief==0.11.5 \
lief==0.12.0 \
pyzmq \
vulture==2.3 \
yq \
Expand Down
16 changes: 4 additions & 12 deletions contrib/devtools/security-check.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,6 @@

import lief

# temporary constant, to be replaced with lief.ELF.ARCH.RISCV
# https://github.com/lief-project/LIEF/pull/562
LIEF_ELF_ARCH_RISCV = lief.ELF.ARCH(243)

def check_ELF_RELRO(binary) -> bool:
'''
Check for read-only relocations.
Expand Down Expand Up @@ -101,7 +97,6 @@ def check_ELF_separate_code(binary):
for segment in binary.segments:
if segment.type == lief.ELF.SEGMENT_TYPES.LOAD:
for section in segment.sections:
assert(section.name not in flags_per_section)
flags_per_section[section.name] = segment.flags
# Spot-check ELF LOAD program header flags per section
# If these sections exist, check them against the expected R/W/E flags
Expand Down Expand Up @@ -225,7 +220,7 @@ def check_MACHO_control_flow(binary) -> bool:
lief.ARCHITECTURES.ARM: BASE_ELF,
lief.ARCHITECTURES.ARM64: BASE_ELF,
lief.ARCHITECTURES.PPC: BASE_ELF,
LIEF_ELF_ARCH_RISCV: BASE_ELF,
lief.ARCHITECTURES.RISCV: BASE_ELF,
},
lief.EXE_FORMATS.PE: {
lief.ARCHITECTURES.X86: BASE_PE,
Expand All @@ -250,12 +245,9 @@ def check_MACHO_control_flow(binary) -> bool:
continue

if arch == lief.ARCHITECTURES.NONE:
if binary.header.machine_type == LIEF_ELF_ARCH_RISCV:
arch = LIEF_ELF_ARCH_RISCV
else:
print(f'{filename}: unknown architecture')
retval = 1
continue
print(f'{filename}: unknown architecture')
retval = 1
continue

failed: List[str] = []
for (name, func) in CHECKS[etype][arch]:
Expand Down
10 changes: 3 additions & 7 deletions contrib/devtools/symbol-check.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@

import lief

# temporary constant, to be replaced with lief.ELF.ARCH.RISCV
# https://github.com/lief-project/LIEF/pull/562
LIEF_ELF_ARCH_RISCV = lief.ELF.ARCH(243)

# Debian 9 (Stretch) EOL: 2022. https://wiki.debian.org/DebianReleases#Production_Releases
#
# - g++ version 6.3.0 (https://packages.debian.org/search?suite=stretch&arch=any&searchon=names&keywords=g%2B%2B)
Expand All @@ -44,7 +40,7 @@
lief.ELF.ARCH.ARM: (2,18),
lief.ELF.ARCH.AARCH64:(2,18),
lief.ELF.ARCH.PPC64: (2,18),
LIEF_ELF_ARCH_RISCV: (2,27),
lief.ELF.ARCH.RISCV: (2,27),
},
'LIBATOMIC': (1,0),
'V': (0,5,0), # xkb (bitcoin-qt only)
Expand Down Expand Up @@ -78,7 +74,7 @@
lief.ENDIANNESS.BIG: "/lib64/ld64.so.1",
lief.ENDIANNESS.LITTLE: "/lib64/ld64.so.2",
},
LIEF_ELF_ARCH_RISCV: {
lief.ELF.ARCH.RISCV: {
lief.ENDIANNESS.LITTLE: "/lib/ld-linux-riscv64-lp64d.so.1",
},
}
Expand Down Expand Up @@ -188,7 +184,7 @@ def check_exported_symbols(binary) -> bool:
if not symbol.exported:
continue
name = symbol.name
if binary.header.machine_type == LIEF_ELF_ARCH_RISCV or name in IGNORE_EXPORTS:
if binary.header.machine_type == lief.ELF.ARCH.RISCV or name in IGNORE_EXPORTS:
continue
print(f'{binary.name}: export of symbol {name} not allowed!')
ok = False
Expand Down
2 changes: 1 addition & 1 deletion contrib/gitian-descriptors/gitian-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ script: |
done
}
pip3 install lief==0.11.5
pip3 install lief==0.12.0
# Faketime for depends so intermediate results are comparable
export PATH_orig=${PATH}
Expand Down
2 changes: 1 addition & 1 deletion contrib/gitian-descriptors/gitian-osx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ script: |
done
}
pip3 install lief==0.11.5
pip3 install lief==0.12.0
# Faketime for depends so intermediate results are comparable
export PATH_orig=${PATH}
Expand Down
2 changes: 1 addition & 1 deletion contrib/gitian-descriptors/gitian-win.yml
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ script: |
done
}
pip3 install lief==0.11.5
pip3 install lief==0.12.0
# Faketime for depends so intermediate results are comparable
export PATH_orig=${PATH}
Expand Down
4 changes: 2 additions & 2 deletions contrib/guix/manifest.scm
Original file line number Diff line number Diff line change
Expand Up @@ -587,7 +587,7 @@ inspecting signatures in Mach-O binaries.")
(define-public lief
(package
(name "python-lief")
(version "0.11.5")
(version "0.12.0")
(source
(origin
(method git-fetch)
Expand All @@ -597,7 +597,7 @@ inspecting signatures in Mach-O binaries.")
(file-name (git-file-name name version))
(sha256
(base32
"0qahjfg1n0x76ps2mbyljvws1l3qhkqvmxqbahps4qgywl2hbdkj"))))
"026jchj56q25v6gc0754dj9cj5hz5zaza8ij93y5ga94w20kzm9q"))))
(build-system python-build-system)
(native-inputs
`(("cmake" ,cmake)))
Expand Down

0 comments on commit 891608e

Please sign in to comment.