Skip to content

Commit

Permalink
Support ELF files of unknown type.
Browse files Browse the repository at this point in the history
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222208 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
Bigcheese committed Nov 18, 2014
1 parent 2c38b00 commit b9f39bc
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions include/llvm/Support/FileSystem.h
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ struct file_magic {
unknown = 0, ///< Unrecognized file
bitcode, ///< Bitcode file
archive, ///< ar style archive file
elf, ///< ELF Unknown type
elf_relocatable, ///< ELF Relocatable object file
elf_executable, ///< ELF Executable image
elf_shared_object, ///< ELF dynamically linked shared lib
Expand Down
1 change: 1 addition & 0 deletions lib/Object/Binary.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ ErrorOr<std::unique_ptr<Binary>> object::createBinary(MemoryBufferRef Buffer,
switch (Type) {
case sys::fs::file_magic::archive:
return Archive::create(Buffer);
case sys::fs::file_magic::elf:
case sys::fs::file_magic::elf_relocatable:
case sys::fs::file_magic::elf_executable:
case sys::fs::file_magic::elf_shared_object:
Expand Down
1 change: 1 addition & 0 deletions lib/Object/ObjectFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ ObjectFile::createObjectFile(MemoryBufferRef Object, sys::fs::file_magic Type) {
case sys::fs::file_magic::macho_universal_binary:
case sys::fs::file_magic::windows_resource:
return object_error::invalid_file_type;
case sys::fs::file_magic::elf:
case sys::fs::file_magic::elf_relocatable:
case sys::fs::file_magic::elf_executable:
case sys::fs::file_magic::elf_shared_object:
Expand Down
1 change: 1 addition & 0 deletions lib/Object/SymbolicFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ ErrorOr<std::unique_ptr<SymbolicFile>> SymbolicFile::createSymbolicFile(
case sys::fs::file_magic::macho_universal_binary:
case sys::fs::file_magic::windows_resource:
return object_error::invalid_file_type;
case sys::fs::file_magic::elf:
case sys::fs::file_magic::elf_executable:
case sys::fs::file_magic::elf_shared_object:
case sys::fs::file_magic::elf_core:
Expand Down
3 changes: 3 additions & 0 deletions lib/Support/Path.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -958,6 +958,9 @@ file_magic identify_magic(StringRef Magic) {
case 3: return file_magic::elf_shared_object;
case 4: return file_magic::elf_core;
}
else
// It's still some type of ELF file.
return file_magic::elf;
}
break;

Expand Down

0 comments on commit b9f39bc

Please sign in to comment.