From patchwork Mon Mar 23 09:25:32 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Martin_Li=C5=A1ka?= X-Patchwork-Id: 1259929 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=gcc-patches-bounces@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=suse.cz Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48m8BL5YQqz9sRN for ; Mon, 23 Mar 2020 20:25:44 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id E4CC2385E02D; Mon, 23 Mar 2020 09:25:37 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by sourceware.org (Postfix) with ESMTPS id 94E78385E02B for ; Mon, 23 Mar 2020 09:25:34 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 94E78385E02B Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=mliska@suse.cz X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 5BEEAADAB; Mon, 23 Mar 2020 09:25:33 +0000 (UTC) From: =?utf-8?q?Martin_Li=C5=A1ka?= Subject: [PATCH] Check endianess detection. To: gcc-patches@gcc.gnu.org Message-ID: <82f5cda2-97f4-039e-5094-c528b220eb78@suse.cz> Date: Mon, 23 Mar 2020 10:25:32 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 MIME-Version: 1.0 Content-Language: en-US X-Spam-Status: No, score=-39.5 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_DMARC_STATUS, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces@gcc.gnu.org Sender: "Gcc-patches" Hi. As seen in the PR, sparc64 LTO test-suite fails due to missing definition of __BIG_ENDIAN__ macro. That said, I updated the endianess detection to use __BYTE_ORDER__. I tested the detection on x86_64-linux-gnu, ppc64-linux-gnu and lto.exp testsuite survives on a sparc64-linux machine. Ready to be installed? Thanks, Martin include/ChangeLog: 2020-03-23 Martin Liska PR lto/94249 * plugin-api.h: Use __BYTE_ORDER__ instead of __BIG_ENDIAN__ which is not defined on sparc64 target. --- include/plugin-api.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/include/plugin-api.h b/include/plugin-api.h index 673f136ce68..5a45ce773f7 100644 --- a/include/plugin-api.h +++ b/include/plugin-api.h @@ -89,16 +89,18 @@ struct ld_plugin_symbol char *version; /* This is for compatibility with older ABIs. The older ABI defined only 'def' field. */ -#ifdef __BIG_ENDIAN__ +#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ char unused; char section_kind; char symbol_type; char def; -#else +#elif __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ char def; char symbol_type; char section_kind; char unused; +#else +#error "Could not detect architecture endianess" #endif int visibility; uint64_t size;