[PATCH] D84393: [llvm-readelf] - Do not treat SHT_ANDROID_RELR sections the same as SHT_RELR.

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 23 03:49:10 PDT 2020


grimar created this revision.
grimar added reviewers: jhenderson, MaskRay, rahulchaudhry, jakehehrlich.
Herald added subscribers: rupprecht, emaste.
Herald added a reviewer: espindola.
Herald added a project: LLVM.

Currently, when dumping section headers, llvm-readelf
prints "RELR" for SHT_ANDROID_RELR/SHT_RELR sections.
The behavior was introduced in D47919 <https://reviews.llvm.org/D47919> and revealed in D84330 <https://reviews.llvm.org/D84330>.

But "SHT_ANDROID_RELR" has a different value from "SHT_RELR".
Also, "SHT_ANDROID_REL/SHT_ANDROID_RELA" are printed as "ANDROID_REL/ANDROID_RELA",
what makes the handling of the "SHT_ANDROID_RELR" inconsistent.

This patch makes llvm-readelf to print "ANDROID_RELR" instead of "RELR".


https://reviews.llvm.org/D84393

Files:
  llvm/test/tools/llvm-readobj/ELF/section-types.test
  llvm/tools/llvm-readobj/ELFDumper.cpp


Index: llvm/tools/llvm-readobj/ELFDumper.cpp
===================================================================
--- llvm/tools/llvm-readobj/ELFDumper.cpp
+++ llvm/tools/llvm-readobj/ELFDumper.cpp
@@ -3757,11 +3757,6 @@
   if (Name == "SHT_SYMTAB_SHNDX")
     return "SYMTAB SECTION INDICES";
 
-  // The SHT_ANDROID_RELR is special, all other SHT_ANDROID_* types are handled
-  // in the common block below.
-  if (Name == "SHT_ANDROID_RELR")
-    return "RELR";
-
   if (Name.startswith("SHT_"))
     return Name.drop_front(4).str();
   return getSectionTypeOffsetString(Type);
Index: llvm/test/tools/llvm-readobj/ELF/section-types.test
===================================================================
--- llvm/test/tools/llvm-readobj/ELF/section-types.test
+++ llvm/test/tools/llvm-readobj/ELF/section-types.test
@@ -110,7 +110,7 @@
 # GNU-NEXT: relr                    RELR
 # GNU-NEXT: android_rel             ANDROID_REL
 # GNU-NEXT: android_rela            ANDROID_RELA
-# GNU-NEXT: android_relr            RELR
+# GNU-NEXT: android_relr            ANDROID_RELR
 # GNU-NEXT: llvm_odrtab             LLVM_ODRTAB
 # GNU-NEXT: linker_options          LLVM_LINKER_OPTIONS
 # GNU-NEXT: llvm_call_graph_profile LLVM_CALL_GRAPH_PROFILE


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D84393.280065.patch
Type: text/x-patch
Size: 1239 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200723/6a154f5e/attachment-0001.bin>


More information about the llvm-commits mailing list