[PATCH] D76114: [MC] Recalculate fragment offsets after relaxation
Jian Cai via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 13 17:49:59 PDT 2020
jcai19 updated this revision to Diff 250329.
jcai19 added a comment.
Update based on comments from https://reviews.llvm.org/D76166.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D76114/new/
https://reviews.llvm.org/D76114
Files:
llvm/lib/MC/MCAssembler.cpp
llvm/test/MC/X86/relax-offset.s
Index: llvm/test/MC/X86/relax-offset.s
===================================================================
--- /dev/null
+++ llvm/test/MC/X86/relax-offset.s
@@ -0,0 +1,13 @@
+# RUN: llvm-mc -filetype=obj -triple=i386 %s | llvm-objdump - --headers | FileCheck %s
+
+ # CHECK: .text1 00000005 00000000
+ # CHECK: .text2 00000005 00000000
+
+ .section .text1
+ .skip after-before,0x0
+.Lint80_keep_stack:
+
+ .section .text2
+before:
+ jmp .Lint80_keep_stack
+after:
Index: llvm/lib/MC/MCAssembler.cpp
===================================================================
--- llvm/lib/MC/MCAssembler.cpp
+++ llvm/lib/MC/MCAssembler.cpp
@@ -785,9 +785,15 @@
}
// Layout until everything fits.
- while (layoutOnce(Layout))
+ while (layoutOnce(Layout)) {
if (getContext().hadError())
return;
+ // Size of fragments in one section can depend on the size of fragments in
+ // another. If any fragment has changed size, we have to re-layout (and
+ // as a result possibly further relax) all.
+ for (MCSection &Sec : *this)
+ Layout.invalidateFragmentsFrom(&*Sec.begin());
+ }
DEBUG_WITH_TYPE("mc-dump", {
errs() << "assembler backend - post-relaxation\n--\n";
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D76114.250329.patch
Type: text/x-patch
Size: 1219 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200314/11d93870/attachment.bin>
More information about the llvm-commits
mailing list