public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Alexandre Oliva <oliva@adacore.com>
To: Iain Sandoe <iain@sandoe.co.uk>
Cc: Eric Botcazou <ebotcazou@adacore.com>,
	Andrew MacLeod via Gcc-patches <gcc-patches@gcc.gnu.org>,
	Nathan Sidwell <nathan@acm.org>,
	joseph@codesourcery.com
Subject: Re: [PATCH] introduce attribute exalias
Date: Tue, 25 Aug 2020 05:34:09 -0300	[thread overview]
Message-ID: <orimd76s5a.fsf@livre.home> (raw)
In-Reply-To: <F70D6582-8E4B-4CE5-B998-70106355E5AB@sandoe.co.uk> (Iain Sandoe's message of "Sat, 15 Aug 2020 19:17:09 +0100")

On Aug 15, 2020, Iain Sandoe <iain@sandoe.co.uk> wrote:

> Alexandre Oliva <oliva@adacore.com> wrote:

>> I'm pretty sure setting multiple labels at the same address is used
>> and relied on quite often.

> That’s what’s currently disallowed (the assemblers all support .set).

I understand you mean it's disallowed for global labels.  I meant it was
often used for local labels.


> For function aliases, I think there’s a simple work-around and it’s just a
> question of time for me to make a patch etc.

Yeah, one possibility that comes to mind is to output additional text
symbols (akin to PLT entries) that just jump to the intended target.

> for general aliases to public symbols including data, not so easy.

*nod*

As far as I'm concerned, function aliases as above would be enough to
address the issue I was asked to address.  The RTTI aliases are only
used to import and catch C++ exception in Ada.  I suppose a mnemonic
would be just as welcome, but if it's not available, the mangled name
will have to do.


> Actually, I was thinking about folks who like template metaprogramming
> (not personally a fan) - and how they would arrange to get automatic
> export information to track that meta-progamming.

There's no (current) way to import C++ templates as Ada generics; the
best you can do is to import C++ template instantiations/specializations
as Ada records, procedures and functions.  This, and the lack of a
symbolic representation of generics, has driven me to introduce
user-chosen named aliases for specializations, rather than to the
generics.

I've considered enabling symbolic mnemonic template names to be
associated with templates, say:

template <typename T, typename U>
struct foo {
  static void __attribute__((__exalias__("FOO_%<T>_%<U>_static_method")))
  static_method () {}
};

replacing %<T> and %<U> with the mangling for the template arguments,
but that would bring us back the problem of varying mangled names as
mnemonic types like u64 get resolved to the mangling of their
target-dependent language types, defeating the purpose of referencing
cross-platform symbol names from Ada.

> Thinking aloud  - not thought through in any detail - I wonder if the
> facilities of
> C++20 modules are sufficient?

I'm really not sure what issue you're thinking of solving.

The one I'm working on is that of enabling the use of a uniform string
in Ada import statements (and also in alias("targets")), even when a
symbolic type that does not mangle uniformly is in use (think int64_t
mapping to long or long long).  Having per-target source files is quite
cumbersome in Ada, and there isn't a preprocessor to rely on for
conditionals and token pasting and whatnot.

I'm afraid I don't see how C++ modules could any offer in this regard.


>> Hmm, thanks, I will make sure there's some more verbose failure mode if
>> we can't find a way for something akin to an alias to be usable there.

> I imagine it will be easy to fix a diagnostic output.

*nod*

-- 
Alexandre Oliva, happy hacker
https://FSFLA.org/blogs/lxo/
Free Software Activist
GNU Toolchain Engineer

  reply	other threads:[~2020-08-25  8:34 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
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 [this message]
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=orimd76s5a.fsf@livre.home \
    --to=oliva@adacore.com \
    --cc=ebotcazou@adacore.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=iain@sandoe.co.uk \
    --cc=joseph@codesourcery.com \
    --cc=nathan@acm.org \
    /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).