Skip to content
This repository was archived by the owner on Mar 28, 2020. It is now read-only.

Commit 72804e5

Browse files
committed
[llvm-readobj] Dump DT_USED value as string like GNU readelf does
Reviewers: jhenderson Reviewed By: jhenderson Subscribers: rupprecht, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D59089 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@355600 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent 8babc52 commit 72804e5

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

test/tools/llvm-readobj/elf-dynamic-tags.test

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# RUN: llvm-readobj --dynamic-table %t | FileCheck %s --check-prefix=LLVM
44
# RUN: llvm-readelf --dynamic-table %t | FileCheck %s --check-prefix=GNU
55

6-
# LLVM: DynamicSection [ (60 entries)
6+
# LLVM: DynamicSection [ (61 entries)
77
# LLVM-NEXT: Tag Type Name/Value
88
# LLVM-NEXT: 0x0000000000000001 NEEDED Shared library: [D]
99
# LLVM-NEXT: 0x0000000000000002 PLTRELSZ 16 (bytes)
@@ -60,14 +60,15 @@
6060
# LLVM-NEXT: 0x000000006FFFFFFE VERNEED 0x1000
6161
# LLVM-NEXT: 0x000000006FFFFFFF VERNEEDNUM 0
6262
# LLVM-NEXT: 0x000000007FFFFFFD AUXILIARY Auxiliary library: [D]
63+
# LLVM-NEXT: 0x000000007FFFFFFE USED Not needed object: [U]
6364
# LLVM-NEXT: 0x000000007FFFFFFF FILTER Filter library: [U]
6465
# LLVM-NEXT: 0x0000000012345678 unknown 0x8765432187654321
6566
# LLVM-NEXT: 0x000000006ABCDEF0 unknown 0x9988776655443322
6667
# LLVM-NEXT: 0x0000000076543210 unknown 0x5555666677778888
6768
# LLVM-NEXT: 0x0000000000000000 NULL 0x0
6869
# LLVM-NEXT: ]
6970

70-
# GNU: DynamicSection [ (60 entries)
71+
# GNU: DynamicSection [ (61 entries)
7172
# GNU-NEXT: Tag Type Name/Value
7273
# GNU-NEXT: 0x0000000000000001 NEEDED Shared library: [D]
7374
# GNU-NEXT: 0x0000000000000002 PLTRELSZ 16 (bytes)
@@ -124,6 +125,7 @@
124125
# GNU-NEXT: 0x000000006ffffffe VERNEED 0x1000
125126
# GNU-NEXT: 0x000000006fffffff VERNEEDNUM 0
126127
# GNU-NEXT: 0x000000007ffffffd AUXILIARY Auxiliary library: [D]
128+
# GNU-NEXT: 0x000000007ffffffe USED Not needed object: [U]
127129
# GNU-NEXT: 0x000000007fffffff FILTER Filter library: [U]
128130
# GNU-NEXT: 0x0000000012345678 unknown 0x8765432187654321
129131
# GNU-NEXT: 0x000000006abcdef0 unknown 0x9988776655443322
@@ -257,6 +259,8 @@ Sections:
257259
Value: 0x0
258260
- Tag: DT_AUXILIARY
259261
Value: 0x1
262+
- Tag: DT_USED
263+
Value: 0x3
260264
- Tag: DT_FILTER
261265
Value: 0x3
262266
# Show behaviour for unknown values in special and un-marked ranges.

tools/llvm-readobj/ELFDumper.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1876,6 +1876,9 @@ void ELFDumper<ELFT>::printValue(uint64_t Type, uint64_t Value) {
18761876
case DT_AUXILIARY:
18771877
printLibrary(OS, "Auxiliary library", getDynamicString(Value));
18781878
break;
1879+
case DT_USED:
1880+
printLibrary(OS, "Not needed object", getDynamicString(Value));
1881+
break;
18791882
case DT_FILTER:
18801883
printLibrary(OS, "Filter library", getDynamicString(Value));
18811884
break;

0 commit comments

Comments
 (0)