[llvm] [MC] Maintain MCRelaxAll after reset() (PR #94945)

via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 10 02:30:33 PDT 2024


https://github.com/aengelke created https://github.com/llvm/llvm-project/pull/94945

RelaxAll was set in the constructor, but cleared after reset().


>From 870709b395847b9693afa2ba3bf3883130259650 Mon Sep 17 00:00:00 2001
From: Alexis Engelke <engelke at in.tum.de>
Date: Mon, 10 Jun 2024 11:21:01 +0200
Subject: [PATCH] [MC] Maintain MCRelaxAll after reset()

RelaxAll was set in the constructor, but cleared after reset().
---
 llvm/lib/MC/MCObjectStreamer.cpp | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/llvm/lib/MC/MCObjectStreamer.cpp b/llvm/lib/MC/MCObjectStreamer.cpp
index 0ccade91677a4..8d3873bed9efd 100644
--- a/llvm/lib/MC/MCObjectStreamer.cpp
+++ b/llvm/lib/MC/MCObjectStreamer.cpp
@@ -175,8 +175,11 @@ void MCObjectStreamer::emitAbsoluteSymbolDiffAsULEB128(const MCSymbol *Hi,
 }
 
 void MCObjectStreamer::reset() {
-  if (Assembler)
+  if (Assembler) {
     Assembler->reset();
+    if (getContext().getTargetOptions())
+      Assembler->setRelaxAll(getContext().getTargetOptions()->MCRelaxAll);
+  }
   CurInsertionPoint = MCSection::iterator();
   EmitEHFrame = true;
   EmitDebugFrame = false;



More information about the llvm-commits mailing list