Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp4437594pxk; Wed, 30 Sep 2020 03:00:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzaNTM/GMY6NMh99KFNDD+NfAF6urmisuw6Ca785YKN6LJshNmRU7JyRv4rMjVBTF/HWGGj X-Received: by 2002:a50:9fa8:: with SMTP id c37mr953749edf.233.1601460017917; Wed, 30 Sep 2020 03:00:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601460017; cv=none; d=google.com; s=arc-20160816; b=l0wyQOBz0rKq+yrrKkMyvLCgw/uF5VJsXrhYOwCbiIIASpw85VBpoCpRXeWIxThdJk UWm0l7408N13LXa0bcSZUoUMew4b2993VTDhL7GWj5M+O21H6X02J2Mor8lw9FtCeM1m 3CME4crdtoygGmmvzcwOtKGlhNyjJIaDaSEGOERZpagZIFL9ZScTZu/D2uVR8EEc61Zd 2wFxJSsmeaD5lkcPnh2LkVjnrO+RUkgTw6mqgrOdwj1kQY1XSfwm2KC0o1N4UBzQxr+1 arxshAdCaEh2t79zUaxEL9u0aQq4pQ2ccxjwS50/NWruhPdCquC7dx5FfG4KgWmIkKu9 nc5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-disposition :mime-version:message-id:subject:cc:to:from:date:dkim-signature; bh=YebIZqAwRDWi2AaUfQSF/in38mYGDN6RV5MXcQluT/A=; b=bRWzMvvCfET3MqVPMP8P1/cMytA4FRXLwrYx4AfylwwplUDozJr5VYEX2zIaJ/8o47 006EV+M21NkL1628O8n1Ph9bVnwliJcNtX5F1MA8toU2EgXCMwOaPw7R1NenVIOKxggm o7g40qrQ9dCY1dhn8hDD8iLbYamjT7Y2c97VTm3WdjZYD6/gqu5+B/ge7o2kcoc6Hy4Y W2KkIeQPPMnXpa+qa0XhTFM7+AiW3R4Fd/G/6DRUB3h24MD+0CqKaUCCqwzRO5F+PXFS MV4KwvHPfs2DGmw9B9LrbsWtjS+Fvq1J9I2KdDvMoGzXOlPopRxIYsNKReb9qG4u0S8K gJjg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=pK2wAAmP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c33si716545edf.530.2020.09.30.02.59.54; Wed, 30 Sep 2020 03:00:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=pK2wAAmP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728676AbgI3J6v (ORCPT + 99 others); Wed, 30 Sep 2020 05:58:51 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:15090 "EHLO mx0b-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725776AbgI3J6v (ORCPT ); Wed, 30 Sep 2020 05:58:51 -0400 Received: from pps.filterd (m0098421.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 08U9gJ1s146595; Wed, 30 Sep 2020 05:58:32 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=date : from : to : cc : subject : message-id : mime-version : content-type : content-transfer-encoding; s=pp1; bh=YebIZqAwRDWi2AaUfQSF/in38mYGDN6RV5MXcQluT/A=; b=pK2wAAmPAK4aTSgofB0CWaE5EJOnoUd5qXKZfevcTU+jdx4BPR/qlW0fH0sk/Cpe/yFc PMzTbUqP7cC+Bt8h2Aoq/P/S1TXo1ktTpcZmDkgvXJ1WvrBlBdeo4uKqAzUnMoxW04Gw YM+6+OXoBPO0hYO3IxvrcqSKEKB9mG3Qd0KgLsKMe7N2pIAWZBMtxT5dkOtb+XZ6yS2d YNAJl0Qm4oB2FqO9mlSEHKzQ/qkVmQhbljIcqYGqWtRUDEDJhzSSeU4J03qxJRacKeVJ 2DH1ezfEgvJ30hwOxldagWDkyHEu2G+WDQBOfUYAd8M5KGjKm6XNr5RvTZfdoMeVUtnL lA== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 33vqm9ret1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 30 Sep 2020 05:58:32 -0400 Received: from m0098421.ppops.net (m0098421.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 08U9qrnJ181186; Wed, 30 Sep 2020 05:58:31 -0400 Received: from ppma03fra.de.ibm.com (6b.4a.5195.ip4.static.sl-reverse.com [149.81.74.107]) by mx0a-001b2d01.pphosted.com with ESMTP id 33vqm9rert-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 30 Sep 2020 05:58:31 -0400 Received: from pps.filterd (ppma03fra.de.ibm.com [127.0.0.1]) by ppma03fra.de.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 08U9voDF001342; Wed, 30 Sep 2020 09:58:29 GMT Received: from b06cxnps4076.portsmouth.uk.ibm.com (d06relay13.portsmouth.uk.ibm.com [9.149.109.198]) by ppma03fra.de.ibm.com with ESMTP id 33v5kg0g13-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 30 Sep 2020 09:58:29 +0000 Received: from b06wcsmtp001.portsmouth.uk.ibm.com (b06wcsmtp001.portsmouth.uk.ibm.com [9.149.105.160]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 08U9wQ2O17498562 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 30 Sep 2020 09:58:27 GMT Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C9A5AA4054; Wed, 30 Sep 2020 09:58:26 +0000 (GMT) Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2C948A4060; Wed, 30 Sep 2020 09:58:26 +0000 (GMT) Received: from localhost (unknown [9.145.18.215]) by b06wcsmtp001.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Wed, 30 Sep 2020 09:58:26 +0000 (GMT) Date: Wed, 30 Sep 2020 11:58:24 +0200 From: Vasily Gorbik To: Josh Poimboeuf , Peter Zijlstra , Thomas Gleixner Cc: Ingo Molnar , Borislav Petkov , x86@kernel.org, "H. Peter Anvin" , Miroslav Benes , Alexandre Chartre , Julien Thierry , linux-kernel@vger.kernel.org Subject: [RFC PATCH 0/2] objtool and cross compilation Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit X-Patchwork-Bot: notify X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.235,18.0.687 definitions=2020-09-30_05:2020-09-29,2020-09-30 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 priorityscore=1501 malwarescore=0 mlxscore=0 phishscore=0 impostorscore=0 suspectscore=1 adultscore=0 lowpriorityscore=0 mlxlogscore=999 bulkscore=0 clxscore=1011 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2009300073 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This is based on v5.9-rc7, before "other architectures support" patches starting pouring in. Currently objtool seems to be the only tool from build tools needed which breaks x86 cross compilation on big endian systems. But besides x86 cross compilation, endianness awareness is also needed for big endian architectures objtool support in general. We have working prototype of objtool support and orc unwinder for s390 made originally by Martin Schwidefsky. I'm trying to bring it in shape again and refactor to share more code with "generic" part. But first things first. These 2 patches point to endianness problems which should be addressed. And I'd be glad to get any ideas how to make them less ugly. New "other architectures support" patches currently move only some problematic parts into x86 arch specific folder. But the main problem is that arch/x86/lib/insn.c and arch/x86/include/asm/insn.h are shared across the kernel source and the tools, and there is no common way to address endianness problems. Since big endian stuff is only needed for the objtool and not for the kernel I can try to hide alternative big endian definitions in tools only header which is included only if __KERNEL__ is not defined. But that kind of defeats the idea of sharing those files 1 to 1 with tools. Thoughts? Any suggestions are welcome. Martin Schwidefsky (1): objtool: x86 instruction decoder and big endian cross compiles Vasily Gorbik (1): objtool: fix x86 orc generation on big endian cross compiles arch/x86/include/asm/insn.h | 43 ++++++++++++ arch/x86/include/asm/orc_types.h | 24 +++++++ arch/x86/lib/insn.c | 95 +++++++++++--------------- tools/arch/x86/include/asm/insn.h | 43 ++++++++++++ tools/arch/x86/include/asm/orc_types.h | 24 +++++++ tools/arch/x86/lib/insn.c | 95 +++++++++++--------------- tools/objtool/check.c | 4 +- tools/objtool/elf.c | 34 +++++---- tools/objtool/orc_dump.c | 4 +- tools/objtool/orc_gen.c | 2 + tools/objtool/special.c | 4 +- 11 files changed, 243 insertions(+), 129 deletions(-) -- ⣿⣿⣿⣿⢋⡀⣀⠹⣿⣿⣿⣿ ⣿⣿⣿⣿⠠⣶⡦⠀⣿⣿⣿⣿ ⣿⣿⣿⠏⣴⣮⣴⣧⠈⢿⣿⣿ ⣿⣿⡏⢰⣿⠖⣠⣿⡆⠈⣿⣿ ⣿⢛⣵⣄⠙⣶⣶⡟⣅⣠⠹⣿ ⣿⣜⣛⠻⢎⣉⣉⣀⠿⣫⣵⣿