From abda4d2526342cd057e7bcd86eccf2634e24aacb Mon Sep 17 00:00:00 2001 From: Lang Hames Date: Tue, 15 Mar 2016 04:20:49 +0000 Subject: [MachO] Extend the alt_entry support for aliases added in r263521 to expressions of the form 'a = .' and 'a = Ltmp'. llvm-svn: 263528 --- llvm/lib/MC/MCMachOStreamer.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'llvm/lib/MC/MCMachOStreamer.cpp') diff --git a/llvm/lib/MC/MCMachOStreamer.cpp b/llvm/lib/MC/MCMachOStreamer.cpp index a725163..7f0bfbd9 100644 --- a/llvm/lib/MC/MCMachOStreamer.cpp +++ b/llvm/lib/MC/MCMachOStreamer.cpp @@ -203,10 +203,13 @@ void MCMachOStreamer::EmitLabel(MCSymbol *Symbol) { void MCMachOStreamer::EmitAssignment(MCSymbol *Symbol, const MCExpr *Value) { MCValue Res; - if (Value->evaluateAsRelocatable(Res, nullptr, nullptr)) - if (Res.getSymA() && !Res.getSymB() && Res.getConstant() != 0) - cast(Symbol)->setAltEntry(); - + if (Value->evaluateAsRelocatable(Res, nullptr, nullptr)) { + if (const MCSymbolRefExpr *SymAExpr = Res.getSymA()) { + const MCSymbol &SymA = SymAExpr->getSymbol(); + if (!Res.getSymB() && (SymA.getName() == "" || Res.getConstant() != 0)) + cast(Symbol)->setAltEntry(); + } + } MCObjectStreamer::EmitAssignment(Symbol, Value); } -- cgit v1.1