[PATCH] D79089: [flang] Add the proposal document and rationale for the internal naming module that was previously added.

Eric Schweitz via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 30 07:21:32 PDT 2020


schweitz added a comment.

In D79089#2011949 <https://reviews.llvm.org/D79089#2011949>, @kiranchandramohan wrote:

> Could you comment on whether this mangling will have any effect on interfacing with C/C++? Will this have any effects on LTO. What happens if a bind name is specified?
>  http://web.mit.edu/tibbetts/Public/inside-c/www/mangling.html


Hi Kiran,

Good questions and thanks for asking.

The hope is that this mangling will not conflict with C and C++, of course. None of the languages (C, C++, or Fortran) have a standard mangling. C reserves the underscore, double underscore, and underscore capital letter prefixes [1],[2]. A description of a common C++ name mangling scheme is [3],[your link]. It seems like the only common thing about Fortran name mangling implementations is that different vendors have their own, as can be experimented with [4].

The uniquing scheme described in this document has some similarities and differences to other mangling schemes, but it was designed to minimize collisions with those spaces.

As far as using bind C names, the plan is to just use the bind C name directly as it should never have the prefix marker "_Q", so it will be recognized as a symbol name that was not uniqued. That may or may not be sufficient depending other unknowns. (We are similarly targeting llvm intrinsic functions in our present work.) The fallback plan would be to unique the name and then relabel when lowering to LLVM.

The bidirectional ability and flexibility are key objectives. It means that it may be the case that these names are never exposed to the LLVM layer, in the object files, to the linker, etc. Since this scheme can recover the symbols from the front-end, the symbols can themselves be lowered as a conversion and in a target-dependent manner.

[1] https://stackoverflow.com/questions/39625352/why-do-some-functions-in-c-have-an-underscore-prefix
[2] http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf
[3] https://itanium-cxx-abi.github.io/cxx-abi/abi.html#mangling
[4] https://fortran.godbolt.org/


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D79089





More information about the llvm-commits mailing list