[PATCH] D116852: bugfix: bpf: DATASEC names might be wrong in the BTF data

Yichun Zhang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 7 21:53:12 PST 2022


agentzh created this revision.
Herald added a subscriber: hiraditya.
agentzh requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

This is because GlobalVariable objects' section fields were almost never set except for user-defined section names. So here we always set the section field.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D116852

Files:
  llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp


Index: llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
===================================================================
--- llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
+++ llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
@@ -590,6 +590,8 @@
   // Determine to which section this global should be emitted.
   MCSection *TheSection = getObjFileLowering().SectionForGlobal(GV, GVKind, TM);

+  ((GlobalVariable *) GV)->setSection(TheSection->getName());
+
   // If we have a bss global going to a section that supports the
   // zerofill directive, do so here.
   if (GVKind.isBSS() && MAI->hasMachoZeroFillDirective() &&


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D116852.398301.patch
Type: text/x-patch
Size: 610 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220108/bb23e8a9/attachment.bin>


More information about the llvm-commits mailing list