[PATCH] D15525: [GCC] Attribute ifunc support in llvm

Duncan P. N. Exon Smith via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 17 19:37:35 PST 2015


Since this modifies the IR, please start with an RFC on llvm-dev.
(I just did a search for "ifunc"... sorry if you already posted
one and I'm just incapable of using search correctly.)

I'd be interested, in particular, to hear whether you considered
adding a separate construct rather than piggy-backing on
`GlobalAlias`, and if so, why you rejected that alternative.  It
seems like, semantically, ifuncs are very different from aliases.
A straw-man counter-proposal might be:

  - Move the relevant guts of `GlobalAlias` into a base class,
    maybe called `GlobalIndirectSymbol` (bike shed that).
  - Add a new subclass called `GlobalIFunc`.
  - Use `ifunc` *instead* of `alias` in textual IR (making it a
    separate construct, rather than an attribute).

The main benefit?  Current optimizations/etc. may assume that
`isa<GlobalAlias>(GV)` implies that `GV` is a global alias.  It
seems clearer to use the type hierarchy to differentiate.  It'll
probably be cleaner for new code, as well.

Regardless, please take it to an llvm-dev RFC so we can get more
eyes on it.  (Although given the time of year, you may not get
the usual number of responses over the next couple of weeks...)

> On 2015-Dec-15, at 06:36, Dmitry Polukhin via llvm-commits <llvm-commits at lists.llvm.org> wrote:
> 
> DmitryPolukhin created this revision.
> DmitryPolukhin added a subscriber: llvm-commits.
> Herald added a subscriber: joker.eph.
> 
> This patch add support for GCC attribute((ifunc("resolver"))) for targets that use ELF as object file format. In general ifunc is a special kind of function alias with type @gnu_indirect_function. Patch for Clang http://reviews.llvm.org/D15524
> 
> http://reviews.llvm.org/D15525
> 
> Files:
>  include/llvm/IR/GlobalAlias.h
>  lib/AsmParser/LLLexer.cpp
>  lib/AsmParser/LLParser.cpp
>  lib/AsmParser/LLToken.h
>  lib/Bitcode/Reader/BitcodeReader.cpp
>  lib/Bitcode/Writer/BitcodeWriter.cpp
>  lib/CodeGen/AsmPrinter/AsmPrinter.cpp
>  lib/IR/AsmWriter.cpp
>  lib/IR/Globals.cpp
>  test/Assembler/ifunc-alias.ll
> 
> <D15525.42846.patch>_______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits



More information about the llvm-commits mailing list