summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Christopher <echristo@gmail.com>2014-10-06 07:06:03 +0000
committerEric Christopher <echristo@gmail.com>2014-10-06 07:06:03 +0000
commit2dab8359795909dbb3ad46a4a12ec5fa999cd088 (patch)
treed1d6ea23a2674b97dddd15a5cb99e2fec42c5822
parent9864519c8baeac231eb495c6197295f1da1f221c (diff)
downloadbcm5719-llvm-2dab8359795909dbb3ad46a4a12ec5fa999cd088.tar.gz
bcm5719-llvm-2dab8359795909dbb3ad46a4a12ec5fa999cd088.zip
For biendian targets like ARM and AArch64, it is useful to have the
output of the llvm-dwarfdump and llvm-objdump report the endianness used when the object files were generated. Patch by Charlie Turner. llvm-svn: 219110
-rw-r--r--llvm/include/llvm/Object/ELFObjectFile.h5
-rw-r--r--llvm/test/DebugInfo/AArch64/big-endian-dump.ll4
-rw-r--r--llvm/test/DebugInfo/AArch64/little-endian-dump.ll16
-rw-r--r--llvm/test/DebugInfo/ARM/big-endian-dump.ll4
-rw-r--r--llvm/test/DebugInfo/ARM/little-endian-dump.ll18
5 files changed, 43 insertions, 4 deletions
diff --git a/llvm/include/llvm/Object/ELFObjectFile.h b/llvm/include/llvm/Object/ELFObjectFile.h
index ed3c08f6f32..2c9c07a48d2 100644
--- a/llvm/include/llvm/Object/ELFObjectFile.h
+++ b/llvm/include/llvm/Object/ELFObjectFile.h
@@ -855,6 +855,7 @@ uint8_t ELFObjectFile<ELFT>::getBytesInAddress() const {
template <class ELFT>
StringRef ELFObjectFile<ELFT>::getFileFormatName() const {
+ bool IsLittleEndian = ELFT::TargetEndianness == support::little;
switch (EF.getHeader()->e_ident[ELF::EI_CLASS]) {
case ELF::ELFCLASS32:
switch (EF.getHeader()->e_machine) {
@@ -863,7 +864,7 @@ StringRef ELFObjectFile<ELFT>::getFileFormatName() const {
case ELF::EM_X86_64:
return "ELF32-x86-64";
case ELF::EM_ARM:
- return "ELF32-arm";
+ return (IsLittleEndian ? "ELF32-arm-little" : "ELF32-arm-big");
case ELF::EM_HEXAGON:
return "ELF32-hexagon";
case ELF::EM_MIPS:
@@ -883,7 +884,7 @@ StringRef ELFObjectFile<ELFT>::getFileFormatName() const {
case ELF::EM_X86_64:
return "ELF64-x86-64";
case ELF::EM_AARCH64:
- return "ELF64-aarch64";
+ return (IsLittleEndian ? "ELF64-aarch64-little" : "ELF64-aarch64-big");
case ELF::EM_PPC64:
return "ELF64-ppc64";
case ELF::EM_S390:
diff --git a/llvm/test/DebugInfo/AArch64/big-endian-dump.ll b/llvm/test/DebugInfo/AArch64/big-endian-dump.ll
index 7b48fa243c2..3af30011f25 100644
--- a/llvm/test/DebugInfo/AArch64/big-endian-dump.ll
+++ b/llvm/test/DebugInfo/AArch64/big-endian-dump.ll
@@ -1,4 +1,6 @@
-; RUN: llc -O0 -filetype=obj -mtriple=aarch64_be-none-linux < %s | llvm-dwarfdump -
+; RUN: llc -O0 -filetype=obj -mtriple=aarch64_be-none-linux < %s | llvm-dwarfdump - | FileCheck %s
+
+; CHECK: file format ELF64-aarch64-big
target datalayout = "E-m:e-i64:64-i128:128-n32:64-S128"
diff --git a/llvm/test/DebugInfo/AArch64/little-endian-dump.ll b/llvm/test/DebugInfo/AArch64/little-endian-dump.ll
new file mode 100644
index 00000000000..5c7f336b67d
--- /dev/null
+++ b/llvm/test/DebugInfo/AArch64/little-endian-dump.ll
@@ -0,0 +1,16 @@
+; RUN: llc -O0 -filetype=obj -mtriple=aarch64-none-linux < %s | llvm-dwarfdump - | FileCheck %s
+
+; CHECK: file format ELF64-aarch64-little
+
+target datalayout = "e-m:e-i64:64-i128:128-n32:64-S128"
+
+!llvm.dbg.cu = !{!0}
+!llvm.module.flags = !{!3, !4}
+!llvm.ident = !{!5}
+
+!0 = metadata !{i32 786449, metadata !1, i32 12, metadata !"clang version 3.6.0 ", i1 false, metadata !"", i32 0, metadata !2, metadata !2, metadata !2, metadata !2, metadata !2, metadata !"", i32 1} ; [ DW_TAG_compile_unit ] [/a/empty.c] [DW_LANG_C99]
+!1 = metadata !{metadata !"empty.c", metadata !"/a"}
+!2 = metadata !{}
+!3 = metadata !{i32 2, metadata !"Dwarf Version", i32 4}
+!4 = metadata !{i32 2, metadata !"Debug Info Version", i32 1}
+!5 = metadata !{metadata !"clang version 3.6.0 "}
diff --git a/llvm/test/DebugInfo/ARM/big-endian-dump.ll b/llvm/test/DebugInfo/ARM/big-endian-dump.ll
index 5b157b4a556..e35f097b44f 100644
--- a/llvm/test/DebugInfo/ARM/big-endian-dump.ll
+++ b/llvm/test/DebugInfo/ARM/big-endian-dump.ll
@@ -1,4 +1,6 @@
-; RUN: llc -O0 -filetype=obj -mtriple=armeb-none-linux < %s | llvm-dwarfdump -
+; RUN: llc -O0 -filetype=obj -mtriple=armeb-none-linux < %s | llvm-dwarfdump - | FileCheck %s
+
+; CHECK: file format ELF32-arm-big
target datalayout = "E-m:e-p:32:32-i64:64-v128:64:128-n32-S64"
diff --git a/llvm/test/DebugInfo/ARM/little-endian-dump.ll b/llvm/test/DebugInfo/ARM/little-endian-dump.ll
new file mode 100644
index 00000000000..da60657f020
--- /dev/null
+++ b/llvm/test/DebugInfo/ARM/little-endian-dump.ll
@@ -0,0 +1,18 @@
+; RUN: llc -O0 -filetype=obj -mtriple=arm-none-linux < %s | llvm-dwarfdump - | FileCheck %s
+
+; CHECK: file format ELF32-arm-little
+
+target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-n32-S64"
+
+!llvm.dbg.cu = !{!0}
+!llvm.module.flags = !{!3, !4, !5, !6}
+!llvm.ident = !{!7}
+
+!0 = metadata !{i32 786449, metadata !1, i32 12, metadata !"clang version 3.6.0 ", i1 false, metadata !"", i32 0, metadata !2, metadata !2, metadata !2, metadata !2, metadata !2, metadata !"", i32 1} ; [ DW_TAG_compile_unit ] [/a/empty.c] [DW_LANG_C99]
+!1 = metadata !{metadata !"empty.c", metadata !"/a"}
+!2 = metadata !{}
+!3 = metadata !{i32 2, metadata !"Dwarf Version", i32 4}
+!4 = metadata !{i32 2, metadata !"Debug Info Version", i32 1}
+!5 = metadata !{i32 1, metadata !"wchar_size", i32 4}
+!6 = metadata !{i32 1, metadata !"min_enum_size", i32 4}
+!7 = metadata !{metadata !"clang version 3.6.0 "}
OpenPOWER on IntegriCloud