Skip to content

Conversation

aengelke
Copy link
Contributor

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

RelaxAll was set in the constructor, but cleared after reset().
@aengelke aengelke requested review from MaskRay and preames June 10, 2024 09:30
@llvmbot llvmbot added the llvm:mc Machine (object) code label Jun 10, 2024
@llvmbot
Copy link
Member

llvmbot commented Jun 10, 2024

@llvm/pr-subscribers-mc

Author: None (aengelke)

Changes

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


Full diff: https://github.com/llvm/llvm-project/pull/94945.diff

1 Files Affected:

  • (modified) llvm/lib/MC/MCObjectStreamer.cpp (+4-1)
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;

Copy link
Member

@MaskRay MaskRay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Eventually we should probably add a testing-only option to call reset early so that these stuff is more testable.

@aengelke aengelke merged commit 7722082 into llvm:main Jun 10, 2024
@aengelke aengelke deleted the mc-maintain-relaxall branch June 10, 2024 18:41
Lukacma pushed a commit to Lukacma/llvm-project that referenced this pull request Jun 12, 2024
RelaxAll was set in the constructor, but cleared after reset().
@HerrCai0907 HerrCai0907 mentioned this pull request Jun 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
llvm:mc Machine (object) code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants