On Wed, Jul 19, 2023 at 4:12 PM Alexandre Oliva via Gcc-patches <gcc-patches@gcc.gnu.org> wrote: > > On Jul 18, 2023, Richard Biener <richard.guent...@gmail.com> wrote: > > > I think the __symver__ attribute does something similar already so > > maybe use __attribute__((__sym__("foo")))? > > Cool, thanks, that will do. Regstrapped on x86_64-linux-gnu. Ok to > install? > > > This patch introduces an attribute to add extra asm names (aliases) > for a decl when its definition is output. The main goal is to ease > interfacing C++ with Ada, as C++ mangled names have to be named, and > in some cases (e.g. when using stdint.h typedefs in function > arguments) the symbol names may vary across platforms. > > The attribute is usable in C and C++, presumably in all C-family > languages. It can be attached to global variables and functions. In > C++, it can also be attached to class types, namespace-scoped > variables and functions, static data members, member functions, > explicit instantiations and specializations of template functions, > members and classes. > > When applied to constructors or destructor, additional sym aliases > with _Base and _Del suffixes are defined for variants other than > complete-object ones. This changes the assumption that clones always > carry the same attributes as their abstract declarations, so there is > now a function to adjust them.
I wonder whether this attribute can be named "alias" without arguments. alias ("target") is an existing attribute that applies to a declaration. The new "alias" without arguments can apply to definitions. I am just thinking that the semantics of "sym" may confuse users who are familiar with "alias" :)