public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Iain Sandoe <iain@sandoe.co.uk>
To: Alexandre Oliva <oliva@adacore.com>
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: Sat, 15 Aug 2020 19:17:09 +0100	[thread overview]
Message-ID: <F70D6582-8E4B-4CE5-B998-70106355E5AB@sandoe.co.uk> (raw)
In-Reply-To: <ormu2vualm.fsf@livre.home>

HI Alexandre

I don’t want to derail the discussion - but FIO mostly….

Alexandre Oliva <oliva@adacore.com> wrote:

> On Aug 15, 2020, Iain Sandoe <iain@sandoe.co.uk> wrote:
>
>> * if the target ABI does not support symbol aliases, then this facility  
>> cannot
>>   be used.
>
> True.  I'm surprised there are modern platforms that don’t.

different platforms have different designs - it’s not an “old c.f
new” thing - see below.

> What is it that stands in the way?  Lack of support for .set in the
> assembler?
>  If that's the case, couldn't it possibly be worked around by
> setting multiple global labels at the same spot?  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).

Long ago (before my time with GCC) Darwin’s toolchains did support
aliases.

The withdrawal was not an accident, but a design choice - where a linker
model based on “atoms” was chosen (which requires [as things stand]
public symbols to have distinct addresses).  I can point you at a description
of the linker optimisation if you’re interested.

IMO, the atom model can be modified to allow aliases (it might be even
that the linker constraint has been relaxed already).

However, it’s not my call - I’ve suggested to the platform toolchain team  
it’s
a good idea, but it doesn’t seem to block any other toolchain than GCC
so not sure what priority would be assigned.

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.

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

>>   will exclude the GCC targets without symbol aliases from Ada.
>
> It's not so dire.  Developers for alias-deprived systems would have to
> use the mangled names instead.  That would be a little painful, but not
> even close to making the language unavailable.

Well the predicate was that the use of the mechanism was mandatory, if
the existing scheme continues of course there’s no issue.

>> * The process shifts the onus on representation to the exporter and thus  
>> there
>>   can now be 3 library vendors who all thought “MY_FOO_FUNC” was the
>>   best representation for an export - these will now clash in the “shorthand”
>>   namespace, although their C++ mangling might well not.
>
> Using this to disqualify the new feature would also disqualify regular
> aliases, that could be used for just the same purpose of making symbols
> available under chosen names:

It wasn’t a comment against the feature - but a comment about shifting the
onus for export information onto the producers (and the fact that one can’t
generally control what they choose to provide in the absence of a  
specification
- which itanium mangling is).

>> * what happens for templates and overloads - presumably the Ada import has
>>   add the relevant (albeit abbreviated) decorations?
>
> They don't matter to the proposed design.  The reason they come up for
> you is that you have a completely different solution in mind that
> requires this kind of resolution.  The one I'm proposing attaches the
> extra aliases directly to the target language entity, be it one of the
> overloads of a member function, be it a specialization of a template
> function.

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.

Solved if one were able to import the interface….

>> —— are there other possibilites to solve the underlying issue?
>
>> C++ mangled names have some proven good properties:
>
>> * they convey all the relevant information about the interface
>> * they are standardized, and work between implementations from different
>>  ‘vendors’ or OSS compilers on the same platform.
>> * they are not going to clash.
>
> * they require so much symbolic information that in order to perform
> mangling you pretty much have to #include all of the relevant C++
> headers.
>
> Consider typedefs, templates with partial or explicit specializations,
> default template arguments, besides the possibility of varying
> definitions across platforms.
>
>> what about annotating the import pragma in some way such that the platform
>> mangling is applied by the compiler?
>
> That would indeed be desirable, but it is unfortunately not viable.

<snipped explanation>

I see.

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

>> *** right now Darwin fails silently (there doesn’t seem to be the usual  
>> error
>> that the target doesn’t support that kind of alias).
>
> 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.

Iain


  reply	other threads:[~2020-08-15 18:17 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 [this message]
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=F70D6582-8E4B-4CE5-B998-70106355E5AB@sandoe.co.uk \
    --to=iain@sandoe.co.uk \
    --cc=ebotcazou@adacore.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=joseph@codesourcery.com \
    --cc=nathan@acm.org \
    --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).