[llvm] r226943 - [Object][ELF] Test unknown type.
Michael J. Spencer
bigcheesegs at gmail.com
Fri Jan 23 13:58:10 PST 2015
Author: mspencer
Date: Fri Jan 23 15:58:09 2015
New Revision: 226943
URL: http://llvm.org/viewvc/llvm-project?rev=226943&view=rev
Log:
[Object][ELF] Test unknown type.
Added:
llvm/trunk/test/Object/elf-unknown-type.test
Modified:
llvm/trunk/lib/Object/ELFYAML.cpp
llvm/trunk/lib/Support/Path.cpp
Modified: llvm/trunk/lib/Object/ELFYAML.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Object/ELFYAML.cpp?rev=226943&r1=226942&r2=226943&view=diff
==============================================================================
--- llvm/trunk/lib/Object/ELFYAML.cpp (original)
+++ llvm/trunk/lib/Object/ELFYAML.cpp Fri Jan 23 15:58:09 2015
@@ -30,6 +30,7 @@ ScalarEnumerationTraits<ELFYAML::ELF_ET>
ECase(ET_DYN)
ECase(ET_CORE)
#undef ECase
+ IO.enumFallback<Hex16>(Value);
}
void
Modified: llvm/trunk/lib/Support/Path.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Path.cpp?rev=226943&r1=226942&r2=226943&view=diff
==============================================================================
--- llvm/trunk/lib/Support/Path.cpp (original)
+++ llvm/trunk/lib/Support/Path.cpp Fri Jan 23 15:58:09 2015
@@ -960,7 +960,7 @@ file_magic identify_magic(StringRef Magi
unsigned low = Data2MSB ? 17 : 16;
if (Magic[high] == 0)
switch (Magic[low]) {
- default: break;
+ default: return file_magic::elf;
case 1: return file_magic::elf_relocatable;
case 2: return file_magic::elf_executable;
case 3: return file_magic::elf_shared_object;
Added: llvm/trunk/test/Object/elf-unknown-type.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Object/elf-unknown-type.test?rev=226943&view=auto
==============================================================================
--- llvm/trunk/test/Object/elf-unknown-type.test (added)
+++ llvm/trunk/test/Object/elf-unknown-type.test Fri Jan 23 15:58:09 2015
@@ -0,0 +1,10 @@
+# RUN: yaml2obj -format=elf %s | llvm-readobj -file-headers - | FileCheck %s
+
+!ELF
+FileHeader: !FileHeader
+ Class: ELFCLASS64
+ Data: ELFDATA2LSB
+ Type: 42
+ Machine: EM_X86_64
+
+# CHECK: Type: 0x2A
More information about the llvm-commits
mailing list