From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-qt1-x833.google.com (mail-qt1-x833.google.com [IPv6:2607:f8b0:4864:20::833]) by sourceware.org (Postfix) with ESMTPS id 327DF386076B for ; Sat, 22 Jul 2023 03:12:26 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 327DF386076B Authentication-Results: sourceware.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=google.com Received: by mail-qt1-x833.google.com with SMTP id d75a77b69052e-4036bd4fff1so152621cf.0 for ; Fri, 21 Jul 2023 20:12:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1689995545; x=1690600345; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=N7UfGd0R58rM0vvNXTkskp06ugE4gqrrbFRRuBN9ilk=; b=7ljCB5H4EgCwMh7Xg95opHH5jcNvkZAdawA+ZbmeorI6rJKk6cY9WtS7Ivry05QHwp O+oxXpDorbTMOiOHoP90ZNUNWF1p1gM6KR6VLzFrRpR12yQ0lF4O0G4cnoY/YvfEN8XF nz5zlQ+XhyWu4bpyFYj8Fb/P5Y1+sepjXCY/5md/HuWzbeTIY0/uRExxES90QkuJMrp+ Q5JOfhNTriRLnjAFB/qFiF3q3SoSSND7aBFy4dLMU+OAM4ZmeD66J01OT3b4n7/vwMyp IqFPFzhLrjBOEX2DRLQXCo7C6K3DQSXJsnOrFdxkaluy2WQLXwjZjeqqv7I6qq3HFosL h9cg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689995545; x=1690600345; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=N7UfGd0R58rM0vvNXTkskp06ugE4gqrrbFRRuBN9ilk=; b=ZtMlQ4m1Wc0aoFHoO6zpj9O5P5oXdfvkFakc9D8kaRnis0Ss3WVRyFmnZ6Y+zKi86q hHhu0gHw29+pUL9r04DiSz5SmuxYVaD9Dp+hc1ZESFwm7yGZMVPBIqt/vqKsT0XFip/P nC7rfAr+Pi7oTBhqEzBDmJYj5/AlaUhRKZhSQHCojPmgq/LqHaMTpJ5tGgIRCwgToIGX pstyrMQjz9/6QoehV74Z0owxCRvroMn97M+YtFh02H2Zq0tvd29KuyDYeh9ZB4d14onm EwN7uQ4LDlSTyXv9tIkUvrqiidKjYNNjlzJ6V6VbSQ6ow+Vur+7iTYdUy8G/q3dKSYVO ttCQ== X-Gm-Message-State: ABy/qLaQponv0+F+OiHWPbcUFBpU9TgdgnCg5KnTgfTqjHknwvAObiG6 uzQp3D4JrIMjhV2m2Sidcsbi5Ie2tUGt2RavHuLfag== X-Google-Smtp-Source: APBJJlHim5tAzOZftA32GFGSS/oPqLqVflrKl8ywNYvZOo7zIuPwqS8+lKQLvmUbQiJb4yPA8nsqx+QAMaw/M77nh9s= X-Received: by 2002:a05:622a:1b8c:b0:3f9:a78f:c527 with SMTP id bp12-20020a05622a1b8c00b003f9a78fc527mr84462qtb.21.1689995544906; Fri, 21 Jul 2023 20:12:24 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Fangrui Song Date: Fri, 21 Jul 2023 20:12:13 -0700 Message-ID: Subject: Re: [PATCH v4] Introduce attribute sym To: Alexandre Oliva Cc: Richard Biener , Jan Hubicka , Nathan Sidwell , gcc-patches@gcc.gnu.org, jason@redhat.com, joseph@codesourcery.com, hainque@adacore.com, ebotcazou@adacore.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-18.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Wed, Jul 19, 2023 at 4:12=E2=80=AFPM Alexandre Oliva via Gcc-patches wrote: > > On Jul 18, 2023, Richard Biener 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" :)