[PATCH] D122694: [MC][BOLT] Add setter for AllowAtInName

Amir Ayupov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 29 17:02:42 PDT 2022


Amir created this revision.
Herald added a reviewer: rafauler.
Herald added a subscriber: ayermolo.
Herald added a reviewer: maksfb.
Herald added a project: All.
Amir requested review of this revision.
Herald added subscribers: llvm-commits, yota9.
Herald added a project: LLVM.

Use the setter in BOLT to allow printing names with variant kind in the name
(e.g. "func at PLT").
Fixes BOLT buildbot tests that broke after D122516 <https://reviews.llvm.org/D122516>.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D122694

Files:
  bolt/lib/Core/BinaryContext.cpp
  llvm/include/llvm/MC/MCAsmInfo.h


Index: llvm/include/llvm/MC/MCAsmInfo.h
===================================================================
--- llvm/include/llvm/MC/MCAsmInfo.h
+++ llvm/include/llvm/MC/MCAsmInfo.h
@@ -671,6 +671,7 @@
   const char *getCode64Directive() const { return Code64Directive; }
   unsigned getAssemblerDialect() const { return AssemblerDialect; }
   bool doesAllowAtInName() const { return AllowAtInName; }
+  void setAllowAtInName(bool V) { AllowAtInName = V; }
   bool doesAllowQuestionAtStartOfIdentifier() const {
     return AllowQuestionAtStartOfIdentifier;
   }
Index: bolt/lib/Core/BinaryContext.cpp
===================================================================
--- bolt/lib/Core/BinaryContext.cpp
+++ bolt/lib/Core/BinaryContext.cpp
@@ -155,12 +155,17 @@
         Twine("BOLT-ERROR: no register info for target ", TripleName));
 
   // Set up disassembler.
-  std::unique_ptr<const MCAsmInfo> AsmInfo(
+  std::unique_ptr<MCAsmInfo> AsmInfo(
       TheTarget->createMCAsmInfo(*MRI, TripleName, MCTargetOptions()));
   if (!AsmInfo)
     return createStringError(
         make_error_code(std::errc::not_supported),
         Twine("BOLT-ERROR: no assembly info for target ", TripleName));
+  // BOLT creates "func at PLT" symbols for PLT entries. In function assembly dump
+  // we want to emit such name as is using @PLT to convey variant kind to the
+  // assembler. BOLT doesn't rely on the linker so we can override the default
+  // AsmInfo behavior to emit names the way we want.
+  AsmInfo->setAllowAtInName(true);
 
   std::unique_ptr<const MCSubtargetInfo> STI(
       TheTarget->createMCSubtargetInfo(TripleName, "", FeaturesStr));


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D122694.419015.patch
Type: text/x-patch
Size: 1646 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220330/80ad36c6/attachment.bin>


More information about the llvm-commits mailing list