[llvm] c26c5e4 - [MC] flushPendingLabels: set Atom for new fragment after D71368
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Sun Jun 18 15:14:25 PDT 2023
Author: Fangrui Song
Date: 2023-06-18T15:14:21-07:00
New Revision: c26c5e47ab9ca60835f191c90fa751e9a7dd0f3d
URL: https://github.com/llvm/llvm-project/commit/c26c5e47ab9ca60835f191c90fa751e9a7dd0f3d
DIFF: https://github.com/llvm/llvm-project/commit/c26c5e47ab9ca60835f191c90fa751e9a7dd0f3d.diff
LOG: [MC] flushPendingLabels: set Atom for new fragment after D71368
The newly created MCDataFragment should inherit Atom (see
MCMachOStreamer::finishImpl). I cannot think of a case to test the
behavior, but this is one step towards folding the Mach-O label
difference below and making Mach-O more similar to ELF.
```
.section __DATA,xray_instr_map
lxray_sleds_start1:
.space 16
Lxray_sleds_end1:
.section __DATA,xray_fn_idx
.quad (Lxray_sleds_end1-lxray_sleds_start1)>>4 // error: expected relocatable expression // Mach-O
```
Added:
Modified:
llvm/lib/MC/MCSection.cpp
Removed:
################################################################################
diff --git a/llvm/lib/MC/MCSection.cpp b/llvm/lib/MC/MCSection.cpp
index 883cb5d57963f..9b784a65e755a 100644
--- a/llvm/lib/MC/MCSection.cpp
+++ b/llvm/lib/MC/MCSection.cpp
@@ -116,6 +116,8 @@ void MCSection::flushPendingLabels() {
MCFragment *F = new MCDataFragment();
getFragmentList().insert(CurInsertionPoint, F);
F->setParent(this);
+ if (CurInsertionPoint != begin())
+ F->setAtom(std::prev(CurInsertionPoint)->getAtom());
flushPendingLabels(F, 0, Label.Subsection);
}
}
More information about the llvm-commits
mailing list