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

Pirama Arumuga Nainar via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Feb 17 14:34:41 PST 2022


pirama added subscribers: pirama, srhines, kongyi.
pirama added a comment.

Unrelated to missing resolver definition, this change doesn't accommodate resolvers that take parameters.  (Curiously, this verification only fails with ThinLTO).

  // with -flto=full or without -flto=thin, below command works
  $ clang -shared ifunc.cpp -fPIC -fuse-ld=lld -flto=thin
  IFunc resolver has incorrect type
  i32 ()* @_Z5ifuncv
  
  $ cat ifunc.cpp
  #include <stdint.h>
  
  typedef int (*fn_ptr_t)();
  
  int ifunc() __attribute__((ifunc("resolver")));
  
  int ret42() {
    return 42;
  }
  
  extern "C" fn_ptr_t resolver(uint64_t hwcap) {
    return ret42;
  }

I have a change that fixes the above use case but causes some opaque pointer tests to fail.  I'll investigate and upload once they're fixed.

I also noticed that this patch didn't add any test for the "IFunc resolver has incorrect type" errors cases.  It'd be good to add those in a follow-up.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D112349



More information about the cfe-commits mailing list