From patchwork Tue Dec 5 22:06:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 174217 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp3733773vqy; Tue, 5 Dec 2023 14:06:45 -0800 (PST) X-Google-Smtp-Source: AGHT+IFQbVshgEzpdFuvnN79gd8t3yt5NfAnsma35sFaBpYdEjtTgziqaUHk6IjLOIvVs9LigNBu X-Received: by 2002:a05:620a:254d:b0:77e:fbba:6470 with SMTP id s13-20020a05620a254d00b0077efbba6470mr2698817qko.79.1701814005473; Tue, 05 Dec 2023 14:06:45 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1701814005; cv=pass; d=google.com; s=arc-20160816; b=alktAbNfFEH/z5k0dG/5bk7uj/9GVGj84vYLgz7Tj65CT8fIiW9XeQRZy0usIIlCWg nXR+5hP26w26D88rx/3UD/uYVSacEa3XUPK4uMXfW6/9DFJD3LdydKXmngMqdq90HOMr z9J9DsEMShV7v4tDRENWm8h7PFbrI03TPpphgaFLPtQLsNbxi9N60+WJmTjAp2nXBNZO VbzsqM2Bi2I9glp3IYc2nW3KypbmUApEHj8qLqCpugvKTrwf3e4SFmAczUMLCY1XTPEU 12zDD8xxJw5yp3rysEKYuNj3TyQpDWCUmKwAcVyYFlJHS4+jSUjFMNcp6SqYl2/PuHCb HpSA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:reply-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-disposition :mime-version:message-id:subject:cc:to:from:date:dkim-signature :arc-filter:dmarc-filter:delivered-to; bh=K3lXrwXk3gkoYkXVEixQq2TKmwXRxbOClLoekMu+AZ0=; fh=3w034aMCi+cBT6azxuh6paZqxUYbqbk5QW5sZ4Xiglo=; b=CNSY4YRlNBJBMuXNOBU/1Mz5b4INYqVm0E78vKzM9uc/2tckU/04Lx+K6KKXeqofY2 zovT6EZA99O0IBIkjrYGTaonrFKAfX/WWUK5u6sZU8gPqxllE4nYFZExX7OVMU5dNQlq mMWTcr844xIhZnAn4rsV7kb/E6KKeiN7SjV5WvkUUSRsg1uCo6P5g+4LcrOYi6Yj3Cas 0vK45SShY2QH9g9u+8usqJKqyyKew6lDmWUuoZlXSVF0CCUNgrgdtByD/3TmARpzgoRc ehQ5eRwrLLqsBgLth1Sio5gViUi2HDTueOZ7GE2wmP7Nzk0JIRsmoXBsS3PDhY4R9vKJ dGpw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=EqzkQXHW; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from server2.sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id 19-20020ac85913000000b00423e85ef5fasi12924823qty.497.2023.12.05.14.06.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Dec 2023 14:06:45 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=EqzkQXHW; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 3FA713857357 for ; Tue, 5 Dec 2023 22:06:45 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org 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 8046A3858D37 for ; Tue, 5 Dec 2023 22:06:22 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 8046A3858D37 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 8046A3858D37 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1701813983; cv=none; b=PsdRADinhvs/WitcgmeBouY3QC72xqqp0Fmg+7ezWNpnC0Rv8wcshLka5DxA5PwpmKGOLPVTW3CE5Sl6JgO8uY839pL5AHbRKVuTxd9z4bHejX/R30Nh+wkjxfXAfhUkCMerO9+JA9uMp4ChSulipeG28S4y6I1DPivc2akD5mI= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1701813983; c=relaxed/simple; bh=muoWtQ5bnQkcG/Z/XmnMiu2RU2KgzWGFgvrvXNbxp50=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version; b=IQ3YUk5P68JRewlay5IgpVg9nz+4L5iHCNgoogjP40Is0PlAra/D3eXRKf04xTMekopzG0NXP06MAKALyzTmyBKEfTXyvjy5I/5qaPJfTxuQheTHAiq8PokRJtwUW0k6E8KvBWek7VxK/z1owKTNJ9Zcc0U6RfoM8beInIV6r9I= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1701813981; h=from:from:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type; bh=K3lXrwXk3gkoYkXVEixQq2TKmwXRxbOClLoekMu+AZ0=; b=EqzkQXHW6jr9Xx+T7t4DssYEgLnSl6vP2lqLHtakGo0bj/xfvkQFMhJNk9C6a+uvU02EGY KXyNqHGcee8sJ4IqRATECz7k8dBejaMH36l6TasuSA6seodJBkzk7dPi2eSwjIgS/hKCr1 8zmwyzXBR/8a1izQ4zgO50v06As7C2A= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-157-XdAplj9HOKi-mRjJzHBjvQ-1; Tue, 05 Dec 2023 17:06:19 -0500 X-MC-Unique: XdAplj9HOKi-mRjJzHBjvQ-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 6468F3C0009F; Tue, 5 Dec 2023 22:06:19 +0000 (UTC) Received: from tucnak.zalov.cz (unknown [10.39.195.157]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 11197492BC6; Tue, 5 Dec 2023 22:06:18 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.17.1/8.17.1) with ESMTPS id 3B5M6GkT1483396 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Tue, 5 Dec 2023 23:06:16 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.17.1/8.17.1/Submit) id 3B5M6F1s1483395; Tue, 5 Dec 2023 23:06:15 +0100 Date: Tue, 5 Dec 2023 23:06:15 +0100 From: Jakub Jelinek To: Ian Lance Taylor , Nick Clifton Cc: gcc-patches@gcc.gnu.org, Tobias Burnus Subject: [PATCH] libiberty: Fix build with GCC < 7 Message-ID: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.9 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline X-Spam-Status: No, score=-3.4 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, KAM_NUMSUBJECT, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, 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 X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Jakub Jelinek Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784481322409388389 X-GMAIL-MSGID: 1784481322409388389 Hi! Tobias reported on IRC that the linker fails to build with GCC 4.8.5. In configure I've tried to use everything actually used in the sha1.c x86 hw implementation, but unfortunately I forgot about implicit function declarations. GCC before 7 did have header and bit_SHA define and __get_cpuid function defined inline, but it didn't define __get_cpuid_count, which compiled fine (and the configure test is intentionally compile time only) due to implicit function declaration, but then failed to link when linking the linker, because __get_cpuid_count wasn't defined anywhere. The following patch fixes that by using what autoconf uses in AC_CHECK_DECL to make sure the functions are declared. Bootstrapped/regtested in GCC on x86_64-linux and i686-linux with GCC 12 as system compiler (HAVE_X86_SHA1_HW_SUPPORT is defined there) and tested by Tobias with GCC 4.8.5 (it isn't defined there anymore). Ok for trunk (both gcc and binutils)? 2023-12-05 Jakub Jelinek * configure.ac (HAVE_X86_SHA1_HW_SUPPORT): Verify __get_cpuid and __get_cpuid_count are not implicitly declared. * configure: Regenerated. Jakub --- libiberty/configure.ac.jj 2023-12-01 08:10:44.877293904 +0100 +++ libiberty/configure.ac 2023-12-05 16:09:49.506323449 +0100 @@ -771,6 +771,8 @@ void foo (__m128i *buf, unsigned int e, int bar (void) { unsigned int eax, ebx, ecx, edx; + (void) __get_cpuid; + (void) __get_cpuid_count; if (__get_cpuid_count (7, 0, &eax, &ebx, &ecx, &edx) && (ebx & bit_SHA) != 0 && __get_cpuid (1, &eax, &ebx, &ecx, &edx) --- libiberty/configure.jj 2023-12-01 08:10:44.876293919 +0100 +++ libiberty/configure 2023-12-05 16:10:06.415083621 +0100 @@ -7667,6 +7667,8 @@ void foo (__m128i *buf, unsigned int e, int bar (void) { unsigned int eax, ebx, ecx, edx; + (void) __get_cpuid; + (void) __get_cpuid_count; if (__get_cpuid_count (7, 0, &eax, &ebx, &ecx, &edx) && (ebx & bit_SHA) != 0 && __get_cpuid (1, &eax, &ebx, &ecx, &edx)