[PATCH] D112349: [Verifier] Add verification logic for GlobalIFuncs

Itay Bookstein via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 4 09:22:33 PDT 2021


nextsilicon-itay-bookstein added a comment.

> I don't know much about the ELF format... but this works today?  We can define a resolver in a different TU and it WORKS thanks to the linker?  So there is perhaps something?

The ifunc symbol that is emitted in the TU with the undefined resolver loses its connection to the resolver and the calls to the ifunc are instead bound against the resolver itself (which is absolutely not what you want).

  itay> cat specific.c
  #include <stdio.h>
  
  __attribute__((cpu_specific(generic)))
  void single_version(void){
    puts("In single_version generic");
  }
  
  void useage() {
    single_version();
  }
  
  itay> cat dispatch_main.c
  void useage(void);
  
  __attribute__((cpu_dispatch(generic)))
  void single_version(void);
  
  int main()
  {
    useage();
    single_version();
    return 0;
  }
  
  itay> clang -c dispatch_main.c -o dispatch_main.c.o
  itay> clang -c specific.c -o specific.c.o
  itay> clang specific.c.o dispatch_main.c.o -o main
  itay> ./main
  In single_version generic

This line should have been printed twice, not once.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D112349



More information about the llvm-commits mailing list