From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf1-x444.google.com (mail-pf1-x444.google.com [IPv6:2607:f8b0:4864:20::444]) by sourceware.org (Postfix) with ESMTPS id 03A01393C873 for ; Wed, 2 Sep 2020 14:29:36 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 03A01393C873 Received: by mail-pf1-x444.google.com with SMTP id d22so2935188pfn.5 for ; Wed, 02 Sep 2020 07:29:35 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=r8yMnnzf2OkhWzFtay88LmXz26N3vrpxhiHxZEYhe3o=; b=AkFsHt4noJ4jhZAKFWBM/aIBdNeElbS+r0+eWexSQUlLWb5513UDpPsiyeno1S80Pk wAPumT/SAAuxL6LUFXI04mGETXTg/jfVV14duQgK2f0+/GjezsGCBiRqYUrHX7KkML8J LzbTvvJi5jqq4f0qN2f+fT6wkBc/kmOQZeOXZJ3Es+bJOXzPutRUFbIB5p0ubRXe3vs6 48HP5V33ij8XUhBcvTWeO69wnShqP2pOv3lsRdoqdGInNPbsuCQJnLvzlwy+OoAHIiRQ e/P9eyMhCmpgyrcH9Me4Ezthe5oBoETnR55SDURe+2UbyG+MOWHOCzNhzHb1PT4MyceS CWWA== X-Gm-Message-State: AOAM530yHrGGuGv62ue8F2+8IKbopENaucPV4w1jfO+e86/GEeCo/IVK km67CJbJp9lXE/JNoxAoKACfQQ/uGD4= X-Google-Smtp-Source: ABdhPJzZYyOSlZFMThI1CJv+M20SereCGE+BwOaIckNZtH97OSCK7aJbn5vxfuZwJyy37PNjliAXXA== X-Received: by 2002:aa7:9316:: with SMTP id 22mr3518759pfj.65.1599056975213; Wed, 02 Sep 2020 07:29:35 -0700 (PDT) Received: from bubble.grove.modra.org ([2406:3400:51d:8cc0:84c2:3a8b:c3d4:afab]) by smtp.gmail.com with ESMTPSA id u14sm5847902pfm.103.2020.09.02.07.29.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Sep 2020 07:29:34 -0700 (PDT) Received: by bubble.grove.modra.org (Postfix, from userid 1000) id 7EE1D8796C; Wed, 2 Sep 2020 23:59:30 +0930 (ACST) Date: Wed, 2 Sep 2020 23:59:30 +0930 From: Alan Modra To: "H.J. Lu" Cc: Martin =?utf-8?B?TGnFoWth?= , Binutils Subject: Re: [PATCH] elf: Don't load archive element after dynamic definition Message-ID: <20200902142930.GJ15695@bubble.grove.modra.org> References: <20200828015847.GG15695@bubble.grove.modra.org> <20200828144914.GP15695@bubble.grove.modra.org> <20200902081225.GH15695@bubble.grove.modra.org> <20200902130522.GI15695@bubble.grove.modra.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) X-Spam-Status: No, score=-5.4 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: Wed, 02 Sep 2020 14:29:37 -0000 On Wed, Sep 02, 2020 at 06:22:08AM -0700, H.J. Lu wrote: > > It's reasonably obvious that we need to load archive elements when > > they define IR referenced symbols, because the archive element might > > be an LTO object. What's not so obvious is whether loading of shared > > libraries should follow the same rule. I think they should, in order > > for LTO to get symbol resolution correct in corner cases. Basically > > LTO needs to know what shared libraries are loaded before > > recompilation. See commit a896df97b952 log comments. > > There is dynamic_def for this purpose. Your patch doesn't make changes to ld/plugin.c to inform LTO of the availability of these symbols. And if you did, then how does the linker work out whether or not the LTO recompilation depended on those symbols? If it did change LTO recompilation then you had better ensure the library really is loaded. By the time you work all of that out, if it is even possible, your patch will likely be very complicated indeed. -- Alan Modra Australia Development Lab, IBM