From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-io1-xd41.google.com (mail-io1-xd41.google.com [IPv6:2607:f8b0:4864:20::d41]) by sourceware.org (Postfix) with ESMTPS id 1B6913857C48 for ; Wed, 2 Sep 2020 14:36:35 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 1B6913857C48 Received: by mail-io1-xd41.google.com with SMTP id u126so5965152iod.12 for ; Wed, 02 Sep 2020 07:36: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:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=bODgeQ9Y6uxG3EWbraaVU1a3JRMz3GQwoBRCMuIbj38=; b=PLSiB5D285NZKCIZFEGj+oNB1GukF271AzgLUTgrKArvFpyfQdiwTsdzWLTyJW3q09 myW+YdPPm2ptAGlFlqGXloBla8p83Ng6lUsdjEuJEb9SZAWf52NVagflTkVtOoQh+j57 7y8FbBrxj5MIdoX0RH/KnXd+ARZJCBNWpHd3xUn2agau/G1borqBXt+4mmLdgkOZxnrB utlA8SJqss2rMMxKnmxUjdCv0Z2vlkl67U/saBlzD0AY7LU5TYPpf5q5Lwb85JZ7LEUA WhgZb7oUZOkR6V9C/dhDMKHHP+Z6CcKmHwwfyJXshoJZ/sSN5aC81VVNOJLV0LSGw+co yxQg== X-Gm-Message-State: AOAM531Jf4W4gxlyRd3/t5LElWPGjNSACKhghzImg3SgFlJ/nZa0i3lE xQs8a9rclMFtRNm1HoFfZxvNWz2vDDFoee3skzk= X-Google-Smtp-Source: ABdhPJx2zbbjwwHnighDZPK1DK70OR1wWFn1UOSBbvTQbuBAcPASC+QtZey+jhRF/d1llIdIB1+7nVdG5yVc2QQaEcw= X-Received: by 2002:a02:843:: with SMTP id 64mr3571046jac.59.1599057394551; Wed, 02 Sep 2020 07:36:34 -0700 (PDT) MIME-Version: 1.0 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> <20200902142930.GJ15695@bubble.grove.modra.org> In-Reply-To: <20200902142930.GJ15695@bubble.grove.modra.org> From: "H.J. Lu" Date: Wed, 2 Sep 2020 07:35:58 -0700 Message-ID: Subject: Re: [PATCH] elf: Don't load archive element after dynamic definition To: Alan Modra Cc: =?UTF-8?Q?Martin_Li=C5=A1ka?= , Binutils Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-3.3 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:36:36 -0000 On Wed, Sep 2, 2020 at 7:29 AM Alan Modra wrote: > > 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. A testcase? -- H.J.