5050 # Fallback for lief<0.15.
5151 LOAD_COMMAND_TYPES = lief .MachO .LOAD_COMMAND_TYPES
5252 try :
53- ELF_CLASS = lief .ELF .Header .CLASS
53+ ELF64 = lief .ELF .Header .CLASS .ELF64
54+ ELF32 = lief .ELF .Header .CLASS .ELF32
5455 except AttributeError :
5556 # Fallback for lief<0.15.
56- ELF_CLASS = lief .ELF .ELF_CLASS
57+ ELF64 = lief .ELF .ELF64
58+ ELF32 = lief .ELF .ELF_CLASS .CLASS32
59+
60+
5761except ImportError :
5862 have_lief = False
5963
@@ -203,7 +207,7 @@ def get_rpathy_thing_raw_partial(file, elf_attribute, elf_dyn_tag):
203207 binary_format = binary .format
204208 if binary_format == EXE_FORMATS .ELF :
205209 binary_type = binary .type
206- if binary_type == ELF_CLASS . CLASS32 or binary_type == ELF_CLASS . CLASS64 :
210+ if binary_type == ELF32 or binary_type == ELF64 :
207211 rpaths = _get_elf_rpathy_thing (binary , elf_attribute , elf_dyn_tag )
208212 elif (
209213 binary_format == EXE_FORMATS .MACHO
@@ -257,7 +261,7 @@ def set_rpath(old_matching, new_rpath, file):
257261 if not binary :
258262 return
259263 if binary .format == EXE_FORMATS .ELF and (
260- binary .type == ELF_CLASS . CLASS32 or binary .type == ELF_CLASS . CLASS64
264+ binary .type == ELF32 or binary .type == ELF64
261265 ):
262266 if _set_elf_rpathy_thing (
263267 binary , old_matching , new_rpath , set_rpath = True , set_runpath = False
@@ -345,7 +349,7 @@ def from_os_varnames(binary_format, binary_type, input_):
345349 .replace ("@rpath" , "$RPATH" )
346350 )
347351 elif binary_format == EXE_FORMATS .ELF :
348- if binary_type == ELF_CLASS . CLASS64 :
352+ if binary_type == ELF64 :
349353 libdir = "/lib64"
350354 else :
351355 libdir = "/lib"
@@ -371,7 +375,7 @@ def get_uniqueness_key(filename, file):
371375 elif binary .format == EXE_FORMATS .MACHO :
372376 return filename
373377 elif binary .format == EXE_FORMATS .ELF and ( # noqa
374- binary .type == ELF_CLASS . CLASS32 or binary .type == ELF_CLASS . CLASS64
378+ binary .type == ELF32 or binary .type == ELF64
375379 ):
376380 dynamic_entries = binary .dynamic_entries
377381 result = [e .name for e in dynamic_entries if e .tag == ELF_DYNAMIC_TAGS .SONAME ]
@@ -488,7 +492,7 @@ def inspect_linkages_lief(
488492 if not binary :
489493 default_paths = []
490494 elif binary .format == EXE_FORMATS .ELF :
491- if binary .type == ELF_CLASS . CLASS64 :
495+ if binary .type == ELF64 :
492496 default_paths = [
493497 "$SYSROOT/lib64" ,
494498 "$SYSROOT/usr/lib64" ,
0 commit comments