Skip to content

Commit

Permalink
lief.ELF.ELF_CLASS was moved to lief.ELF.Header.CLASS
Browse files Browse the repository at this point in the history
in lief 0.15
  • Loading branch information
tkelman authored Jan 17, 2025
1 parent 022e6d1 commit f96a7ee
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions conda_build/os_utils/liefldd.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@
except AttributeError:
# Fallback for lief<0.15.
LOAD_COMMAND_TYPES = lief.MachO.LOAD_COMMAND_TYPES
try:
ELF_CLASS = lief.ELF.Header.CLASS
except AttributeError:
# Fallback for lief<0.15.
ELF_CLASS = lief.ELF.ELF_CLASS
except ImportError:
have_lief = False

Expand Down Expand Up @@ -199,8 +204,8 @@ def get_rpathy_thing_raw_partial(file, elf_attribute, elf_dyn_tag):
if binary_format == EXE_FORMATS.ELF:
binary_type = binary.type
if (
binary_type == lief.ELF.ELF_CLASS.CLASS32
or binary_type == lief.ELF.ELF_CLASS.CLASS64
binary_type == ELF_CLASS.CLASS32
or binary_type == ELF_CLASS.CLASS64
):
rpaths = _get_elf_rpathy_thing(binary, elf_attribute, elf_dyn_tag)
elif (
Expand Down Expand Up @@ -255,8 +260,8 @@ def set_rpath(old_matching, new_rpath, file):
if not binary:
return
if binary.format == EXE_FORMATS.ELF and (
binary.type == lief.ELF.ELF_CLASS.CLASS32
or binary.type == lief.ELF.ELF_CLASS.CLASS64
binary.type == ELF_CLASS.CLASS32
or binary.type == ELF_CLASS.CLASS64
):
if _set_elf_rpathy_thing(
binary, old_matching, new_rpath, set_rpath=True, set_runpath=False
Expand Down Expand Up @@ -344,7 +349,7 @@ def from_os_varnames(binary_format, binary_type, input_):
.replace("@rpath", "$RPATH")
)
elif binary_format == EXE_FORMATS.ELF:
if binary_type == lief.ELF.ELF_CLASS.CLASS64:
if binary_type == ELF_CLASS.CLASS64:
libdir = "/lib64"
else:
libdir = "/lib"
Expand All @@ -370,8 +375,8 @@ def get_uniqueness_key(filename, file):
elif binary.format == EXE_FORMATS.MACHO:
return filename
elif binary.format == EXE_FORMATS.ELF and ( # noqa
binary.type == lief.ELF.ELF_CLASS.CLASS32
or binary.type == lief.ELF.ELF_CLASS.CLASS64
binary.type == ELF_CLASS.CLASS32
or binary.type == ELF_CLASS.CLASS64
):
dynamic_entries = binary.dynamic_entries
result = [e.name for e in dynamic_entries if e.tag == ELF_DYNAMIC_TAGS.SONAME]
Expand Down Expand Up @@ -488,7 +493,7 @@ def inspect_linkages_lief(
if not binary:
default_paths = []
elif binary.format == EXE_FORMATS.ELF:
if binary.type == lief.ELF.ELF_CLASS.CLASS64:
if binary.type == ELF_CLASS.CLASS64:
default_paths = [
"$SYSROOT/lib64",
"$SYSROOT/usr/lib64",
Expand Down

0 comments on commit f96a7ee

Please sign in to comment.