From 1d534d2b32f7e995ef130ee8e579190f71caefcf Mon Sep 17 00:00:00 2001 From: TheAssassin Date: Sat, 29 May 2021 01:25:21 +0200 Subject: [PATCH] Do not set rpath in statically linked or debug symbols ELF files --- src/core/appdir.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/core/appdir.cpp b/src/core/appdir.cpp index 8194338..fb52b38 100644 --- a/src/core/appdir.cpp +++ b/src/core/appdir.cpp @@ -215,10 +215,16 @@ namespace linuxdeploy { const auto& filePath = currentEntry.first; const auto& rpath = currentEntry.second; + elf_file::ElfFile elfFile(filePath); + // no need to set rpath in debug symbols files // also, patchelf crashes on such symbols - if (isInDebugSymbolsLocation(filePath)) { - ldLog() << LD_WARNING << "Not setting rpath in debug symbols file:" << filePath << std::endl; + if (isInDebugSymbolsLocation(filePath) || elfFile.isDebugSymbolsFile()) { + ldLog() << LD_WARNING << "Not setting rpath in debug symbols file:" << filePath + << std::endl; + } else if (!elfFile.isDynamicallyLinked()) { + ldLog() << LD_WARNING << "Not setting rpath in statically-linked file: " << filePath + << std::endl; } else { ldLog() << "Setting rpath in ELF file" << filePath << "to" << rpath << std::endl; if (!elf_file::ElfFile(filePath).setRPath(rpath)) {