Skip to content

Commit 06714e1

Browse files
authored
llvm-readobj/ARM: activate big-endian attribute printing (#87806)
Activate attribute printing for big-endian encoding for ARM. The supporting code already exists, and the patch is trivial. Fixes #62400.
1 parent f7bf11c commit 06714e1

File tree

2 files changed

+14
-12
lines changed

2 files changed

+14
-12
lines changed
Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,23 @@
1-
## We only implement attribute section printing for little-endian encoding.
2-
31
# RUN: yaml2obj %s -o %t.o
4-
# RUN: llvm-readobj -A %t.o 2>&1 | FileCheck %s -DFILE=%t.o
2+
# RUN: llvm-readelf -A %t.o 2>&1 | FileCheck %s
53

6-
# CHECK: warning: '[[FILE]]': attribute printing not implemented for big-endian ARM objects
4+
# CHECK: BuildAttributes {
5+
# CHECK-NEXT: FormatVersion: 0x41
6+
# CHECK-NEXT: Section 1 {
7+
# CHECK-NEXT: SectionLength: 22
8+
# CHECK-NEXT: Vendor: armabi
9+
# CHECK-NEXT: }
10+
# CHECK-NEXT: }
711

812
--- !ELF
913
FileHeader:
1014
Class: ELFCLASS32
11-
## Test big-endian encoding.
1215
Data: ELFDATA2MSB
1316
Type: ET_REL
1417
Machine: EM_ARM
1518
Sections:
1619
- Name: .ARM.attributes
1720
Type: SHT_ARM_ATTRIBUTES
21+
ContentArray: [ 0x41, 0x00, 0x00, 0x00, 0x16, 0x61, 0x72, 0x6D, 0x61, 0x62,
22+
0x69, 0x00, 0x01, 0x0b, 0x00, 0x00, 0x00, 0x04, 0x01, 0x06, 0x01, 0x08,
23+
0x01 ]

llvm/tools/llvm-readobj/ELFDumper.cpp

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2833,13 +2833,9 @@ template <class ELFT> void ELFDumper<ELFT>::printArchSpecificInfo() {
28332833
llvm::endianness::little);
28342834
break;
28352835
case EM_ARM:
2836-
if (Obj.isLE())
2837-
printAttributes(ELF::SHT_ARM_ATTRIBUTES,
2838-
std::make_unique<ARMAttributeParser>(&W),
2839-
llvm::endianness::little);
2840-
else
2841-
reportUniqueWarning("attribute printing not implemented for big-endian "
2842-
"ARM objects");
2836+
printAttributes(
2837+
ELF::SHT_ARM_ATTRIBUTES, std::make_unique<ARMAttributeParser>(&W),
2838+
Obj.isLE() ? llvm::endianness::little : llvm::endianness::big);
28432839
break;
28442840
case EM_RISCV:
28452841
if (Obj.isLE())

0 commit comments

Comments
 (0)