[PATCH] D131162: [MC][ELF] Mark GNU ABI if ifunc are used

Adhemerval Zanella via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 25 14:19:30 PDT 2022


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGabcb3d58d999: [MC][ELF] Mark GNU ABI if ifunc are used (authored by zatrazz).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D131162/new/

https://reviews.llvm.org/D131162

Files:
  llvm/lib/MC/MCELFStreamer.cpp
  llvm/test/MC/ELF/ifunc-gnu.s


Index: llvm/test/MC/ELF/ifunc-gnu.s
===================================================================
--- /dev/null
+++ llvm/test/MC/ELF/ifunc-gnu.s
@@ -0,0 +1,22 @@
+# REQUIRES: x86-registered-target
+# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux-gnu %s -o -| llvm-readelf -hs - | FileCheck %s
+
+.text
+
+.type  foo_impl, at function
+foo_impl:
+  ret
+
+.type  foo_resolver, at function
+foo_resolver:
+  mov $foo_impl, %rax
+  ret
+
+.type  foo, at gnu_indirect_function
+.set   foo,foo_resolver
+
+## ELFOSABI_NONE is changed to ELFOSABI_GNU. Other OSABI values are unchanged.
+# CHECK:      OS/ABI: UNIX - GNU
+# CHECK:      FUNC    LOCAL  DEFAULT    2 foo_impl
+# CHECK-NEXT: FUNC    LOCAL  DEFAULT    2 foo_resolver
+# CHECK-NEXT: IFUNC   LOCAL  DEFAULT    2 foo
Index: llvm/lib/MC/MCELFStreamer.cpp
===================================================================
--- llvm/lib/MC/MCELFStreamer.cpp
+++ llvm/lib/MC/MCELFStreamer.cpp
@@ -263,6 +263,7 @@
 
   case MCSA_ELF_TypeIndFunction:
     Symbol->setType(CombineSymbolTypes(Symbol->getType(), ELF::STT_GNU_IFUNC));
+    getAssembler().getWriter().markGnuAbi();
     break;
 
   case MCSA_ELF_TypeObject:


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D131162.455714.patch
Type: text/x-patch
Size: 1170 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220825/0633e853/attachment.bin>


More information about the llvm-commits mailing list