[lld] [llvm] [llvm-readelf] Print more information for RELR (PR #89162)
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 18 09:49:18 PDT 2024
================
@@ -3926,13 +3930,85 @@ template <class ELFT> void GNUELFDumper<ELFT>::printRelocations() {
OS << "\nRelocation section '" << Name << "' at offset 0x"
<< utohexstr(Offset, /*LowerCase=*/true) << " contains " << EntriesNum
<< " entries:\n";
- printRelocHeaderFields<ELFT>(OS, Sec.sh_type, this->Obj.getHeader());
- this->printRelocationsHelper(Sec);
+
+ if (PrintAsRelr(Sec)) {
+ printRelr(Sec);
+ } else {
+ printRelocHeaderFields<ELFT>(OS, Sec.sh_type, this->Obj.getHeader());
+ this->printRelocationsHelper(Sec);
+ }
}
if (!HasRelocSections)
OS << "\nThere are no relocations in this file.\n";
}
+template <class ELFT> void GNUELFDumper<ELFT>::printRelr(const Elf_Shdr &Sec) {
+ Expected<Elf_Relr_Range> RangeOrErr = this->Obj.relrs(Sec);
+ if (!RangeOrErr) {
+ this->reportUniqueWarning("unable to read relocations from " +
----------------
MaskRay wrote:
This is tested by the existing `BROKEN-GNU-NEXT: warning: '[[FILE]]': unable to read relocations from [[SECNAME]] section with index 1: `.
The message is the same as another one in `ELFDumper<ELFT>::forEachRelocationDo`
https://github.com/llvm/llvm-project/pull/89162
More information about the llvm-commits
mailing list