[PATCH] D143803: [clang][alias|ifunc]: Add a diagnostic for mangled names

Erich Keane via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Feb 24 06:38:21 PST 2023


erichkeane added a comment.

>> which confuses me because an extern "C" block is not supposed to mangle any names, right? Appreciate any inputs on this.

That IS strange, that has internal linkage, but so the 'extern "C"' doesn't do anything to it, so we choose to just mangle it.  I guess there is some sense in that.  GCC doesn't mangle EITHER of those (so leaving them both causes a multiple definition error!), but there is apparently a runtime error even trying to use an ifunc to those functions.

We COULD just prohibit ifuncs to functions without external linkage, but that is a bigger change than I'm sure I would want to commit to just yet.

As far as this patch, I think there is value with improving this diagnostic, but I'm not sure this is the one.  I don't have a great idea of an alternate, BUT:

  error: ifunc must point to a defined function
  note: the name specified in an ifunc must refer to the <linkage name> (needs better words here for what we mean by the name it needs to call)
  note: function by that name is mangled as %0
  <and notes for each similar name>


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D143803



More information about the cfe-commits mailing list