From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from angie.orcam.me.uk (angie.orcam.me.uk [IPv6:2001:4190:8020::34]) by sourceware.org (Postfix) with ESMTP id 9A58C3858D37 for ; Thu, 27 Jul 2023 19:39:33 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 9A58C3858D37 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=orcam.me.uk Authentication-Results: sourceware.org; spf=none smtp.mailfrom=orcam.me.uk Received: by angie.orcam.me.uk (Postfix, from userid 500) id E3DA192009C; Thu, 27 Jul 2023 21:39:32 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by angie.orcam.me.uk (Postfix) with ESMTP id DD2EF92009B; Thu, 27 Jul 2023 20:39:32 +0100 (BST) Date: Thu, 27 Jul 2023 20:39:32 +0100 (BST) From: "Maciej W. Rozycki" To: Ian Lance Taylor cc: Jan Beulich , Chenghua Xu , Binutils Subject: Re: non-conformant ELF symbol table on MIPS? In-Reply-To: Message-ID: References: User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Spam-Status: No, score=-3488.7 required=5.0 tests=BAYES_00,KAM_DMARC_STATUS,KAM_INFOUSMEBIZ,KAM_LAZY_DOMAIN_SECURITY,SPF_HELO_NONE,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Thu, 27 Jul 2023, Ian Lance Taylor wrote: > > I notice a violation of the ELF spec on most (all?) MIPS targets I would > > routinely test for common code changes: "lbuf" is emitted last in the > > symbol table. The spec is quite clear: "In each symbol table, all > > symbols with STB_LOCAL binding precede the weak and global symbols." I > > guess I want/need to xfail that test for mips*-*-* for the time being, > > but it would be nice if you could shed some light on this behavior. > > This is historical behavior that dates back to the SGI Irix operating > system. Search for elf_bad_symtab in the BFD sources. Here is the > commend from elf-bfd.h: > > /* Irix 5 often screws up the symbol table, sorting local symbols > after global symbols. This flag is set if the symbol table in > this BFD appears to be screwed up. If it is, we ignore the > sh_info field in the symbol table header, and always read all the > symbols. */ > unsigned int bad_symtab : 1; > > I believe we currently set elf_bad_symtab true by default for most > MIPS targets. Maybe, though not sure if really, by the number of individual targets supported, but certainly not by the userbase. IRIX emulation is only used by IRIX targets (naturally, hardly used now) and some, especially older bare-metal targets. Then Linux, *BSD and the remaining bare-metal targets use traditional emulation. In particular IRIX emulation is incompatible with symbol versioning required by glibc 2.x, which was the motivation back in the day to add traditional emulation support to the MIPS backend. Maciej