================ @@ -1809,6 +1814,255 @@ void AArch64AsmPrinter::emitInstruction(const MachineInstr *MI) { EmitToStreamer(*OutStreamer, TmpInst); } +void AArch64AsmPrinter::emitGlobalIFunc(Module &M, const GlobalIFunc &GI) { + if (!TM.getTargetTriple().isOSBinFormatMachO()) + return AsmPrinter::emitGlobalIFunc(M, GI); + + // On Darwin platforms, emit a manually-constructed .symbol_resolver that + // implements the symbol resolution duties of the IFunc. + // + // Normally, this would be handled by linker magic, but unfortunately there + // are a few limitations in ld64 and ld-prime's implementation of + // .symbol_resolver that mean we can't always use them: + // + // * resolvers cannot be the target of an alias + // * resolvers cannot have private linkage + // * resolvers cannot have linkonce linkage + // * resolvers cannot appear in executables + // * resolvers cannot appear in bundles + // + // This works around that by emitting a close approximation of what the linker + // would have done. + + auto EmitLinkage = [&](MCSymbol *Sym) { + if (GI.hasExternalLinkage() || !MAI->getWeakRefDirective()) ---------------- MaskRay wrote:
`MAI->getWeakRefDirective()` is always true for Mach-O. https://github.com/llvm/llvm-project/pull/73686 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits