1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 19:23:23 +01:00

[llvm-readobj] Extend the output of -elf-section-groups

This diff extends the output of -elf-section-groups 
(llvm style, gnu style is unchanged since it's meant to be 
compatible with binutils readelf) with sh_link and sh_info.
This change will enable us to use llvm-readobj -elf-section-groups 
for testing llvm-objcopy's support for .group sections.

Test plan: make check-all

Differential revision: https://reviews.llvm.org/D44280

llvm-svn: 327341
This commit is contained in:
Alexander Shaposhnikov 2018-03-12 22:40:09 +00:00
parent e71a34b01d
commit a42d50c590
3 changed files with 20 additions and 1 deletions

View File

@ -20,6 +20,8 @@
# LLVM-STDOUT-NEXT: Group {
# LLVM-STDOUT-NEXT: Name: .group
# LLVM-STDOUT-NEXT: Index: 2
# LLVM-STDOUT-NEXT: Link: 5
# LLVM-STDOUT-NEXT: Info: 1
# LLVM-STDOUT-NEXT: Type: COMDAT
# LLVM-STDOUT-NEXT: Signature: bar
# LLVM-STDOUT-NEXT: Section(s) in group [
@ -29,6 +31,8 @@
# LLVM-STDOUT-NEXT: Group {
# LLVM-STDOUT-NEXT: Name: .group1
# LLVM-STDOUT-NEXT: Index: 4
# LLVM-STDOUT-NEXT: Link: 5
# LLVM-STDOUT-NEXT: Info: 2
# LLVM-STDOUT-NEXT: Type: COMDAT
# LLVM-STDOUT-NEXT: Signature: zed
# LLVM-STDOUT-NEXT: Section(s) in group [

View File

@ -21,6 +21,8 @@ CHECK: Groups {
CHECK-NEXT: Group {
CHECK-NEXT: Name: .group (92)
CHECK-NEXT: Index: 1
CHECK-NEXT: Link: 23
CHECK-NEXT: Info: 17
CHECK-NEXT: Type: COMDAT (0x1)
CHECK-NEXT: Signature: _Z3fooIcEvT_
CHECK-NEXT: Section(s) in group [
@ -31,6 +33,8 @@ CHECK-NEXT: }
CHECK-NEXT: Group {
CHECK-NEXT: Name: .group (92)
CHECK-NEXT: Index: 2
CHECK-NEXT: Link: 23
CHECK-NEXT: Info: 18
CHECK-NEXT: Type: COMDAT (0x1)
CHECK-NEXT: Signature: _Z3fooIiEvT_
CHECK-NEXT: Section(s) in group [

View File

@ -2482,6 +2482,8 @@ struct GroupSection {
StringRef Signature;
uint64_t ShName;
uint64_t Index;
uint32_t Link;
uint32_t Info;
uint32_t Type;
std::vector<GroupMember> Members;
};
@ -2508,7 +2510,14 @@ std::vector<GroupSection> getGroups(const ELFFile<ELFT> *Obj) {
StringRef Name = unwrapOrError(Obj->getSectionName(&Sec));
StringRef Signature = StrTable.data() + Sym->st_name;
Ret.push_back({Name, Signature, Sec.sh_name, I - 1, Data[0], {}});
Ret.push_back({Name,
Signature,
Sec.sh_name,
I - 1,
Sec.sh_link,
Sec.sh_info,
Data[0],
{}});
std::vector<GroupMember> &GM = Ret.back().Members;
for (uint32_t Ndx : Data.slice(1)) {
@ -3780,6 +3789,8 @@ void LLVMStyle<ELFT>::printGroupSections(const ELFO *Obj) {
DictScope D(W, "Group");
W.printNumber("Name", G.Name, G.ShName);
W.printNumber("Index", G.Index);
W.printNumber("Link", G.Link);
W.printNumber("Info", G.Info);
W.printHex("Type", getGroupType(G.Type), G.Type);
W.startLine() << "Signature: " << G.Signature << "\n";