From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-io1-xd43.google.com (mail-io1-xd43.google.com [IPv6:2607:f8b0:4864:20::d43]) by sourceware.org (Postfix) with ESMTPS id C603E3857C79 for ; Mon, 20 Jul 2020 23:23:06 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org C603E3857C79 Received: by mail-io1-xd43.google.com with SMTP id v8so19459059iox.2 for ; Mon, 20 Jul 2020 16:23:06 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=0nFBu1N6tRf45JN9tgUYX504lpNEDzghHucjk5KPmCE=; b=m8108LvEvQ0lKCzHS3ERxaMjArz94vulRUOfjtoPxkReq/ioA7CcR/lieq4i+NyZu4 FeCwuT3TMSz3HvxKMRyThVfW5XxmsqwO6Aobc2pPuU84gbb7pEUQSRvriL2TajQdEG7a GDS6aFPVWjk+CLcOPVWYu1w8li9wzzd+lX1ZDvOo2mqPl40QhqJ8089gY8lAMkXz0PV2 4tY+siSpV2dx4UWZXpGwzyIde6iHINxIGVj4uASJwAhvFRoUE+aBw96lT9YZ8fRsdefg 04spFxFBjM8fbRz/BJX/bm7mdfXOyGIw7BOyBsk/suodWvjLt1MEDuTMWRiiLOODll57 0OrQ== X-Gm-Message-State: AOAM530nRP3QPtJV8ypWmcBVp8AAhRIP2cbWEASbjoQbvYCjXTPgwU2i mPYsVFWxh9u+9CNw7FBd9/dNFdgKWHFlpz7wFM4= X-Google-Smtp-Source: ABdhPJyxzX+9Db7OiGkX5/lxeW8hk02Oj00Rv1tN+hCnliVc9TJ7sd9lF4eTOlDJ+BOmbPvCuD1TCOO/AiEaXoeB0do= X-Received: by 2002:a6b:bf85:: with SMTP id p127mr25306652iof.37.1595287386132; Mon, 20 Jul 2020 16:23:06 -0700 (PDT) MIME-Version: 1.0 References: <20200720133429.648959-1-hjl.tools@gmail.com> <20200720231659.GC31072@bubble.grove.modra.org> In-Reply-To: <20200720231659.GC31072@bubble.grove.modra.org> From: "H.J. Lu" Date: Mon, 20 Jul 2020 16:22:30 -0700 Message-ID: Subject: Re: [PATCH] ld: Ignore the new weak definition if needed To: Alan Modra Cc: Binutils Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-3.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: binutils@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Jul 2020 23:23:07 -0000 On Mon, Jul 20, 2020 at 4:17 PM Alan Modra wrote: > > On Mon, Jul 20, 2020 at 06:34:29AM -0700, H.J. Lu via Binutils wrote: > > --- a/bfd/elflink.c > > +++ b/bfd/elflink.c > > @@ -1269,6 +1269,18 @@ _bfd_elf_merge_symbol (bfd *abfd, > > && h->root.type != bfd_link_hash_undefweak > > && h->root.type != bfd_link_hash_common); > > > > + /* NB: Ignore the new weak definition if the old definition comes > > + from the LTO IR object since plugin_notice will turn it into > > + undefweak. */ > > + if (olddef > > + && oldbfd > > + && (oldbfd->flags & BFD_PLUGIN) != 0 > > + && newweak) > > + { > > + *skip = TRUE; > > + return TRUE; > > + } > > + > > /* NEWFUNC and OLDFUNC indicate whether the new or old symbol, > > respectively, appear to be a function. */ > > > > How do you square this with later code in _bfd_elf_merge_symbol? > See PR12696. > > /* Skip weak definitions of symbols that are already defined. */ > if (newdef && olddef && newweak) > { > /* Don't skip new non-IR weak syms. */ > if (!(oldbfd != NULL > && (oldbfd->flags & BFD_PLUGIN) != 0 > && (abfd->flags & BFD_PLUGIN) == 0)) > { > newdef = FALSE; > *skip = TRUE; > } > My patch is wrong. -- H.J.