diff --git a/llvm/lib/MC/MCMachOStreamer.cpp b/llvm/lib/MC/MCMachOStreamer.cpp index d67b95820a8a9d..0b34d87033b7b4 100644 --- a/llvm/lib/MC/MCMachOStreamer.cpp +++ b/llvm/lib/MC/MCMachOStreamer.cpp @@ -508,7 +508,7 @@ void MCMachOStreamer::finishImpl() { DenseMap DefiningSymbolMap; for (const MCSymbol &Symbol : getAssembler().symbols()) { if (getAssembler().isSymbolLinkerVisible(Symbol) && Symbol.isInSection() && - !Symbol.isVariable()) { + !Symbol.isVariable() && !cast(Symbol).isAltEntry()) { // An atom defining symbol should never be internal to a fragment. assert(Symbol.getOffset() == 0 && "Invalid offset in atom defining symbol!"); diff --git a/llvm/test/MC/MachO/cfi-advance-loc-err.s b/llvm/test/MC/MachO/cfi-advance-loc-err.s index 3143dd84efc638..77b6544cb12d8b 100644 --- a/llvm/test/MC/MachO/cfi-advance-loc-err.s +++ b/llvm/test/MC/MachO/cfi-advance-loc-err.s @@ -9,6 +9,11 @@ _foo: subq $8, %rsp .cfi_adjust_cfa_offset 8 + .alt_entry _bar +_bar: # alt_entry label can appear here as it is not an atom + addq $8, %rsp + .cfi_adjust_cfa_offset -8 + tmp0: # non-private label cannot appear here addq $8, %rsp # CHECK: :[[#@LINE+1]]:3: error: invalid CFI advance_loc expression