diff options
author | Fangrui Song <i@maskray.me> | 2024-07-02 15:19:28 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-07-02 15:19:28 -0700 |
commit | 21276fd7beb640d5fb1a10c228c9f48f620a8eac (patch) | |
tree | 52f0790c3bfae0c6576131eef59bffd676f3ec0f /llvm/lib/MC/MCMachOStreamer.cpp | |
parent | 9ed4b171e95e9704286a5406c41a9a14580e2c42 (diff) | |
download | llvm-21276fd7beb640d5fb1a10c228c9f48f620a8eac.zip llvm-21276fd7beb640d5fb1a10c228c9f48f620a8eac.tar.gz llvm-21276fd7beb640d5fb1a10c228c9f48f620a8eac.tar.bz2 |
[MC] Don't treat altentry symbols as atoms
The current `setAtom` is inaccurate: a `.alt_entry` label can also be
recognized as an atom. This is mostly benign, but might cause two
locations only separated by an `.alt_entry` to have different atoms.
https://reviews.llvm.org/D153167 changed a `evaluateKnownAbsolute` to
`evaluateAsAbsolute` and would not fold `A-B` even if they are only
separated by a `.alt_entry` label, leading to a spurious error
`invalid CFI advance_loc expression`.
The fix is similar to #82268: add a special case for `.alt_entry`.
Fix #97116
Pull Request: https://github.com/llvm/llvm-project/pull/97479
Diffstat (limited to 'llvm/lib/MC/MCMachOStreamer.cpp')
-rw-r--r-- | llvm/lib/MC/MCMachOStreamer.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/MC/MCMachOStreamer.cpp b/llvm/lib/MC/MCMachOStreamer.cpp index d67b958..0b34d87 100644 --- a/llvm/lib/MC/MCMachOStreamer.cpp +++ b/llvm/lib/MC/MCMachOStreamer.cpp @@ -508,7 +508,7 @@ void MCMachOStreamer::finishImpl() { DenseMap<const MCFragment *, const MCSymbol *> DefiningSymbolMap; for (const MCSymbol &Symbol : getAssembler().symbols()) { if (getAssembler().isSymbolLinkerVisible(Symbol) && Symbol.isInSection() && - !Symbol.isVariable()) { + !Symbol.isVariable() && !cast<MCSymbolMachO>(Symbol).isAltEntry()) { // An atom defining symbol should never be internal to a fragment. assert(Symbol.getOffset() == 0 && "Invalid offset in atom defining symbol!"); |