Message ID | 1697768821-22931-1-git-send-email-yangtiezhu@loongson.cn |
---|---|
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2010:b0:403:3b70:6f57 with SMTP id fe16csp780131vqb; Thu, 19 Oct 2023 19:27:34 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGGfcvPf7+1zUltKX4z3vieY4Su3qnveVferNAuwQFSyDTJs8DoXpIHAKfPoCCaUUrz9jwl X-Received: by 2002:a05:6830:3145:b0:6bd:b879:c313 with SMTP id c5-20020a056830314500b006bdb879c313mr786441ots.10.1697768854490; Thu, 19 Oct 2023 19:27:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697768854; cv=none; d=google.com; s=arc-20160816; b=0+RrfAjQwOgLoRONzIqMvaj5ZJFA0tOBUJwuUYlcyyjB5gszwRSF6tAM29QPYfnlPi v3ya14aKl8ArAj46WMnmqiTo6eehAE+6lfI6bF4swg70ZCnc//nww4u7E3kOR6/iT5nI kg9Y5QY5o9i9OBJinMxCiFa4CdLPB/tkIZKPtiVhz5oTmBcspkWrs9+tAT4VEZKu1SWC QiJ0yNXlcKyP0H/m8WMI439HObjyovou/v14lzWjztudBk98b3npayWefKWNjS8uFR6m t4430J9bDomYXZCm2FFr9qz68Eq1rKi+TKk/D9jgfM/7KjGNt6SOW5jjY4qSUSA2Sl6d etjw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from; bh=buK0r1jjt7ZAXWmAuQH/qj3ZJe0311dRqI1WkcpK2fw=; fh=3j/20F2LKXrdRGvNzW5us/B/H+CmIg1AkSVATQRCgiM=; b=SNhiGWdETqB8sIeNwG2BTp4bHFaQH2UtmFSxRp1sPMiQZZcRGhCSELMXQcHzJw3tLP 87m+hlCbBj7H8f9OoKT5EOx7BxU5ON6M7fpAkDT5SdvnRdZPQuu2i0Qm+MRVyDNW/X7T LEJs14j5XU3DL4KV+AO6vxmEJxdP7slIs38oMqQqgPitIc0nZ9WeuhcibVIbPdKky/6f MSYyXv0E6/AwBftBxlOgDR82xIL51vxlwdOPQ6dY7uHdiaOnyH6UKOhIz4b6ngIPwKUc SOtrKzMH0zNtDUMzt/IN+72NtstfCHN88UKPF+6VZi/4jBvN0Xq6kjDVSPKjK2NG51hv LQ6Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id bt20-20020a632914000000b005898d997f52si903082pgb.66.2023.10.19.19.27.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Oct 2023 19:27:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 083A083C7590; Thu, 19 Oct 2023 19:27:28 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346850AbjJTC1N (ORCPT <rfc822;lkml4gm@gmail.com> + 25 others); Thu, 19 Oct 2023 22:27:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38566 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233387AbjJTC1L (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 19 Oct 2023 22:27:11 -0400 Received: from mail.loongson.cn (mail.loongson.cn [114.242.206.163]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 5BF01124 for <linux-kernel@vger.kernel.org>; Thu, 19 Oct 2023 19:27:07 -0700 (PDT) Received: from loongson.cn (unknown [113.200.148.30]) by gateway (Coremail) with SMTP id _____8Dx_+t45TFlLF8zAA--.33039S3; Fri, 20 Oct 2023 10:27:04 +0800 (CST) Received: from linux.localdomain (unknown [113.200.148.30]) by localhost.localdomain (Coremail) with SMTP id AQAAf8CxP9115TFl7r4rAA--.28791S2; Fri, 20 Oct 2023 10:27:01 +0800 (CST) From: Tiezhu Yang <yangtiezhu@loongson.cn> To: Josh Poimboeuf <jpoimboe@kernel.org>, Peter Zijlstra <peterz@infradead.org>, Huacai Chen <chenhuacai@kernel.org> Cc: loongarch@lists.linux.dev, linux-kernel@vger.kernel.org, loongson-kernel@lists.loongnix.cn Subject: [PATCH v3 0/8] Add objtool and orc support for LoongArch Date: Fri, 20 Oct 2023 10:26:53 +0800 Message-Id: <1697768821-22931-1-git-send-email-yangtiezhu@loongson.cn> X-Mailer: git-send-email 2.1.0 X-CM-TRANSID: AQAAf8CxP9115TFl7r4rAA--.28791S2 X-CM-SenderInfo: p1dqw3xlh2x3gn0dqz5rrqw2lrqou0/ X-Coremail-Antispam: 1Uk129KBj93XoWxXrW5XrW8Cr1DKry7Gw47WrX_yoWruF1DpF 9rurykGF4UWr93Awnrta4UurWDJan7Gr12g3W2qry8CFW2qr1DJrsakFyDZFyqqa1rJFy0 qFn5Gw1aga1jyabCm3ZEXasCq-sJn29KB7ZKAUJUUUU7529EdanIXcx71UUUUU7KY7ZEXa sCq-sGcSsGvfJ3Ic02F40EFcxC0VAKzVAqx4xG6I80ebIjqfuFe4nvWSU5nxnvy29KBjDU 0xBIdaVrnRJUUUBIb4IE77IF4wAFF20E14v26r1j6r4UM7CY07I20VC2zVCF04k26cxKx2 IYs7xG6rWj6s0DM7CIcVAFz4kK6r126r13M28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48v e4kI8wA2z4x0Y4vE2Ix0cI8IcVAFwI0_JFI_Gr1l84ACjcxK6xIIjxv20xvEc7CjxVAFwI 0_Gr0_Cr1l84ACjcxK6I8E87Iv67AKxVW8Jr0_Cr1UM28EF7xvwVC2z280aVCY1x0267AK xVW8Jr0_Cr1UM2kKe7AKxVWUXVWUAwAS0I0E0xvYzxvE52x082IY62kv0487Mc804VCY07 AIYIkI8VC2zVCFFI0UMc02F40EFcxC0VAKzVAqx4xG6I80ewAv7VC0I7IYx2IY67AKxVWU AVWUtwAv7VC2z280aVAFwI0_Gr0_Cr1lOx8S6xCaFVCjc4AY6r1j6r4UM4x0Y48IcxkI7V AKI48JMxkF7I0En4kS14v26r126r1DMxAIw28IcxkI7VAKI48JMxC20s026xCaFVCjc4AY 6r1j6r4UMxCIbckI1I0E14v26r1Y6r17MI8I3I0E5I8CrVAFwI0_Jr0_Jr4lx2IqxVCjr7 xvwVAFwI0_JrI_JrWlx4CE17CEb7AF67AKxVWUAVWUtwCIc40Y0x0EwIxGrwCI42IY6xII jxv20xvE14v26r1I6r4UMIIF0xvE2Ix0cI8IcVCY1x0267AKxVWUJVW8JwCI42IY6xAIw2 0EY4v20xvaj40_Jr0_JF4lIxAIcVC2z280aVAFwI0_Gr0_Cr1lIxAIcVC2z280aVCY1x02 67AKxVW8JVW8JrUvcSsGvfC2KfnxnUUI43ZEXa7IU8uMKtUUUUU== X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Thu, 19 Oct 2023 19:27:28 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780239674176023104 X-GMAIL-MSGID: 1780239674176023104 |
Series |
Add objtool and orc support for LoongArch
|
|
Message
Tiezhu Yang
Oct. 20, 2023, 2:26 a.m. UTC
This version is based on the latest torvalds/linux.git (20231020) which includes the commit 00c2ca84c680 ("LoongArch: Use SYM_CODE_* to annotate exception handlers"), tested with the latest upstream gcc and binutils (20231009). v3: -- Use tab for indentation in special.h -- Replace BP/bp with FP/fp -- Modify jirl decoder to handle special case in hibernate_asm.o -- Remove the calling of bswap_if_needed() which always return false -- Remove OBJECT_FILES_NON_STANDARD_suspend_asm.o -- Remove check of assembler version in Makefile -- Remove UNWIND_HINT_EMPTY in kernel_entry -- Put unwind_init() after cpu_probe() -- Remove CONFIG_BPF_JIT_ALWAYS_ON in defconfig -- Rename title of patch #8 to "Add ORC stack unwinder support" -- Fix build error of scripts/sorttable.h reported by test robot -- Add exception_table[] to save exception handlers Tiezhu Yang (8): objtool/LoongArch: Enable objtool to be built objtool/LoongArch: Implement instruction decoder objtool/x86: Separate arch-specific and generic parts objtool/LoongArch: Enable orc to be built objtool: Check local label about sibling call objtool: Check local label in add_dead_ends() objtool: Check local label in read_unwind_hints() LoongArch: Add ORC stack unwinder support arch/loongarch/Kconfig | 2 + arch/loongarch/Kconfig.debug | 11 + arch/loongarch/Makefile | 18 + arch/loongarch/include/asm/Kbuild | 1 + arch/loongarch/include/asm/bug.h | 1 + arch/loongarch/include/asm/exception.h | 2 + arch/loongarch/include/asm/module.h | 7 + arch/loongarch/include/asm/orc_header.h | 19 + arch/loongarch/include/asm/orc_lookup.h | 34 ++ arch/loongarch/include/asm/orc_types.h | 58 +++ arch/loongarch/include/asm/stackframe.h | 3 + arch/loongarch/include/asm/unwind.h | 22 +- arch/loongarch/include/asm/unwind_hints.h | 28 ++ arch/loongarch/kernel/Makefile | 3 + arch/loongarch/kernel/entry.S | 5 + arch/loongarch/kernel/genex.S | 4 + arch/loongarch/kernel/module.c | 11 +- arch/loongarch/kernel/relocate_kernel.S | 2 + arch/loongarch/kernel/setup.c | 2 + arch/loongarch/kernel/stacktrace.c | 1 + arch/loongarch/kernel/traps.c | 44 +- arch/loongarch/kernel/unwind_orc.c | 522 +++++++++++++++++++++ arch/loongarch/kernel/vmlinux.lds.S | 3 + arch/loongarch/lib/Makefile | 2 + arch/loongarch/mm/tlb.c | 27 +- arch/loongarch/mm/tlbex.S | 9 + arch/loongarch/vdso/Makefile | 1 + include/linux/compiler.h | 9 + scripts/Makefile | 7 +- tools/arch/loongarch/include/asm/inst.h | 161 +++++++ tools/arch/loongarch/include/asm/orc_types.h | 58 +++ tools/include/linux/bitops.h | 11 + tools/objtool/Makefile | 4 + tools/objtool/arch/loongarch/Build | 3 + tools/objtool/arch/loongarch/decode.c | 352 ++++++++++++++ .../objtool/arch/loongarch/include/arch/cfi_regs.h | 22 + tools/objtool/arch/loongarch/include/arch/elf.h | 30 ++ .../objtool/arch/loongarch/include/arch/special.h | 33 ++ tools/objtool/arch/loongarch/orc.c | 171 +++++++ tools/objtool/arch/loongarch/special.c | 15 + tools/objtool/arch/x86/Build | 1 + tools/objtool/arch/x86/orc.c | 188 ++++++++ tools/objtool/check.c | 118 +++-- tools/objtool/include/objtool/orc.h | 14 + tools/objtool/orc_dump.c | 69 +-- tools/objtool/orc_gen.c | 113 +---- 46 files changed, 1964 insertions(+), 257 deletions(-) create mode 100644 arch/loongarch/include/asm/orc_header.h create mode 100644 arch/loongarch/include/asm/orc_lookup.h create mode 100644 arch/loongarch/include/asm/orc_types.h create mode 100644 arch/loongarch/include/asm/unwind_hints.h create mode 100644 arch/loongarch/kernel/unwind_orc.c create mode 100644 tools/arch/loongarch/include/asm/inst.h create mode 100644 tools/arch/loongarch/include/asm/orc_types.h create mode 100644 tools/objtool/arch/loongarch/Build create mode 100644 tools/objtool/arch/loongarch/decode.c create mode 100644 tools/objtool/arch/loongarch/include/arch/cfi_regs.h create mode 100644 tools/objtool/arch/loongarch/include/arch/elf.h create mode 100644 tools/objtool/arch/loongarch/include/arch/special.h create mode 100644 tools/objtool/arch/loongarch/orc.c create mode 100644 tools/objtool/arch/loongarch/special.c create mode 100644 tools/objtool/arch/x86/orc.c create mode 100644 tools/objtool/include/objtool/orc.h
Comments
Cross compiling on X86 for LoongArch fails: CALL scripts/checksyscalls.sh DESCEND objtool make[5]: *** No rule to make target '/usr/lib/gcc/x86_64-redhat-linux/8/include/stdbool.h', needed by '/home/chenhuacai/linux-official.git/tools/objtool/libsubcmd/exec-cmd.o'. Stop. make[4]: *** [Makefile:80: /home/chenhuacai/linux-official.git/tools/objtool/libsubcmd/libsubcmd-in.o] Error 2 make[3]: *** [Makefile:82: /home/chenhuacai/linux-official.git/tools/objtool/libsubcmd/libsubcmd.a] Error 2 make[2]: *** [Makefile:73: objtool] Error 2 make[1]: *** [/home/chenhuacai/linux-official.git/Makefile:1355: tools/objtool] Error 2 make: *** [Makefile:234: __sub-make] Error 2 Huacai On Fri, Oct 20, 2023 at 10:27 AM Tiezhu Yang <yangtiezhu@loongson.cn> wrote: > > This version is based on the latest torvalds/linux.git (20231020) > which includes the commit 00c2ca84c680 ("LoongArch: Use SYM_CODE_* > to annotate exception handlers"), tested with the latest upstream > gcc and binutils (20231009). > > v3: > -- Use tab for indentation in special.h > -- Replace BP/bp with FP/fp > -- Modify jirl decoder to handle special case in hibernate_asm.o > -- Remove the calling of bswap_if_needed() which always return false > -- Remove OBJECT_FILES_NON_STANDARD_suspend_asm.o > -- Remove check of assembler version in Makefile > -- Remove UNWIND_HINT_EMPTY in kernel_entry > -- Put unwind_init() after cpu_probe() > -- Remove CONFIG_BPF_JIT_ALWAYS_ON in defconfig > -- Rename title of patch #8 to "Add ORC stack unwinder support" > -- Fix build error of scripts/sorttable.h reported by test robot > -- Add exception_table[] to save exception handlers > > Tiezhu Yang (8): > objtool/LoongArch: Enable objtool to be built > objtool/LoongArch: Implement instruction decoder > objtool/x86: Separate arch-specific and generic parts > objtool/LoongArch: Enable orc to be built > objtool: Check local label about sibling call > objtool: Check local label in add_dead_ends() > objtool: Check local label in read_unwind_hints() > LoongArch: Add ORC stack unwinder support > > arch/loongarch/Kconfig | 2 + > arch/loongarch/Kconfig.debug | 11 + > arch/loongarch/Makefile | 18 + > arch/loongarch/include/asm/Kbuild | 1 + > arch/loongarch/include/asm/bug.h | 1 + > arch/loongarch/include/asm/exception.h | 2 + > arch/loongarch/include/asm/module.h | 7 + > arch/loongarch/include/asm/orc_header.h | 19 + > arch/loongarch/include/asm/orc_lookup.h | 34 ++ > arch/loongarch/include/asm/orc_types.h | 58 +++ > arch/loongarch/include/asm/stackframe.h | 3 + > arch/loongarch/include/asm/unwind.h | 22 +- > arch/loongarch/include/asm/unwind_hints.h | 28 ++ > arch/loongarch/kernel/Makefile | 3 + > arch/loongarch/kernel/entry.S | 5 + > arch/loongarch/kernel/genex.S | 4 + > arch/loongarch/kernel/module.c | 11 +- > arch/loongarch/kernel/relocate_kernel.S | 2 + > arch/loongarch/kernel/setup.c | 2 + > arch/loongarch/kernel/stacktrace.c | 1 + > arch/loongarch/kernel/traps.c | 44 +- > arch/loongarch/kernel/unwind_orc.c | 522 +++++++++++++++++++++ > arch/loongarch/kernel/vmlinux.lds.S | 3 + > arch/loongarch/lib/Makefile | 2 + > arch/loongarch/mm/tlb.c | 27 +- > arch/loongarch/mm/tlbex.S | 9 + > arch/loongarch/vdso/Makefile | 1 + > include/linux/compiler.h | 9 + > scripts/Makefile | 7 +- > tools/arch/loongarch/include/asm/inst.h | 161 +++++++ > tools/arch/loongarch/include/asm/orc_types.h | 58 +++ > tools/include/linux/bitops.h | 11 + > tools/objtool/Makefile | 4 + > tools/objtool/arch/loongarch/Build | 3 + > tools/objtool/arch/loongarch/decode.c | 352 ++++++++++++++ > .../objtool/arch/loongarch/include/arch/cfi_regs.h | 22 + > tools/objtool/arch/loongarch/include/arch/elf.h | 30 ++ > .../objtool/arch/loongarch/include/arch/special.h | 33 ++ > tools/objtool/arch/loongarch/orc.c | 171 +++++++ > tools/objtool/arch/loongarch/special.c | 15 + > tools/objtool/arch/x86/Build | 1 + > tools/objtool/arch/x86/orc.c | 188 ++++++++ > tools/objtool/check.c | 118 +++-- > tools/objtool/include/objtool/orc.h | 14 + > tools/objtool/orc_dump.c | 69 +-- > tools/objtool/orc_gen.c | 113 +---- > 46 files changed, 1964 insertions(+), 257 deletions(-) > create mode 100644 arch/loongarch/include/asm/orc_header.h > create mode 100644 arch/loongarch/include/asm/orc_lookup.h > create mode 100644 arch/loongarch/include/asm/orc_types.h > create mode 100644 arch/loongarch/include/asm/unwind_hints.h > create mode 100644 arch/loongarch/kernel/unwind_orc.c > create mode 100644 tools/arch/loongarch/include/asm/inst.h > create mode 100644 tools/arch/loongarch/include/asm/orc_types.h > create mode 100644 tools/objtool/arch/loongarch/Build > create mode 100644 tools/objtool/arch/loongarch/decode.c > create mode 100644 tools/objtool/arch/loongarch/include/arch/cfi_regs.h > create mode 100644 tools/objtool/arch/loongarch/include/arch/elf.h > create mode 100644 tools/objtool/arch/loongarch/include/arch/special.h > create mode 100644 tools/objtool/arch/loongarch/orc.c > create mode 100644 tools/objtool/arch/loongarch/special.c > create mode 100644 tools/objtool/arch/x86/orc.c > create mode 100644 tools/objtool/include/objtool/orc.h > > -- > 2.1.0 >
On 10/20/2023 04:51 PM, Huacai Chen wrote: > Cross compiling on X86 for LoongArch fails: > > CALL scripts/checksyscalls.sh > DESCEND objtool > make[5]: *** No rule to make target > '/usr/lib/gcc/x86_64-redhat-linux/8/include/stdbool.h', needed by > '/home/chenhuacai/linux-official.git/tools/objtool/libsubcmd/exec-cmd.o'. > Stop. > make[4]: *** [Makefile:80: > /home/chenhuacai/linux-official.git/tools/objtool/libsubcmd/libsubcmd-in.o] > Error 2 > make[3]: *** [Makefile:82: > /home/chenhuacai/linux-official.git/tools/objtool/libsubcmd/libsubcmd.a] > Error 2 > make[2]: *** [Makefile:73: objtool] Error 2 > make[1]: *** [/home/chenhuacai/linux-official.git/Makefile:1355: > tools/objtool] Error 2 > make: *** [Makefile:234: __sub-make] Error 2 It seems that there is no stdbool.h in your cross compile environment. It works well with the following steps, you can try it. wget https://github.com/loongson/build-tools/releases/download/2023.08.08/x86_64-cross-tools-loongarch64-gcc-libc.tar.xz tar xf x86_64-cross-tools-loongarch64-gcc-libc.tar.xz -C /opt export PATH=/opt/cross-tools/bin/:$PATH export LD_LIBRARY_PATH=/opt/cross-tools/loongarch64-unknown-linux-gnu/lib:$LD_LIBRARY_PATH export LD_LIBRARY_PATH=/opt/cross-tools/lib:$LD_LIBRARY_PATH export CROSS_COMPILE=loongarch64-unknown-linux-gnu- export ARCH=loongarch find /opt -name stdbool.h /opt/cross-tools/lib/gcc/loongarch64-unknown-linux-gnu/14.0.0/include/stdbool.h /opt/cross-tools/loongarch64-unknown-linux-gnu/include/c++/14.0.0/tr1/stdbool.h cd linux.git make loongson3_defconfig make menuconfig # select CONFIG_UNWINDER_ORC make -j4 Thanks, Tiezhu
On Fri, 2023-10-20 at 18:28 +0800, Tiezhu Yang wrote: > On 10/20/2023 04:51 PM, Huacai Chen wrote: > > Cross compiling on X86 for LoongArch fails: > > > > CALL scripts/checksyscalls.sh > > DESCEND objtool > > make[5]: *** No rule to make target > > '/usr/lib/gcc/x86_64-redhat-linux/8/include/stdbool.h', needed by > > '/home/chenhuacai/linux-official.git/tools/objtool/libsubcmd/exec-cmd.o'. > > Stop. > > make[4]: *** [Makefile:80: > > /home/chenhuacai/linux-official.git/tools/objtool/libsubcmd/libsubcmd-in.o] > > Error 2 > > make[3]: *** [Makefile:82: > > /home/chenhuacai/linux-official.git/tools/objtool/libsubcmd/libsubcmd.a] > > Error 2 > > make[2]: *** [Makefile:73: objtool] Error 2 > > make[1]: *** [/home/chenhuacai/linux-official.git/Makefile:1355: > > tools/objtool] Error 2 > > make: *** [Makefile:234: __sub-make] Error 2 > > It seems that there is no stdbool.h in your cross compile environment. > > It works well with the following steps, you can try it. /* snip */ > find /opt -name stdbool.h > /opt/cross-tools/lib/gcc/loongarch64-unknown-linux-gnu/14.0.0/include/stdbool.h > /opt/cross-tools/loongarch64-unknown-linux-gnu/include/c++/14.0.0/tr1/stdbool.h The problem is HOSTCC cannot find stdbool.h, not (target) CC. So these two files are not relevant.
On 10/20/2023 06:45 PM, Xi Ruoyao wrote: > On Fri, 2023-10-20 at 18:28 +0800, Tiezhu Yang wrote: >> On 10/20/2023 04:51 PM, Huacai Chen wrote: >>> Cross compiling on X86 for LoongArch fails: >>> >>> CALL scripts/checksyscalls.sh >>> DESCEND objtool >>> make[5]: *** No rule to make target >>> '/usr/lib/gcc/x86_64-redhat-linux/8/include/stdbool.h', needed by >>> '/home/chenhuacai/linux-official.git/tools/objtool/libsubcmd/exec-cmd.o'. >>> Stop. >>> make[4]: *** [Makefile:80: >>> /home/chenhuacai/linux-official.git/tools/objtool/libsubcmd/libsubcmd-in.o] >>> Error 2 >>> make[3]: *** [Makefile:82: >>> /home/chenhuacai/linux-official.git/tools/objtool/libsubcmd/libsubcmd.a] >>> Error 2 >>> make[2]: *** [Makefile:73: objtool] Error 2 >>> make[1]: *** [/home/chenhuacai/linux-official.git/Makefile:1355: >>> tools/objtool] Error 2 >>> make: *** [Makefile:234: __sub-make] Error 2 >> >> It seems that there is no stdbool.h in your cross compile environment. >> >> It works well with the following steps, you can try it. > > /* snip */ > >> find /opt -name stdbool.h >> /opt/cross-tools/lib/gcc/loongarch64-unknown-linux-gnu/14.0.0/include/stdbool.h >> /opt/cross-tools/loongarch64-unknown-linux-gnu/include/c++/14.0.0/tr1/stdbool.h > > The problem is HOSTCC cannot find stdbool.h, not (target) CC. So these > two files are not relevant. > Oh, thank you for pointing out the real reason of this issue. By the way, my test system is Fedora 38 x86_64, it works well. Thanks, Tiezhu
Hi, Tiezhu, On Fri, Oct 20, 2023 at 6:55 PM Tiezhu Yang <yangtiezhu@loongson.cn> wrote: > > > > On 10/20/2023 06:45 PM, Xi Ruoyao wrote: > > On Fri, 2023-10-20 at 18:28 +0800, Tiezhu Yang wrote: > >> On 10/20/2023 04:51 PM, Huacai Chen wrote: > >>> Cross compiling on X86 for LoongArch fails: > >>> > >>> CALL scripts/checksyscalls.sh > >>> DESCEND objtool > >>> make[5]: *** No rule to make target > >>> '/usr/lib/gcc/x86_64-redhat-linux/8/include/stdbool.h', needed by > >>> '/home/chenhuacai/linux-official.git/tools/objtool/libsubcmd/exec-cmd.o'. > >>> Stop. > >>> make[4]: *** [Makefile:80: > >>> /home/chenhuacai/linux-official.git/tools/objtool/libsubcmd/libsubcmd-in.o] > >>> Error 2 > >>> make[3]: *** [Makefile:82: > >>> /home/chenhuacai/linux-official.git/tools/objtool/libsubcmd/libsubcmd.a] > >>> Error 2 > >>> make[2]: *** [Makefile:73: objtool] Error 2 > >>> make[1]: *** [/home/chenhuacai/linux-official.git/Makefile:1355: > >>> tools/objtool] Error 2 > >>> make: *** [Makefile:234: __sub-make] Error 2 > >> > >> It seems that there is no stdbool.h in your cross compile environment. > >> > >> It works well with the following steps, you can try it. > > > > /* snip */ > > > >> find /opt -name stdbool.h > >> /opt/cross-tools/lib/gcc/loongarch64-unknown-linux-gnu/14.0.0/include/stdbool.h > >> /opt/cross-tools/loongarch64-unknown-linux-gnu/include/c++/14.0.0/tr1/stdbool.h > > > > The problem is HOSTCC cannot find stdbool.h, not (target) CC. So these > > two files are not relevant. > > > > Oh, thank you for pointing out the real reason of this issue. > > By the way, my test system is Fedora 38 x86_64, it works well. I can also cross compile now. And I have fixed some issues I comments in this series, then I have pushed here: https://github.com/chenhuacai/linux/commits/master To save time, you can do additional modifications (e.g. Peter's suggestions) on top of my version. And there are still some problems that need some more effort. 1, Build warnings: AS arch/loongarch/kernel/fpu.o arch/loongarch/kernel/fpu.o: warning: objtool: _restore_fp+0xb0: unreachable instruction arch/loongarch/kernel/fpu.o: warning: objtool: _restore_lsx+0xf4: unreachable instruction arch/loongarch/kernel/fpu.o: warning: objtool: _restore_lasx+0xf4: unreachable instruction CC arch/loongarch/kernel/kfpu.o AS arch/loongarch/kernel/lbt.o arch/loongarch/kernel/lbt.o: warning: objtool: _restore_ftop_context+0x18: unreachable instruction 2, Partial call stack: [10589.180597] [<9000000002e435e0>] show_stack+0x34/0x14c [10589.188124] [<9000000003f0bd7c>] dump_stack_lvl+0x5c/0x88 [10589.193487] [<9000000003f0bdb8>] dump_stack+0x10/0x20 [10589.198505] [<9000000002e43704>] show_regs+0xc/0x1c [10589.203350] [<9000000003edb174>] nmi_cpu_backtrace+0x154/0x15c [10589.209146] [<9000000002e43acc>] handle_backtrace+0xc/0x40 [10589.214597] [<9000000002f165d8>] __flush_smp_call_function_queue+0xe4/0x2bc [10589.221518] [<9000000002f17538>] generic_smp_call_function_single_interrupt+0xc/0x1c [10589.229217] [<9000000002e4e6a0>] loongson_ipi_interrupt+0x7c/0xc0 [10589.235274] [<9000000002ecf1c4>] __handle_irq_event_percpu+0x50/0x130 [10589.241675] [<9000000002ecf2b8>] handle_irq_event_percpu+0x14/0x70 [10589.247818] [<9000000002ed5aa4>] handle_percpu_irq+0x50/0x78 [10589.253443] [<9000000002ece3c0>] generic_handle_domain_irq+0x24/0x40 [10589.259758] [<900000000369be68>] handle_cpu_irq+0x68/0xa4 [10589.265122] [<9000000003f0c128>] handle_loongarch_irq+0x2c/0x4c [10589.271004] [<9000000003f0c1cc>] do_vint+0x84/0xbc 3, Runtime warnings: [ 51.891244] [<9000000002b935e0>] show_stack+0x34/0x14c [ 51.898777] [<9000000003c5bd7c>] dump_stack_lvl+0x5c/0x88 [ 51.904144] [<9000000003c5bdb8>] dump_stack+0x10/0x20 [ 51.909161] [<9000000003c2b158>] nmi_cpu_backtrace+0x138/0x15c [ 51.914960] [<9000000003c2b324>] nmi_trigger_cpumask_backtrace+0x1a8/0x1e4 [ 51.921794] [<9000000002b944ec>] arch_trigger_cpumask_backtrace+0x10/0x20 [ 51.928541] [<9000000003508bd0>] sysrq_handle_showallcpus+0x14/0x24 [ 51.934772] [<90000000035095b8>] __handle_sysrq+0x184/0x1e0 [ 51.940310] [<9000000003509cf8>] write_sysrq_trigger+0x94/0x9c [ 51.946107] [<9000000002e98a6c>] proc_reg_write+0xb4/0xf0 [ 51.951472] [<9000000002e07c4c>] vfs_write+0x108/0x3d8 [ 51.956580] [<9000000002e080d0>] ksys_write+0x74/0x124 [ 51.961686] [<9000000002e0818c>] sys_write+0xc/0x1c [ 51.966533] [<9000000003c5d0b8>] do_syscall+0x78/0x98 [ 51.971552] [<9000000002b91198>] handle_syscall+0xb8/0x158 [ 51.977002] WARNING: unknown SP base reg 0 at handle_syscall+0xb8/0x158 Huacai > > Thanks, > Tiezhu > >