From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pl1-x631.google.com (mail-pl1-x631.google.com [IPv6:2607:f8b0:4864:20::631]) by sourceware.org (Postfix) with ESMTPS id 3B83F3858D20 for ; Thu, 7 Dec 2023 20:53:14 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 3B83F3858D20 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 3B83F3858D20 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::631 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1701982396; cv=none; b=nI6+4ErVYm15Q4ccW9J5fzbBYpk0xPepTS9VEj2YZtHFA1yjS0AYq/B4XFkeksQQa/BxzJipC3nCkNzBi22S6D7zYaQ8HS9BW4SfOWD3s5zNNI2uLgCuADHNiokxMo7JS3IX7+YW0pNrV45WtdchTD08/plvhIyyrneVlplDaRk= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1701982396; c=relaxed/simple; bh=aN0VSvJYbIFkOdua59s9jY7iohTQH3TTmNKzA4gX5BI=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=x9E9WxyPvM+mvjtZO2BgbKkRXhhAjlF+aosd885KBSdYXzsfq7kNvng2081INMWHdaBYBC79cFdQmoHpboZiYwp80ZKenghOojDKhJEnd8OQjxFGKnMOg1JRhAcCsYXYG8LjZSE2ebJ10YI3vryY4nWk/oXtEKyMZvNWaUT1o9Q= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pl1-x631.google.com with SMTP id d9443c01a7336-1d0c93b1173so10491185ad.2 for ; Thu, 07 Dec 2023 12:53:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1701982393; x=1702587193; darn=gcc.gnu.org; h=mime-version:user-agent:message-id:in-reply-to:date:references :organization:subject:cc:to:from:from:to:cc:subject:date:message-id :reply-to; bh=4InVE1ms4hnRfwBeqzLQR8wklXwLGihAnnaIy8ahlIw=; b=DY4JokJyt2onTAlLSqQ8r7VWbtZVHuycf3kPxDa5YUeaKCOVZVfk3QcHYITBb0MDQZ 2XOFpbmhsNl99QCbFJva4O61nZi0Jf+sXWY+fJegUy/SZEl4F6IQCmQXaduNdcOlOglM dPaA33SCz2kODVpshUWZ0qA+KDFTgHtcr24ENcGGtz/vY90jSp1PKWgNCA4qV1iQcVBL niF16bijow26StQvyHNqZ6tD5XjyWSxwPKf/libkHqHoGkQZyPfMz2G3iZwt8pc7Grz8 iGKdp6z6e7lKdfBWLjJDoIpzJziTKWcETJKThqSMXM5PvlVg+FGcDbhDWqpogpFmdFPy R9GQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701982393; x=1702587193; h=mime-version:user-agent:message-id:in-reply-to:date:references :organization:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=4InVE1ms4hnRfwBeqzLQR8wklXwLGihAnnaIy8ahlIw=; b=oG2KlUZC0GEvfcAoPgptYxMg4F1V3QQbz5FRNPAiX9TVHZuPqQ/OCSiPCgNujrO9IE F1Wd/AirwqXgpnQcxE5S14JbwZkStKA1qTar8pN1Rz1tf0MY1gZkoydpj5j2mQ3J1VMA gZWXr6c4H1u0SO6YX8ASk4yDxNDqEwzWdThlAl4vWFR9tyWKl8RMhNy2L9hU8ko5L6zC 4rmLpCp1JxvFjghjI130DRHk9T2gfRwWIDw+wLl4Q8kbUi2y5ji9WIkGFScWX305z8DT mrILvlIC55uD7IZOGWylBccOeHoU95CZHl3RDWfssE6l9+nmLTeLeBsObZqBEyHDiaXK wtBw== X-Gm-Message-State: AOJu0Yx7AlqYrvExW5hwywNte/W2bbbyDuTTq0Wu1NWvjbT5ExobJ1LZ AYSVtt3S/cvJBgLNBiC1/FBrug== X-Google-Smtp-Source: AGHT+IHQvxoUaFw1p+vieADhBWW1GbDu4zpX1ITo2vbUQ98k404CASkhYgrbQG/Bp7MAF1nC7BnXFA== X-Received: by 2002:a17:902:a60c:b0:1cf:5629:a0c6 with SMTP id u12-20020a170902a60c00b001cf5629a0c6mr2677941plq.13.1701982392947; Thu, 07 Dec 2023 12:53:12 -0800 (PST) Received: from free.home ([2804:14c:4d1:44a5:f4d9:b7a4:4fb8:376f]) by smtp.gmail.com with ESMTPSA id bi1-20020a170902bf0100b001cf594f71f3sm239394plb.157.2023.12.07.12.53.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Dec 2023 12:53:12 -0800 (PST) Received: from livre (livre.home [172.31.160.2]) by free.home (8.15.2/8.15.2) with ESMTPS id 3B7KqufF283847 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Thu, 7 Dec 2023 17:52:57 -0300 From: Alexandre Oliva To: Jan Hubicka Cc: Jonathan Wakely , gcc-patches@gcc.gnu.org, Nathan Sidwell , Eric Botcazou , "Joseph S. Myers" Subject: Re: [PATCH v7] Introduce attribute sym_alias Organization: Free thinker, does not speak for AdaCore References: Date: Thu, 07 Dec 2023 17:52:56 -0300 In-Reply-To: (Jan Hubicka's message of "Wed, 6 Dec 2023 11:06:51 +0100") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Scanned-By: MIMEDefang 2.84 X-Spam-Status: No, score=-12.1 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE,WEIRD_QUOTING 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 Dec 6, 2023, Jan Hubicka wrote: >> On Nov 30, 2023, Jan Hubicka wrote: >> >> >> + if (VAR_P (replaced)) >> >> + varpool_node::create_alias (sym_node->decl, replacement); >> >> + else >> >> + cgraph_node::create_alias (sym_node->decl, replacement); >> >> Unfortunately, this change didn't work. Several of the C++ tests >> regressed with it. Going back to same-body aliases, they work. >> >> I suspect this may have to do with the infrastructure put in to deal >> with cdtors clones. > Do you have short testcase for this? attr-sym-alias-[13].C are not too big, and show various regressions with the incremental patchlet below (to be applied on top of v7], but here's a minimal testcase that triggers the problem: struct foo { __attribute__ ((__sym_alias__ ("FOODTR_A"))) ~foo() {} }; foo bar; > THe main oddities with same body > aliases comes from the fact that C++ FE creates them early during > parsing before all declaration flags are finished. *nod*, this is probably why some of the cdtor and even sym_aliases for inline member functions (FOOBAR_B and FOOBAR_C in attr-sym-alias-1.C, and FOOCLS_INT_VIRT in attr-sym-alias-3.C) fail to be output when not using create_same_body_alias. diff --git a/gcc/attribs.cc b/gcc/attribs.cc index abfbbbf6294..65ce610f2d4 100644 --- a/gcc/attribs.cc +++ b/gcc/attribs.cc @@ -2717,8 +2717,8 @@ create_sym_alias_decl (tree decl, tree id) // node = varpool_node::create_extra_name_alias (clone, decl); node = varpool_node::create_alias (clone, decl); else - node = cgraph_node::create_same_body_alias (clone, decl); - // node = cgraph_node::create_alias (clone, decl); + // node = cgraph_node::create_same_body_alias (clone, decl); + node = cgraph_node::create_alias (clone, decl); if (symtab_node *dnode = symtab_node::get_create (decl)) node->copy_visibility_from (dnode); diff --git a/gcc/symtab.cc b/gcc/symtab.cc index 44df52095c1..e40240077f2 100644 --- a/gcc/symtab.cc +++ b/gcc/symtab.cc @@ -1993,8 +1993,8 @@ symtab_node::remap_sym_alias_target (tree replaced, tree replacement) // varpool_node::create_extra_name_alias (sym_node->decl, replacement); varpool_node::create_alias (sym_node->decl, replacement); else - cgraph_node::create_same_body_alias (sym_node->decl, replacement); - // cgraph_node::create_alias (sym_node->decl, replacement); + // cgraph_node::create_same_body_alias (sym_node->decl, replacement); + cgraph_node::create_alias (sym_node->decl, replacement); sym_node->copy_visibility_from (repl_node); } } > Fixup copies some flags such as inline flags, visibility and comdat > groups which can change during parsing process. *nod*, I've run into some of that, and had to add visibility propagation to the sym_aliases to make up for it. But I'm not sure that that's the issue you're getting at. Some sym_aliases don't even get output with this patchlet. FOODTR_A* aliases get created during parsing, when maybe_clone_body creates the dtor clones and their cgraph nodes to set their comdat group. ISTM that it's the later visibility copying because of same body alias that enables the alias declaration to get the same (final) visibility as the declarations they alias. Which suggests that there could be another way to ensure the update takes place, but the best spot for it has so far eluded me. -- Alexandre Oliva, happy hacker https://FSFLA.org/blogs/lxo/ Free Software Activist GNU Toolchain Engineer More tolerance and less prejudice are key for inclusion and diversity Excluding neuro-others for not behaving ""normal"" is *not* inclusive