[PATCH] D143693: Add --memtag to llvm-readelf/llvm-readobj.
Fangrui Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Feb 10 17:39:36 PST 2023
MaskRay added inline comments.
================
Comment at: llvm/test/tools/llvm-readobj/ELF/AArch64/note-android-memtag.test:1
-# RUN: yaml2obj -D DESC='0d000000' %s -o %t
-# RUN: llvm-readelf --notes %t | FileCheck %s --check-prefixes=GNU,GNU-OK,ASYNC,HEAP,STACK
-# RUN: llvm-readobj --notes %t | FileCheck %s --check-prefixes=LLVM,LLVM-OK,ASYNC,HEAP,STACK
+# RUN: yaml2obj -D DESC='0d000000' -D MODE=1 -D HEAP=1 -D STACK=1 %s -o %t
+# RUN: llvm-readelf --notes --dynamic --memtag %t | FileCheck %s --check-prefixes=GNU,GNU-OK,ASYNC,HEAP,STACK
----------------
Add a test when no memtag tag is present in an object file.
================
Comment at: llvm/tools/llvm-readobj/ELFDumper.cpp:5239
+ if (!DynamicEntries.empty()) {
+ OS << "Memtag Dynamic Entries:\n";
+ for (const auto &DynamicEntry : DynamicEntries) {
----------------
If the user specifies `--memtag`, `Memtag Dynamic Entries:` should be unconditionally printed, even if empty.
================
Comment at: llvm/tools/llvm-readobj/ELFDumper.cpp:5241
+ for (const auto &DynamicEntry : DynamicEntries) {
+ OS << " " << DynamicEntry.first << ": " << DynamicEntry.second << "\n";
+ }
----------------
https://llvm.org/docs/CodingStandards.html#don-t-use-braces-on-simple-single-statement-bodies-of-if-else-loop-statements
================
Comment at: llvm/tools/llvm-readobj/ELFDumper.cpp:5895
+ std::vector<std::pair<std::string, std::string>> DynamicEntries;
+
+ for (auto Entry : this->dynamic_table()) {
----------------
delete this blank line
================
Comment at: llvm/tools/llvm-readobj/ELFDumper.cpp:7308
+ ArrayRef<uint8_t> AndroidNoteDesc) {
+ if (!DynamicEntries.empty()) {
+ ListScope L(W, "Memtag Dynamic Entries:");
----------------
unconditionally print `"Memtag Dynamic Entries:"`
================
Comment at: llvm/tools/llvm-readobj/ELFDumper.cpp:7311
+ for (const auto &DynamicEntry : DynamicEntries) {
+ W.printString(DynamicEntry.first, DynamicEntry.second);
+ }
----------------
delete braces
================
Comment at: llvm/tools/llvm-readobj/Opts.td:58
def hash_table : FF<"hash-table", "Display .hash section">, Group<grp_elf>;
+def memtag : FF<"memtag", "Display memory tagging metadata (modes, global descriptors)">, Group<grp_elf>;
def needed_libs : FF<"needed-libs", "Display the needed libraries">, Group<grp_elf>;
----------------
Does the help message include `notes`? I only see modes and global descriptors.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D143693/new/
https://reviews.llvm.org/D143693
More information about the llvm-commits
mailing list