[clang] [clang-tools-extra] [llvm] [llvm] Support IFuncs on Darwin platforms (PR #73686)

Ahmed Bougacha via cfe-commits cfe-commits at lists.llvm.org
Tue Dec 5 16:01:00 PST 2023


================
@@ -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);
----------------
ahmedbougacha wrote:

How about having all the lazy/stub symbol machinery in AsmPrinter proper, and only having target-specific "emit macho stub/helper body" overridable hooks?
I ask because I wondered "when would you have `!MAI->getWeakRefDirective()` for macho?" and noticed that's from the base anyway.  I imagine moving this wouldn't change that, because this'd still be in a macho-specific bit there.  But at least if the ELF base changes, the macho version would be right there next to it ;)  WDYT?

https://github.com/llvm/llvm-project/pull/73686


More information about the cfe-commits mailing list