Files
linuxdeploy/include/linuxdeploy/core/elf.h
T
TheAssassin 030b21379b Move exception to header
Otherwise, it obviously can't be caught by users of the ElfFile class.
2018-06-04 14:08:24 +02:00

47 lines
1.6 KiB
C++

// system includes
#include <vector>
#include <string>
// library includes
#include <boost/filesystem.hpp>
#pragma once
namespace linuxdeploy {
namespace core {
namespace elf {
// thrown by constructor if file is not an ELF file
class ElfFileParseError : public std::runtime_error {
public:
explicit ElfFileParseError(const std::string& msg) : std::runtime_error(msg) {}
};
class ElfFile {
private:
class PrivateData;
PrivateData* d;
public:
explicit ElfFile(const boost::filesystem::path& path);
~ElfFile();
public:
// recursively trace dynamic library dependencies of a given ELF file
// this works for both libraries and executables
// the resulting vector consists of absolute paths to the libraries determined by the same methods a system's
// linker would use
std::vector<boost::filesystem::path> traceDynamicDependencies();
// fetch rpath stored in binary
// it appears that according to the ELF standard, the rpath is ignored in libraries, therefore if the path
// points to an executable, an empty string is returned
std::string getRPath();
// set rpath in ELF file
// returns true on success, false otherwise
bool setRPath(const std::string& value);
};
}
}
}