[lld] 896b84a - [llvm-readelf] Print EI_ABIVERSION as decimal instead of hexadecimal
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Mon Jan 6 09:25:52 PST 2020
Author: Fangrui Song
Date: 2020-01-06T09:25:45-08:00
New Revision: 896b84ac2c70ad69075c2496f8f89247704fff0b
URL: https://github.com/llvm/llvm-project/commit/896b84ac2c70ad69075c2496f8f89247704fff0b
DIFF: https://github.com/llvm/llvm-project/commit/896b84ac2c70ad69075c2496f8f89247704fff0b.diff
LOG: [llvm-readelf] Print EI_ABIVERSION as decimal instead of hexadecimal
This matches GNU readelf and llvm-readobj.
Reviewed By: jhenderson
Differential Revision: https://reviews.llvm.org/D72234
Added:
Modified:
lld/test/ELF/mips-n32-rels.s
llvm/test/tools/llvm-objcopy/ELF/partitions.test
llvm/test/tools/llvm-readobj/ELF/file-header-abi-version.test
llvm/test/tools/llvm-readobj/ELF/gnu-file-headers.test
llvm/tools/llvm-readobj/ELFDumper.cpp
Removed:
################################################################################
diff --git a/lld/test/ELF/mips-n32-rels.s b/lld/test/ELF/mips-n32-rels.s
index d7a5bdd904ff..5d5d620ccf4b 100644
--- a/lld/test/ELF/mips-n32-rels.s
+++ b/lld/test/ELF/mips-n32-rels.s
@@ -51,7 +51,7 @@ loc:
# ELF: Data: 2's complement, big endian
# ELF: Version: 1 (current)
# ELF: OS/ABI: UNIX - System V
-# ELF: ABI Version: 0x0
+# ELF: ABI Version: 0
# ELF: Type: EXEC (Executable file)
# ELF: Machine: MIPS R3000
# ELF: Version: 0x1
diff --git a/llvm/test/tools/llvm-objcopy/ELF/partitions.test b/llvm/test/tools/llvm-objcopy/ELF/partitions.test
index 6902bce7b113..47a9c803b915 100644
--- a/llvm/test/tools/llvm-objcopy/ELF/partitions.test
+++ b/llvm/test/tools/llvm-objcopy/ELF/partitions.test
@@ -17,7 +17,7 @@ MAIN-NEXT: Class: ELF64
MAIN-NEXT: Data: 2's complement, little endian
MAIN-NEXT: Version: 1 (current)
MAIN-NEXT: OS/ABI: UNIX - System V
-MAIN-NEXT: ABI Version: 0x0
+MAIN-NEXT: ABI Version: 0
MAIN-NEXT: Type: EXEC (Executable file)
MAIN-NEXT: Machine: Advanced Micro Devices X86-64
MAIN-NEXT: Version: 0x1
@@ -76,7 +76,7 @@ PART1-NEXT: Class: ELF64
PART1-NEXT: Data: 2's complement, little endian
PART1-NEXT: Version: 1 (current)
PART1-NEXT: OS/ABI: UNIX - System V
-PART1-NEXT: ABI Version: 0x0
+PART1-NEXT: ABI Version: 0
PART1-NEXT: Type: DYN (Shared object file)
PART1-NEXT: Machine: Advanced Micro Devices X86-64
PART1-NEXT: Version: 0x1
@@ -131,7 +131,7 @@ PART2-NEXT: Class: ELF64
PART2-NEXT: Data: 2's complement, little endian
PART2-NEXT: Version: 1 (current)
PART2-NEXT: OS/ABI: UNIX - System V
-PART2-NEXT: ABI Version: 0x0
+PART2-NEXT: ABI Version: 0
PART2-NEXT: Type: DYN (Shared object file)
PART2-NEXT: Machine: Advanced Micro Devices X86-64
PART2-NEXT: Version: 0x1
diff --git a/llvm/test/tools/llvm-readobj/ELF/file-header-abi-version.test b/llvm/test/tools/llvm-readobj/ELF/file-header-abi-version.test
index f73a15564331..a34f7736a9e4 100644
--- a/llvm/test/tools/llvm-readobj/ELF/file-header-abi-version.test
+++ b/llvm/test/tools/llvm-readobj/ELF/file-header-abi-version.test
@@ -14,13 +14,13 @@
# RUN: llvm-readelf --file-headers %t.abiver.max | FileCheck %s --match-full-lines --check-prefix=ABIVER-MAX-GNU
# ABIVER-ZERO-LLVM: ABIVersion: 0
-# ABIVER-ZERO-GNU: ABI Version: 0x0
+# ABIVER-ZERO-GNU: ABI Version: 0
# ABIVER-ANY-LLVM: ABIVersion: 52
-# ABIVER-ANY-GNU: ABI Version: 0x34
+# ABIVER-ANY-GNU: ABI Version: 52
# ABIVER-MAX-LLVM: ABIVersion: 255
-# ABIVER-MAX-GNU: ABI Version: 0xFF
+# ABIVER-MAX-GNU: ABI Version: 255
--- !ELF
FileHeader:
diff --git a/llvm/test/tools/llvm-readobj/ELF/gnu-file-headers.test b/llvm/test/tools/llvm-readobj/ELF/gnu-file-headers.test
index c779d0c44ec2..015616e6c855 100644
--- a/llvm/test/tools/llvm-readobj/ELF/gnu-file-headers.test
+++ b/llvm/test/tools/llvm-readobj/ELF/gnu-file-headers.test
@@ -14,7 +14,7 @@
# I386-NEXT: Data: 2's complement, little endian
# I386-NEXT: Version: 1 (current)
# I386-NEXT: OS/ABI: UNIX - System V
-# I386-NEXT: ABI Version: 0x0
+# I386-NEXT: ABI Version: 0
# I386-NEXT: Type: REL (Relocatable file)
# I386-NEXT: Machine: Intel 80386
# I386-NEXT: Version: 0x1
@@ -57,7 +57,7 @@ ProgramHeaders:
# X86-64-NEXT: Data: 2's complement, little endian
# X86-64-NEXT: Version: 1 (current)
# X86-64-NEXT: OS/ABI: UNIX - System V
-# X86-64-NEXT: ABI Version: 0x0
+# X86-64-NEXT: ABI Version: 0
# X86-64-NEXT: Type: REL (Relocatable file)
# X86-64-NEXT: Machine: Advanced Micro Devices X86-64
# X86-64-NEXT: Version: 0x1
@@ -101,7 +101,7 @@ ProgramHeaders:
# MIPSEL-NEXT: Data: 2's complement, little endian
# MIPSEL-NEXT: Version: 1 (current)
# MIPSEL-NEXT: OS/ABI: UNIX - System V
-# MIPSEL-NEXT: ABI Version: 0x0
+# MIPSEL-NEXT: ABI Version: 0
# MIPSEL-NEXT: Type: REL (Relocatable file)
# MIPSEL-NEXT: Machine: MIPS R3000
# MIPSEL-NEXT: Version: 0x1
diff --git a/llvm/tools/llvm-readobj/ELFDumper.cpp b/llvm/tools/llvm-readobj/ELFDumper.cpp
index 5a15eb11932c..8ffb68283405 100644
--- a/llvm/tools/llvm-readobj/ELFDumper.cpp
+++ b/llvm/tools/llvm-readobj/ELFDumper.cpp
@@ -3061,8 +3061,8 @@ template <class ELFT> void GNUStyle<ELFT>::printFileHeaders(const ELFO *Obj) {
OS << "\n";
Str = printEnum(e->e_ident[ELF::EI_OSABI], makeArrayRef(ElfOSABI));
printFields(OS, "OS/ABI:", Str);
- Str = "0x" + to_hexString(e->e_ident[ELF::EI_ABIVERSION]);
- printFields(OS, "ABI Version:", Str);
+ printFields(OS,
+ "ABI Version:", std::to_string(e->e_ident[ELF::EI_ABIVERSION]));
Str = printEnum(e->e_type, makeArrayRef(ElfObjectFileType));
printFields(OS, "Type:", Str);
Str = printEnum(e->e_machine, makeArrayRef(ElfMachineType));
More information about the llvm-commits
mailing list