- Asm->OutStreamer.EmitLabel(Asm->GetTempSymbol("personality", i));
- const MCSymbol *Sym = Asm->Mang->getSymbol(Personalities[i]);
- unsigned Size = Asm->TM.getTargetData()->getPointerSize();
- Asm->OutStreamer.EmitSymbolValue(Sym, Size);
+ if (!Personalities[i])
+ continue;
+ MCSymbol *Sym = Asm->getSymbol(Personalities[i]);
+ TLOF.emitPersonalityValue(Asm->OutStreamer, Asm->TM, Sym);
+ AtLeastOne = true;
+ }
+
+ if (AtLeastOne && !TLOF.isFunctionEHFrameSymbolPrivate()) {
+ // This is a temporary hack to keep sections in the same order they
+ // were before. This lets us produce bit identical outputs while
+ // transitioning to CFI.
+ Asm->OutStreamer.SwitchSection(
+ const_cast<TargetLoweringObjectFile&>(TLOF).getEHFrameSection());