[clang] [compiler-rt] [llvm] [AIX] Implement the ifunc attribute. (PR #153049)

Wael Yehia via llvm-commits llvm-commits at lists.llvm.org
Sun Sep 21 12:01:20 PDT 2025


================
@@ -3361,6 +3382,194 @@ void PPCAIXAsmPrinter::emitModuleCommandLines(Module &M) {
   OutStreamer->emitXCOFFCInfoSym(".GCC.command.line", RSOS.str());
 }
 
+static bool TOCRestoreNeeded(const GlobalIFunc &GI) {
+  auto IsLocalFunc = [&](const Value *V) {
+    if (!isa<Function>(V))
+      return false;
+    auto *F = cast<Function>(V);
+
+    // static functions are local
+    if (F->getLinkage() == GlobalValue::InternalLinkage)
+      return true;
+    // for now, declarations we treat as potentially non-local
+    if (F->isDeclarationForLinker())
+      return false;
+    // hidden visibility definitions cannot be preempted, so treat as local.
+    if (F->getVisibility() == GlobalValue::HiddenVisibility)
----------------
w2yehia wrote:

Here's my observations regarding `dso_local`:
 - clang x86 sets `dso_local` in the following cases:
    1) `-fPIE` (is the default if no pic/pie flags specified)
    2) `-fpic/-fPIC -fno-semantic-interposition`
 - clang ppc linux sets in (1) but not (2) because `-fno-semantic-interposition` is ignored.
 - clang aix never sets dso_local (for regular externals) because -fpic is always ON and cannot be overridden with -fPIE.
hidden/protected/internal visibility doesn't ever set `dso_local`, maybe because it's implicit dso_local.
So for now, I'm not looking at dso_local on AIX.


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


More information about the llvm-commits mailing list