From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pl1-x62f.google.com (mail-pl1-x62f.google.com [IPv6:2607:f8b0:4864:20::62f]) by sourceware.org (Postfix) with ESMTPS id B99CE3856DE3 for ; Sat, 14 May 2022 01:06:59 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org B99CE3856DE3 Received: by mail-pl1-x62f.google.com with SMTP id n8so9486419plh.1 for ; Fri, 13 May 2022 18:06:59 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=bv5NOSrfjdD2y6g6f7Fihjwmacwa7xZ6qkdLiMW6IFw=; b=Z7fwM/iZtU7KTmBhczvl/15NDcroo7CbkClGGYz8bEbHr3IuaV9HH04XKabfjpXjaN xEv+tnTpO4TOqMsMZvy19uVV/w8AjUPz5B9u/MXFSw3Uu41QtEmPWfVs9zO1fKhsIc4c KAcU60HZmuVoCux/snMwd9q6nrySIg04ozqd0rPLo8477/+M2O3VCQAuzRD8lZoqz10S MEqEGi4DI5h9zi65cHuBk1gYojkT2N1OgT7xSB6c589cdspqO5bzLnVoH7373OkyO6og 6q4wgbKtQva9fviU754NM2nb1jYNLpt1SKYi1ySC0nfT+YniJDa4ZQ4GuoPqISteV1L9 POYA== X-Gm-Message-State: AOAM533Nak8vTtJ+KSIUPFKwFqQ8veLrnZyrIxXBQJZ6B0RNHPSyZht6 xJVjVgNqMIPlQCc8Nk2MQtHS+81JH1c= X-Google-Smtp-Source: ABdhPJyuXQbNoo9BHsZPXgUqa7h2abDL73+BPJ6SRmkQXWHdzp9TVoZtprmZbRmJzmISvO/HObYr4A== X-Received: by 2002:a17:90b:3c4e:b0:1dc:9999:44eb with SMTP id pm14-20020a17090b3c4e00b001dc999944ebmr18706079pjb.179.1652490418836; Fri, 13 May 2022 18:06:58 -0700 (PDT) Received: from squeak.grove.modra.org (158.106.96.58.static.exetel.com.au. [58.96.106.158]) by smtp.gmail.com with ESMTPSA id m24-20020a62a218000000b005107da0f34csm2339725pff.20.2022.05.13.18.06.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 May 2022 18:06:58 -0700 (PDT) Received: by squeak.grove.modra.org (Postfix, from userid 1000) id 53D7D1142F42; Sat, 14 May 2022 10:36:55 +0930 (ACST) Date: Sat, 14 May 2022 10:36:55 +0930 From: Alan Modra To: Thomas =?iso-8859-1?Q?R=F6thenbacher?= Cc: binutils@sourceware.org Subject: Re: bfd enforces a specific value of sh_info on SHT_GNU_verneed Message-ID: References: <716eb868d262e063382c7b63901fb02dfad9f2bb.camel@mailbox.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <716eb868d262e063382c7b63901fb02dfad9f2bb.camel@mailbox.org> X-Spam-Status: No, score=-3031.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, T_SCC_BODY_TEXT_LINE 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.29 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 May 2022 01:07:02 -0000 On Fri, May 13, 2022 at 09:17:32PM +0200, Thomas Röthenbacher wrote: > Hello, > > as stated in the subect, bfd (and therefore `objdump -d`) seems to fail > in _bfd_elf_slurp_version_tables if the value of sh_info for a > ".gnu.version_r" section (SHT_GNU_verdef) is zero. SHT_GNU_verneed you mean. sh_info is the number of version dependencies in .gnu.version_r. > I couldn't however find a specification to justify this behaviour or > anything specifying the sh_info field of this section type at all. > The only reference I could find, was in the SUN "Linker and Libraries > Guide", where they defined the sh_info value for their section type > SHT_SUNW_verdef. But does this standard apply here? Yes. SHT_GNU_verneed even has the same value as SHT_SUNW_verneed. If sh_info isn't described in documents specifying .gnu.version.r, then that is a deficiency of the specification document. > I'm asking, because a program I work with generates binaries that > violate this constraint, but can't really justify why it should NOT > just have a sh_info of zero in this section. I can give you a reason why sh_info has a count. Consider the contents of .gnu.version_r, both Elfxx_Verneed and Elfxx_Vernaux structures. You can't calculate the number of entries from the section size. Thus without reading the section you can't validate .gnu.version entries. If that isn't persuasive, justify it by the need to work with other programs that interpret ELF files! -- Alan Modra Australia Development Lab, IBM