[PATCH] D140725: [XRay] Emit absolute address for versions less than 2
Lu Weining via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 28 05:21:01 PST 2022
SixWeining created this revision.
SixWeining added reviewers: MaskRay, dberris, ianlevesque.
Herald added subscribers: StephenFan, hiraditya.
Herald added a project: All.
SixWeining requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
D78082 <https://reviews.llvm.org/D78082> changed the absolute address to a PC-relative address if version
is not less than 2. But it didn't differentiate versions when emitting
the xray table in AsmPrinter. This patch handles it.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D140725
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
@@ -3939,20 +3939,25 @@
OutStreamer->switchSection(InstMap);
OutStreamer->emitLabel(SledsStart);
for (const auto &Sled : Sleds) {
- MCSymbol *Dot = Ctx.createTempSymbol();
- OutStreamer->emitLabel(Dot);
- OutStreamer->emitValueImpl(
- MCBinaryExpr::createSub(MCSymbolRefExpr::create(Sled.Sled, Ctx),
- MCSymbolRefExpr::create(Dot, Ctx), Ctx),
- WordSizeBytes);
- OutStreamer->emitValueImpl(
- MCBinaryExpr::createSub(
- MCSymbolRefExpr::create(CurrentFnBegin, Ctx),
- MCBinaryExpr::createAdd(MCSymbolRefExpr::create(Dot, Ctx),
- MCConstantExpr::create(WordSizeBytes, Ctx),
- Ctx),
- Ctx),
- WordSizeBytes);
+ if (Sled.Version >= 2) {
+ MCSymbol *Dot = Ctx.createTempSymbol();
+ OutStreamer->emitLabel(Dot);
+ OutStreamer->emitValueImpl(
+ MCBinaryExpr::createSub(MCSymbolRefExpr::create(Sled.Sled, Ctx),
+ MCSymbolRefExpr::create(Dot, Ctx), Ctx),
+ WordSizeBytes);
+ OutStreamer->emitValueImpl(
+ MCBinaryExpr::createSub(
+ MCSymbolRefExpr::create(CurrentFnBegin, Ctx),
+ MCBinaryExpr::createAdd(
+ MCSymbolRefExpr::create(Dot, Ctx),
+ MCConstantExpr::create(WordSizeBytes, Ctx), Ctx),
+ Ctx),
+ WordSizeBytes);
+ } else {
+ OutStreamer->emitSymbolValue(Sled.Sled, WordSizeBytes);
+ OutStreamer->emitSymbolValue(Sled.Function, WordSizeBytes);
+ }
Sled.emit(WordSizeBytes, OutStreamer.get());
}
MCSymbol *SledsEnd = OutContext.createTempSymbol("xray_sleds_end", true);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D140725.485487.patch
Type: text/x-patch
Size: 1955 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221228/f077d968/attachment.bin>
More information about the llvm-commits
mailing list