Message ID | 20240802112505.190542-1-hjl.tools@gmail.com |
---|---|
State | Superseded |
Headers |
Return-Path: <binutils-bounces~patchwork=sourceware.org@sourceware.org> X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 5220E3858430 for <patchwork@sourceware.org>; Fri, 2 Aug 2024 11:25:40 +0000 (GMT) X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from mail-ed1-x534.google.com (mail-ed1-x534.google.com [IPv6:2a00:1450:4864:20::534]) by sourceware.org (Postfix) with ESMTPS id 6F9EF3858D20 for <binutils@sourceware.org>; Fri, 2 Aug 2024 11:25:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 6F9EF3858D20 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 6F9EF3858D20 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::534 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1722597913; cv=none; b=GxXvoJQfRV0N1GT2Fnz3aH5pJlH0A5sCgFYfDsaq607rNkskz+B8G4W0j4Hgavxj4wIlW/7+lFIvhcsToY3FM3M9vOaf3gX/aTlwSYOetNhNaHAx3dslh/Z78D2P3sz7URnA2JOARXHY7zH3URjvLsELIjmkJlWTsu3mWOFM64k= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1722597913; c=relaxed/simple; bh=z5SO9WvWt1c0EF2j6HkR4vgjPbEi8yHM9nek6+7csF0=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=DAl256eRzo8sO7b2uUNgUFsYxMNSbIwQvD9oI4YAocheRiMgEAly0jdSMmbCgKcR83DFNn7wBq0A5ofsl1qlhfXtV/Bs+vuBhkqWgCoz4XUaID/4bcFi954roTsKZizoYZ7XLkEXaHakiMbFi1r1AxMWABft9ZpqRBfkD503mKM= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-ed1-x534.google.com with SMTP id 4fb4d7f45d1cf-5b8c2a6135dso494210a12.1 for <binutils@sourceware.org>; Fri, 02 Aug 2024 04:25:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1722597910; x=1723202710; darn=sourceware.org; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date:message-id:reply-to; bh=J4K9G1fD1RxjORU05HXuNTer1a9L94IyRclLSj1Prp4=; b=T+LwYxdQOHbPU/2qMfkqIQDz28Iwaj+taCbErPI0aNgY0Dzb9D2CT3cJ6pp+hC9YEH 5Gq4HXKAezZsqa54fWt0afD44nQGUHAHdRToZypOEgWbbvC/9SQ0yCBZFhnC4Fqg7GXN eYBxh9AVfeEDGvhx8b2e5JxYoq/A/Ce+f362b+ZgNjdzbj+11LM0tlA97rwY4vzlyrT1 1iOTK0l9L5rMHgbmqcv9z3HUb38BoiyVR6Z0bsIl0xCSsHjf3x3JbInhVDR9dU8Xzkj4 JU/shpdgAHYJu5GPn/DYi8ul7vfpz3f2TzKYv7I9Jf5BMdHOY4j4oHNKrUNyRGykw3bl 8Jvw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722597910; x=1723202710; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=J4K9G1fD1RxjORU05HXuNTer1a9L94IyRclLSj1Prp4=; b=Mc6QyiPpr4FBoKYsCpwse1ud5vjO8gU0IuwE6OY0Esqofr/2/8wfv+TV5JBjX/6v1K adhNcpwR2k5noUls/n/ZgbXgwl8j1E5B/sspXfEs6kpJZqD5iZQUUDqBwW2AgNYt8w0j VhzcNmHqUIOwE6nN+nei9AZv0tcrk+YaiSjwjMV0IhzDHQl+9ksQEQinQ6kCCdghVuLn sVIx4yNMao5svroA7KmIdEwjlsKMC0i7cR7IIrFt6JWAPjHQYqqI9kEvwiRRb9z+k+ke xakIPZV5iQ9DQbp9+ApMp055Rx+4hn6H0P2oEDwMozeOXi9leYFkoHXA2V7PfG8xo59k L0GQ== X-Gm-Message-State: AOJu0Ywf278qgc9PctSo5ic/Ciyh8i2IflNEBSin078Kjq7ciWVXFW5v 64aSPcYumc7KzZ4B7zydMBrKjlGrDdGv3Nbv/J8kNO7f+so5IQd8NjRGRwGQ8/o= X-Google-Smtp-Source: AGHT+IEmWz/IZAgYC2v8JUErELSi033/UqkLM+EJCA4Rn2EKHxbgdS80vzLB6fjzZir8cnYpumaoug== X-Received: by 2002:a17:906:da8a:b0:a77:dd1c:6274 with SMTP id a640c23a62f3a-a7dc5124d64mr176236666b.69.1722597909444; Fri, 02 Aug 2024 04:25:09 -0700 (PDT) Received: from gnu-tgl-3.localdomain ([105.160.25.56]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a7dc9ec7266sm87951666b.196.2024.08.02.04.25.08 for <binutils@sourceware.org> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Aug 2024 04:25:09 -0700 (PDT) Received: from gnu-tgl-3.. (localhost [IPv6:::1]) by gnu-tgl-3.localdomain (Postfix) with ESMTP id 5C2C5C01AB for <binutils@sourceware.org>; Fri, 2 Aug 2024 04:25:05 -0700 (PDT) From: "H.J. Lu" <hjl.tools@gmail.com> To: binutils@sourceware.org Subject: [PATCH] LTO: Restore the wrapper symbol check before reference Date: Fri, 2 Aug 2024 04:25:05 -0700 Message-ID: <20240802112505.190542-1-hjl.tools@gmail.com> X-Mailer: git-send-email 2.45.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3021.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: binutils@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Binutils mailing list <binutils.sourceware.org> List-Unsubscribe: <https://sourceware.org/mailman/options/binutils>, <mailto:binutils-request@sourceware.org?subject=unsubscribe> List-Archive: <https://sourceware.org/pipermail/binutils/> List-Post: <mailto:binutils@sourceware.org> List-Help: <mailto:binutils-request@sourceware.org?subject=help> List-Subscribe: <https://sourceware.org/mailman/listinfo/binutils>, <mailto:binutils-request@sourceware.org?subject=subscribe> Errors-To: binutils-bounces~patchwork=sourceware.org@sourceware.org |
Series |
LTO: Restore the wrapper symbol check before reference
|
|
Checks
Context | Check | Description |
---|---|---|
linaro-tcwg-bot/tcwg_binutils_build--master-arm | success | Build passed |
linaro-tcwg-bot/tcwg_binutils_build--master-aarch64 | success | Build passed |
linaro-tcwg-bot/tcwg_binutils_check--master-aarch64 | success | Test passed |
linaro-tcwg-bot/tcwg_binutils_check--master-arm | success | Test passed |
Commit Message
H.J. Lu
Aug. 2, 2024, 11:25 a.m. UTC
Call unwrap_hash_lookup to check for the wrapper symbol before the wrapped
reference. The testcase is hard to create since for simple tests, GCC 14
always outputs the wrapped reference first.
PR ld/31956
* plugin.c (get_symbols): Restore the wrapper symbol check before
the wrapped reference.
Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
---
ld/plugin.c | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
Comments
On Fri, Aug 2, 2024 at 4:25 AM H.J. Lu <hjl.tools@gmail.com> wrote: > > Call unwrap_hash_lookup to check for the wrapper symbol before the wrapped > reference. The testcase is hard to create since for simple tests, GCC 14 > always outputs the wrapped reference first. > > PR ld/31956 > * plugin.c (get_symbols): Restore the wrapper symbol check before > the wrapped reference. > > Signed-off-by: H.J. Lu <hjl.tools@gmail.com> > --- > ld/plugin.c | 14 ++++++++++++-- > 1 file changed, 12 insertions(+), 2 deletions(-) > > diff --git a/ld/plugin.c b/ld/plugin.c > index 03ee9880d10..51c4765cc5b 100644 > --- a/ld/plugin.c > +++ b/ld/plugin.c > @@ -778,8 +778,18 @@ get_symbols (const void *handle, int nsyms, struct ld_plugin_symbol *syms, > { > blhe = h; > /* Check if a symbol is a wrapper symbol. */ > - if (blhe && blhe->wrapper_symbol) > - wrap_status = wrapper; > + if (blhe) > + { > + if (blhe->wrapper_symbol) > + wrap_status = wrapper; > + else if (link_info.wrap_hash != NULL) > + { > + struct bfd_link_hash_entry *unwrap > + = unwrap_hash_lookup (&link_info, (bfd *) abfd, blhe); > + if (unwrap != NULL && unwrap != h) > + wrap_status = wrapper; This patch works for pcp, but may not be the best. > + } > + } > } > else > { > -- > 2.45.2 >
On Fri, Aug 2, 2024 at 4:30 AM H.J. Lu <hjl.tools@gmail.com> wrote: > > On Fri, Aug 2, 2024 at 4:25 AM H.J. Lu <hjl.tools@gmail.com> wrote: > > > > Call unwrap_hash_lookup to check for the wrapper symbol before the wrapped > > reference. The testcase is hard to create since for simple tests, GCC 14 > > always outputs the wrapped reference first. > > > > PR ld/31956 > > * plugin.c (get_symbols): Restore the wrapper symbol check before > > the wrapped reference. > > > > Signed-off-by: H.J. Lu <hjl.tools@gmail.com> > > --- > > ld/plugin.c | 14 ++++++++++++-- > > 1 file changed, 12 insertions(+), 2 deletions(-) > > > > diff --git a/ld/plugin.c b/ld/plugin.c > > index 03ee9880d10..51c4765cc5b 100644 > > --- a/ld/plugin.c > > +++ b/ld/plugin.c > > @@ -778,8 +778,18 @@ get_symbols (const void *handle, int nsyms, struct ld_plugin_symbol *syms, > > { > > blhe = h; > > /* Check if a symbol is a wrapper symbol. */ > > - if (blhe && blhe->wrapper_symbol) > > - wrap_status = wrapper; > > + if (blhe) > > + { > > + if (blhe->wrapper_symbol) > > + wrap_status = wrapper; > > + else if (link_info.wrap_hash != NULL) > > + { > > + struct bfd_link_hash_entry *unwrap > > + = unwrap_hash_lookup (&link_info, (bfd *) abfd, blhe); > > + if (unwrap != NULL && unwrap != h) > > + wrap_status = wrapper; > > This patch works for pcp, but may not be the best. I sent v2 with the updated commit log. I will add a testcase later. > > > + } > > + } > > } > > else > > { > > -- > > 2.45.2 > > > > > -- > H.J.
On Fri, Aug 2, 2024 at 4:41 AM H.J. Lu <hjl.tools@gmail.com> wrote: > > On Fri, Aug 2, 2024 at 4:30 AM H.J. Lu <hjl.tools@gmail.com> wrote: > > > > On Fri, Aug 2, 2024 at 4:25 AM H.J. Lu <hjl.tools@gmail.com> wrote: > > > > > > Call unwrap_hash_lookup to check for the wrapper symbol before the wrapped > > > reference. The testcase is hard to create since for simple tests, GCC 14 > > > always outputs the wrapped reference first. > > > > > > PR ld/31956 > > > * plugin.c (get_symbols): Restore the wrapper symbol check before > > > the wrapped reference. > > > > > > Signed-off-by: H.J. Lu <hjl.tools@gmail.com> > > > --- > > > ld/plugin.c | 14 ++++++++++++-- > > > 1 file changed, 12 insertions(+), 2 deletions(-) > > > > > > diff --git a/ld/plugin.c b/ld/plugin.c > > > index 03ee9880d10..51c4765cc5b 100644 > > > --- a/ld/plugin.c > > > +++ b/ld/plugin.c > > > @@ -778,8 +778,18 @@ get_symbols (const void *handle, int nsyms, struct ld_plugin_symbol *syms, > > > { > > > blhe = h; > > > /* Check if a symbol is a wrapper symbol. */ > > > - if (blhe && blhe->wrapper_symbol) > > > - wrap_status = wrapper; > > > + if (blhe) > > > + { > > > + if (blhe->wrapper_symbol) > > > + wrap_status = wrapper; > > > + else if (link_info.wrap_hash != NULL) > > > + { > > > + struct bfd_link_hash_entry *unwrap > > > + = unwrap_hash_lookup (&link_info, (bfd *) abfd, blhe); > > > + if (unwrap != NULL && unwrap != h) > > > + wrap_status = wrapper; > > > > This patch works for pcp, but may not be the best. > > I sent v2 with the updated commit log. I will add a testcase later. > I sent v3 with a testcase.
diff --git a/ld/plugin.c b/ld/plugin.c index 03ee9880d10..51c4765cc5b 100644 --- a/ld/plugin.c +++ b/ld/plugin.c @@ -778,8 +778,18 @@ get_symbols (const void *handle, int nsyms, struct ld_plugin_symbol *syms, { blhe = h; /* Check if a symbol is a wrapper symbol. */ - if (blhe && blhe->wrapper_symbol) - wrap_status = wrapper; + if (blhe) + { + if (blhe->wrapper_symbol) + wrap_status = wrapper; + else if (link_info.wrap_hash != NULL) + { + struct bfd_link_hash_entry *unwrap + = unwrap_hash_lookup (&link_info, (bfd *) abfd, blhe); + if (unwrap != NULL && unwrap != h) + wrap_status = wrapper; + } + } } else {