From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id ECE383858D1E for ; Thu, 7 Sep 2023 15:50:54 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org ECE383858D1E Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1694101854; h=from:from:reply-to:subject:subject: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=OXN3CKcGietC68immUiYZin++FLOUDF04ouZ7TWyR/g=; b=ZldeVQG9OHleKTKS6Ede2f9ILStmKQw02u05WqvRZPKb37kIDWpTUFH+Ki38seFJKVCLAl BG3rIpOuO6W7ZEsC4sYvDQLvJGSaQaBAHHWkeQD19IMTh4pMJI2TSzcVmfDAiNDKNku3pt 7jrn5LpGvvzxHJo1NRWQNyxEO+J+s34= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-553-DlWcDSqvP56L-88bKWtf7Q-1; Thu, 07 Sep 2023 11:50:51 -0400 X-MC-Unique: DlWcDSqvP56L-88bKWtf7Q-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 3D8651829386; Thu, 7 Sep 2023 15:50:51 +0000 (UTC) Received: from oldenburg.str.redhat.com (unknown [10.2.16.41]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 99058404119; Thu, 7 Sep 2023 15:50:50 +0000 (UTC) From: Florian Weimer To: Palmer Dabbelt Cc: jlaw@ventanamicro.com, libc-alpha@sourceware.org Subject: Re: [PATCH] build-many-glibcs: Add a RISC-V config with most of the B extensions References: Date: Thu, 07 Sep 2023 17:50:49 +0200 In-Reply-To: (Palmer Dabbelt's message of "Thu, 07 Sep 2023 08:24:34 -0700 (PDT)") Message-ID: <87a5ty9e3q.fsf@oldenburg.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain X-Spam-Status: No, score=-4.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,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: * Palmer Dabbelt: > On Wed, 06 Sep 2023 13:43:08 PDT (-0700), fweimer@redhat.com wrote: >> * Palmer Dabbelt: >> >>> + self.add_config(arch='riscv64', >>> + os_name='linux-gnu', >>> + variant='rv64imafdcb-lp64d', >>> + gcc_cfg=['--with-arch=rv64imafdc_zba_zbb_zbs', '--with-abi=lp64d', >>> + '--disable-multilib']) >> >> I doubt we need a separate GCC configuration, you should be able to use >> the existing compiler for that and just change the glibc build flags. > > Right now we're building a different GCC for each target, setting the > default arch at GCC configure time. I agree that's super inefficient, > but it's what the other tagets do. Sharing GCCs will also result in > mixing up things like libgcc, which is kind of a double-edged sword. It's more mixed, see the power4 variant of powerpc-linux-gnu for an example. >> I expect we need some sort of version check because these flags are >> rather recent, right? To what extend do they actually impact code >> generation for glibc? > > We've got two inline asm routines that use the B extensions (both Zbb): > > sysdeps/riscv/string-fza.h:#if defined __riscv_zbb || defined __riscv_xtheadbb > sysdeps/riscv/string-fzi.h:#if defined __riscv_zbb || defined __riscv_xtheadbb > > That's a pretty small diff, but it is code we're not testing -- not > sure if that's worth a whole test config, though. You can add IFUNCs and compile the affected string functions twice, then code *will* be compiled in a default build, revealing syntax and other errors. > On the compiler side the B extensions have a pretty big impact on > codegen: they add a bunch of common bit manipulation patterns > (sign/zero extension, bit fields, C strings, etc). None of that > should change the ABI, so in theory we should be safe if the GCC test > suite passes. We do glibc builds as part of the GCC testing, but that > usually targets released glibc versions so stuff might slip through. Do the B extensions change the relocation footprint because they add new instruction encodes? That's an area where we've sometimes encountered problems with changes in ISA baselines/compiler flags. Thanks, Florian