[all-commits] [llvm/llvm-project] e17bc0: [MC] flushPendingLabels: set Atom for new fragment...
Fangrui Song via All-commits
all-commits at lists.llvm.org
Sun Jun 18 17:50:12 PDT 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: e17bc023f4e5b79f08bfc7f624f8ff0f0cf17ce4
https://github.com/llvm/llvm-project/commit/e17bc023f4e5b79f08bfc7f624f8ff0f0cf17ce4
Author: Fangrui Song <i at maskray.me>
Date: 2023-06-18 (Sun, 18 Jun 2023)
Changed paths:
M llvm/lib/MC/MCSection.cpp
Log Message:
-----------
[MC] flushPendingLabels: set Atom for new fragment after D71368
Fixes: c26c5e47ab9ca60835f191c90fa751e9a7dd0f3d (essentially a no-op)
The newly created MCDataFragment should inherit Atom (see
MCMachOStreamer::finishImpl). To the best of my knowledge, this change cannot be
tested at present, but this is important to ensure
MCExpr.cpp:AttemptToFoldSymbolOffsetDifference gives the same result in case we
evaluate the expression again with a MCAsmLayout.
In the following case,
```
.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 // can be folded without a MCAsmLayout
```
When we have a MCAsmLayout, without this change, evaluating
(Lxray_sleds_end1-lxray_sleds_start1)>>4 again will fail due to
`FA->getAtom() == nullptr && FB.getAtom() != nullptr` in
MachObjectWriter::isSymbolRefDifferenceFullyResolvedImpl, called by
AttemptToFoldSymbolOffsetDifference.
More information about the All-commits
mailing list