From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by sourceware.org (Postfix) with ESMTPS id A27523858D1E for ; Tue, 29 Nov 2022 13:23:19 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org A27523858D1E Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.de Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id D8EC41F6E6; Tue, 29 Nov 2022 13:23:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1669728198; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=zhsa4kjXaf+YerjH1GujJlBZRUu0s2WJnPpFvGitSZY=; b=j0hwpDjtlWSdkaCwxRb9fQcFCUXBO07z1nbUr/lEQyvD1fOVCwULOIGuZ26uUZqmDdD13J uuaIWAPTRvkNzkFJwCNJ5e75XpIqnLWAQoVPr/Tt5XcmMSgp1Cd494ex4w+b9njNf1Ubwz w3sdoGK/UtFZkqTbYlhWtfzpJFPfXz0= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1669728198; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=zhsa4kjXaf+YerjH1GujJlBZRUu0s2WJnPpFvGitSZY=; b=RNSLdZGder4bSV0gAiWUfRK+cJBCPjfe9BWqOr3azLF7ASsoLgxlfSyfdp8ZkzKb/yw/z0 g8l/GpQarGRNIsDw== Received: from wotan.suse.de (wotan.suse.de [10.160.0.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id D392E2C141; Tue, 29 Nov 2022 13:23:18 +0000 (UTC) Received: by wotan.suse.de (Postfix, from userid 10510) id CB65865E2; Tue, 29 Nov 2022 13:23:18 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by wotan.suse.de (Postfix) with ESMTP id C9B546471; Tue, 29 Nov 2022 13:23:18 +0000 (UTC) Date: Tue, 29 Nov 2022 13:23:18 +0000 (UTC) From: Michael Matz To: Alan Modra cc: binutils@sourceware.org Subject: Re: [PATCH 4/8] section-select: Completely rebuild matches In-Reply-To: Message-ID: References: User-Agent: Alpine 2.20 (LSU 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Spam-Status: No, score=-3.2 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,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 List-Id: Hey, On Tue, 29 Nov 2022, Alan Modra wrote: > > > That's a problem. The got header is created in the .got of "linker > > > stubs", and code setting the value of .TOC. assumes that the header > > > will be located first in the .got output section. This ties in with > > > where ld.so expects to find the header too. > > > > I see. But then why is the testcase (and linker script?) not using > > > > .got { *(.got) *(.toc) } > > > > ? The way it's written right now means "for each file, first its .got > > then its .toc, intermixed", i.e. file1.got, file1.toc, file2.got, > > file2.toc ... > > Yes. That's the way we want it. When linking small model code with a > total GOT/TOC of over 64k, the linker splits the TOC into multiple > pieces with r2 adjusting stubs inserted on calls between files that > use different pieces of the TOC. That scheme wouldn't work if a > file's .got entries were placed in a different piece of the TOC to the > file's .toc entries. Ah, nifty. Something like that occurred to me yesterday as well, and either way, rewriting the linker script like above wouldn't have helped this problem anyway, as long as "linker stubs".got would have been created late it would always have been placed at the end of the list. Although one could pedantically argue that those late-created sections being placed at the end would indeed conform to "as they are found in the linker input", I won't belabor that point. Complete rebuilding it is, performance-wise it's a wash :) Ciao, Michael.