mirror of
https://github.com/RPCSX/llvm.git
synced 2024-12-05 02:16:46 +00:00
Add ability to query if a file is a legitimate ELF shared object.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10193 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
3e4a271c89
commit
17cca96735
@ -52,6 +52,16 @@ bool IsBytecode(const std::string &FN) {
|
||||
return CheckMagic (FN, "llvm");
|
||||
}
|
||||
|
||||
/// IsSharedObject - Returns trus IFF the file named FN appears to be a shared
|
||||
/// object with an ELF header. The file named FN must exist.
|
||||
///
|
||||
bool IsSharedObject(const std::string &FN) {
|
||||
// Inspect the beginning of the file to see if it contains the LLVM
|
||||
// bytecode format magic string.
|
||||
static const char elfMagic[] = { 0x7f, 'E', 'L', 'F', '\0' };
|
||||
return CheckMagic(FN, elfMagic);
|
||||
}
|
||||
|
||||
/// FileOpenable - Returns true IFF Filename names an existing regular
|
||||
/// file which we can successfully open.
|
||||
///
|
||||
|
Loading…
Reference in New Issue
Block a user