@@ -1616,6 +1616,9 @@ static const EnumEntry<unsigned> ElfMips16SymOtherFlags[] = {
1616
1616
LLVM_READOBJ_ENUM_ENT(ELF, STO_MIPS_MIPS16)
1617
1617
};
1618
1618
1619
+ static const EnumEntry<unsigned> ElfRISCVSymOtherFlags[] = {
1620
+ LLVM_READOBJ_ENUM_ENT(ELF, STO_RISCV_VARIANT_CC)};
1621
+
1619
1622
static const char *getElfMipsOptionsOdkType(unsigned Odk) {
1620
1623
switch (Odk) {
1621
1624
LLVM_READOBJ_ENUM_CASE(ELF, ODK_NULL);
@@ -3773,6 +3776,15 @@ void GNUELFDumper<ELFT>::printSymbol(const Elf_Sym &Symbol, unsigned SymIndex,
3773
3776
Fields[5].Str.append(" | " + to_hexString(Other, false));
3774
3777
Fields[5].Str.append("]");
3775
3778
}
3779
+ } else if (this->Obj.getHeader().e_machine == ELF::EM_RISCV) {
3780
+ uint8_t Other = Symbol.st_other & ~0x3;
3781
+ if (Other & STO_RISCV_VARIANT_CC) {
3782
+ Other &= ~STO_RISCV_VARIANT_CC;
3783
+ Fields[5].Str += " [VARIANT_CC";
3784
+ if (Other != 0)
3785
+ Fields[5].Str.append(" | " + to_hexString(Other, false));
3786
+ Fields[5].Str.append("]");
3787
+ }
3776
3788
} else {
3777
3789
Fields[5].Str +=
3778
3790
" [<other: " + to_string(format_hex(Symbol.st_other, 2)) + ">]";
@@ -6577,6 +6589,10 @@ void LLVMELFDumper<ELFT>::printSymbol(const Elf_Sym &Symbol, unsigned SymIndex,
6577
6589
SymOtherFlags.insert(SymOtherFlags.end(),
6578
6590
std::begin(ElfAArch64SymOtherFlags),
6579
6591
std::end(ElfAArch64SymOtherFlags));
6592
+ } else if (this->Obj.getHeader().e_machine == EM_RISCV) {
6593
+ SymOtherFlags.insert(SymOtherFlags.end(),
6594
+ std::begin(ElfRISCVSymOtherFlags),
6595
+ std::end(ElfRISCVSymOtherFlags));
6580
6596
}
6581
6597
W.printFlags("Other", Symbol.st_other, makeArrayRef(SymOtherFlags), 0x3u);
6582
6598
}
0 commit comments