Replace direct call to patchelf with get_existing_elf_rpaths which handles exceptions. (#14929)

* Replace direct call to patchelf with get_existing_elf_rpaths which handles exceptions.

* Remove unused patchelf definition.

* Convert to set.
This commit is contained in:
Patrick Gartung 2020-02-13 11:34:20 -06:00 committed by GitHub
parent 681ad2ac44
commit 4dc67b79aa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -684,13 +684,6 @@ def file_is_relocatable(file, paths_to_relocate=None):
strings = Executable('strings')
# if we're relocating patchelf itself, use it
if file[-13:] == "/bin/patchelf":
patchelf = Executable(file)
else:
patchelf = Executable(get_patchelf())
# Remove the RPATHS from the strings in the executable
set_of_strings = set(strings(file, output=str).split())
@ -700,8 +693,8 @@ def file_is_relocatable(file, paths_to_relocate=None):
if platform.system().lower() == 'linux':
if m_subtype == 'x-executable' or m_subtype == 'x-sharedlib':
rpaths = patchelf('--print-rpath', file, output=str).strip()
set_of_strings.discard(rpaths.strip())
rpaths = set(get_existing_elf_rpaths(file))
set_of_strings.discard(rpaths)
if platform.system().lower() == 'darwin':
if m_subtype == 'x-mach-binary':
rpaths, deps, idpath = macho_get_paths(file)