[PATCH] D150079: [BPF][DebugInfo] Show CO-RE relocations in llvm-objdump

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 19 23:57:46 PDT 2023


MaskRay accepted this revision.
MaskRay added a comment.
This revision is now accepted and ready to land.

Sorry for the delay. LG!

> Additional information about CO-RE is available at [1].
> [1] https://nakryiko.com/posts/bpf-core-reference-guide/

Link to https://docs.kernel.org/bpf/llvm_reloc.html ? Thank you for https://git.kernel.org/linus/be4033d36070e44fba766a21ef2d0c24fa04c377 :)



================
Comment at: llvm/include/llvm/DebugInfo/BTF/BTF.h:101
 
+// Constants for CommonType::Info field.
+constexpr uint32_t FWD_UNION_FLAG = (1u << 31);
----------------
nit: in this case we don't add parens


================
Comment at: llvm/lib/DebugInfo/BTF/BTFContext.cpp:66
   auto Ctx = std::make_unique<BTFContext>();
-  if (Error E = Ctx->BTF.parse(Obj))
+  BTFParser::ParseOptions Opts = {};
+  Opts.LoadLines = true;
----------------



================
Comment at: llvm/lib/DebugInfo/BTF/BTFParser.cpp:539
+
+struct StrOrAnon {
+  const BTFParser &BTF;
----------------
`namespace { ... }` per https://llvm.org/docs/CodingStandards.html#anonymous-namespaces


================
Comment at: llvm/unittests/DebugInfo/BTF/BTFParserTest.cpp:381
+
+  unsigned totalTypes() { return TotalTypes; }
+
----------------



================
Comment at: llvm/unittests/DebugInfo/BTF/BTFParserTest.cpp:1006
+    ASSERT_TRUE(Type);
+    ASSERT_EQ(BTF.findString(Type->NameOff), Name);
+  };
----------------
EXPECT_EQ as findString is non-fatail if failed

http://google.github.io/googletest/reference/assertions.html


================
Comment at: llvm/unittests/DebugInfo/BTF/BTFParserTest.cpp:1074
+
+  ASSERT_TRUE(BTF1.findLineInfo({0, 1}));
+  ASSERT_FALSE(BTF2.findLineInfo({0, 1}));
----------------
These `find*` calls can use `EXPECT` (nonfatal if failed)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D150079/new/

https://reviews.llvm.org/D150079



More information about the llvm-commits mailing list