From: Nathan Sidwell <nathan@acm.org>
To: Alexandre Oliva <oliva@adacore.com>,
gcc-patches@gcc.gnu.org, jason@redhat.com,
joseph@codesourcery.com
Cc: hainque@adacore.com, ebotcazou@adacore.com
Subject: Re: [PATCH] introduce attribute exalias
Date: Fri, 14 Aug 2020 12:24:00 -0400 [thread overview]
Message-ID: <eb591506-75f5-b039-05ab-354908414fc5@acm.org> (raw)
In-Reply-To: <orzh6xuth0.fsf@livre.home>
On 8/14/20 11:39 AM, Alexandre Oliva wrote:
> Ping?
>
> In case there isn't immediate approval for the patch proper (I suppose
> different parts will require review by different subsystem maintainers),
> I'd appreciate at least community and language lawyers buy-in (or
> turn-down) for the new feature hereby proposed for C-family languages,
> namely, attribute exalias("symbol_name") as a means to have symbol_name
> output as a same-linkage alias for functions, variables, and for C++
> class types' RTTI symbols.
This seems a useful feature. I don;t think it needs language lawyering
-- it's an extension, right? By 'same-linkage', do you mean same
linkage as the *symbol* of the thing it is aliasing, or same linkage as
the language entity it is aliasing? I suspect you mean the former.
I'm sure we can bikeshed the name 'exalias' doesn't seem very mnemonic
to me. 'symbol_alias' or something?
nathan
>
> Thanks in advance,
>
> On Aug 7, 2020, Alexandre Oliva <oliva@adacore.com> wrote:
>
>> Since last week's patchlet, I've delayed the creation of the exalias
>> decls, improved the merging of attributes, minimizing
>> interface/visibility updates, found a better way to assign exaliases to
>> nested explicit instantiations, even after enabling aliases to
>> already-defined types, so now I'm reasonably happy with the patch.
>
>
>> This patch introduces an attribute to add extra aliases to a symbol
>> 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 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
>> exaliases with _Base and _Del suffixes are defined for variants other
>> than complete-object ones.
>
>> Applying the attribute to class types is only valid in C++, and the
>> effect is to attach the alias to the RTTI object associated with the
>> class type.
>
>
>> While working on this, I noticed C++ didn't merge attributes of extern
>> local declarations with those of the namespace-scoped declaration.
>> I've added code to merge the attributes if there is a namespace-scoped
>> declaration, but if there isn't one, there won't be any merging, and
>> the effects are noticeable, as in the added attr-weak-1.C. I'm also
>> slightly concerned that an earlier local decl would go out of sync if
>> a subsequent local decl, say within the same or even in another
>> function, introduces additional attributes in the global decl.
>
>
>> Regstrapped on x86_64-linux-gnu. Ok to install?
>
>
>> (The newly-introduced attr-weak-1.c passes in C, but is marked as XFAIL
>> for C++, so it gets an XPASS in C; I could move it to some C++-only
>> subtree, or drop it altogether and file a PR instead)
>
>> for gcc/ChangeLog
>
>> * attribs.c: Include cgraph.h.
>> (decl_attributes): Allow late introduction of exalias in
>> types.
>> (create_exalias_decl, create_exalias_decls): New.
>> * attribs.h: Declare them.
>> (FOR_EACH_EXALIAS): New macro.
>> * cgraph.c (cgraph_node::create): Create exalias decls.
>> * varpool.c (varpool_node::get_create): Create exalias decls.
>> * cgraph.h (symtab_node::remap_exalias_target): New.
>> * symtab.c (symtab_node::remap_exalias_target): Define.
>> * cgraphunit.c (cgraph_node::analyze): Create alias_target
>> node if needed.
>> (analyze_functions): Fixup visibility of implicit alias only
>> after its node is analyzed.
>> * doc/extend.texi (exalias): Document for variables, functions
>> and types.
>
>> for gcc/ada/ChangeLog
>
>> * doc/gnat_rm/interfacing_to_other_languages.rst: Mention
>> attribute exalias to give RTTI symbols mnemonic names.
>> * doc/gnat_ugn/the_gnat_compilation_model.rst: Mention
>> attribute exalias. Fix incorrect ref to C1 ctor variant.
>
>> for gcc/c-family/ChangeLog
>
>> * c-ada-spec.c (pp_asm_name): Use first exalias if available.
>> * c-attribs.c (handle_exalias_attribute): New.
>> (c_common_attribute_table): Add exalias.
>> (handle_copy_attribute): Do not copy exalias.
>> * c-decl.c (duplicate_decls): Remap exalias target.
>
>> for gcc/cp/ChangeLog
>
>> * class.c (copy_fndecl_with_name): Move/adjust exalias to
>> cdtor variants.
>> (build_cdtor_clones): Drop exalias from primary variant.
>> * cp-tree.h (update_exalias_interface, update_tinfo_exalias):
>> Declare.
>> * decl.c (duplicate_decls): Remap exalias target.
>> (grokfndecl): Tentatively create exalias decls after adding
>> attributes in e.g. a template member function explicit
>> instantiation.
>> * decl2.c (cplus_decl_attributes): Update tinfo exalias.
>> (copy_interface, update_exalias_interface): New.
>> (determine_visibility): Update exalias interface.
>> (tentative_decl_linkage, import_export_decl): Likewise.
>> * name-lookup.c: Include target.h and cgraph.h.
>> (set_local_extern_decl_linkage): Merge attributes with a
>> namespace-scoped decl if one is found. Remap exalias
>> targets, and drop exaliases from the local decl.
>> * optimize.c (maybe_clone_body): Only copy attributes if they
>> haven't been copied yet. Update exalias interface.
>> * rtti.c: Include attribs.h and cgraph.h.
>> (get_tinfo_decl): Copy exalias attributes from type to tinfo
>> decl. Create exalias decls.
>> (update_tinfo_exalias): New.
>
>> for gcc/testsuite/ChangeLog
>
>> * c-c++-common/attr-weak-1.c: New, xfailed.
>> * c-c++-common/torture/attr-exalias-1.c: New.
>> * c-c++-common/torture/attr-exalias-2.c: New.
>> * c-c++-common/torture/attr-exalias-3.c: New.
>> * c-c++-common/torture/attr-exalias-4.c: New.
>> * g++.dg/torture/attr-exalias-1.C: New.
>> * g++.dg/torture/attr-exalias-2.C: New.
>> * g++.dg/torture/attr-exalias-3.C: New.
>> * g++.dg/torture/attr-exalias-4.C: New.
>
> https://gcc.gnu.org/pipermail/gcc-patches/2020-August/551614.html
>
--
Nathan Sidwell
next prev parent reply other threads:[~2020-08-14 16:24 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-29 20:56 [RFC, WIP] " Alexandre Oliva
2020-08-07 17:38 ` [PATCH] " Alexandre Oliva
2020-08-14 15:39 ` Alexandre Oliva
2020-08-14 16:24 ` Nathan Sidwell [this message]
2020-08-14 19:24 ` Alexandre Oliva
2020-08-14 22:12 ` Nathan Sidwell
2020-08-15 2:43 ` Alexandre Oliva
2020-08-15 9:22 ` Iain Sandoe
2020-08-15 16:39 ` Alexandre Oliva
2020-08-15 18:17 ` Iain Sandoe
2020-08-25 8:34 ` Alexandre Oliva
2020-08-25 11:23 ` Iain Sandoe
2020-08-15 17:26 ` Alexandre Oliva
2020-08-15 21:11 ` Nathan Sidwell
2020-08-25 7:50 ` Alexandre Oliva
2023-07-15 1:08 ` [PATCH v3] Introduce attribute reverse_alias Alexandre Oliva
2023-07-15 21:55 ` Nathan Sidwell
2023-07-18 4:29 ` Alexandre Oliva
2023-07-18 11:37 ` Richard Biener
2023-07-19 23:11 ` [PATCH v4] Introduce attribute sym Alexandre Oliva
2023-07-20 13:09 ` Richard Biener
2023-07-21 9:23 ` Alexandre Oliva
2023-07-22 3:12 ` Fangrui Song
2023-08-16 4:27 ` Alexandre Oliva
[not found] ` <orpm2tgrsd.fsf_-_@lxoliva.fsfla.org>
[not found] ` <CAH6eHdQ3vT3MjohuE-izto+K=BMRykY3T-UyWa5-=OTDPM-JsQ@mail.gmail.com>
[not found] ` <ory1h9t6nr.fsf@lxoliva.fsfla.org>
2023-09-20 5:59 ` [PATCH v5] Introduce attribute sym_alias (was: Last call for bikeshedding on attribute sym/exalias/reverse_alias) Alexandre Oliva
2023-11-20 12:54 ` [PATCH v5] Introduce attribute sym_alias Alexandre Oliva
2023-11-22 12:14 ` Richard Biener
2023-11-22 19:16 ` Joseph Myers
2023-11-22 13:13 ` [PATCH v5] Introduce attribute sym_alias (was: Last call for bikeshedding on attribute sym/exalias/reverse_alias) Jan Hubicka
2023-11-30 12:53 ` [PATCH v6] Introduce attribute sym_alias Alexandre Oliva
2023-11-30 15:24 ` Jan Hubicka
2023-12-01 11:25 ` [PATCH v7] " Alexandre Oliva
2023-12-06 2:10 ` [PATCH v8] " Alexandre Oliva
2023-12-06 10:06 ` [PATCH v7] " Jan Hubicka
2023-12-07 20:52 ` Alexandre Oliva
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=eb591506-75f5-b039-05ab-354908414fc5@acm.org \
--to=nathan@acm.org \
--cc=ebotcazou@adacore.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=hainque@adacore.com \
--cc=jason@redhat.com \
--cc=joseph@codesourcery.com \
--cc=oliva@adacore.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).