Received: by 2002:a05:7412:251c:b0:e2:908c:2ebd with SMTP id w28csp1072032rda; Mon, 23 Oct 2023 01:11:59 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFPPIPFH37GBZkKZNTEWCQUBuPnlixszTTwPVkwgDtT2AJmc08BK3/MhGjkKoczfvNqTODq X-Received: by 2002:a17:902:db09:b0:1c0:774d:9342 with SMTP id m9-20020a170902db0900b001c0774d9342mr6505492plx.25.1698048719206; Mon, 23 Oct 2023 01:11:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698048719; cv=none; d=google.com; s=arc-20160816; b=0UlaxdTj60E/UEWDfAqW2XGOCp3FtUVMVNMz/ZxsRuA/cFfx3g4nzeuHG+E//3k2kc gkAOnCfnuAQoKMn0Ezlby9hNi8xYXO10RbrUJqACaHM9i//JLjTAG+r6kGt/U8f90eRT /8/aDpi9Nb8SXLKDRTML20Jtz+VbiFDDTpR276abtkhsI6D8kiP6a+rYpe/EgAx1TSzA JdtLuzA5koNNq4vue7q55zu1+qhIjm9FVeoWsUMOwPmoWepkS0a7ZJPuXEGoNvFeEMLh RrIXyBacLKTo3CkDV5NmTRGoaPJSERNSjXeICQgIByNkjWDmGf6/sBAz6uKu6kt82mt7 rVsw== 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=TGNitxnO+JP82mPwDFyabb7hOjNy8WOofuqwZm9Vvvc=; fh=3j/20F2LKXrdRGvNzW5us/B/H+CmIg1AkSVATQRCgiM=; b=xuLJ6keF0ALHosxJqBqOWz/nJk+ZnBnZ7IGHlBGWXf0/+Kgu4GG5JHyYL0pIWvT0UK Jx5CruOiOwZ6Cc9ShB/9XgLDvHA/ou3x634scJOT2RWwxZKzPsFzKSrA1nZp4xLK5Xx9 8xlBYGS9voJ0VzqT/ihrnX7GJSdd1zDvtz2LexRlVRMAH37dkLjr5MXfOc0MyQOOGfjU oIMLxEpuuYV+X2TEo7qwbkE7xr23pKLrEBEadkxU+DmcaX5U+Wa9uawWLFAubHKUZcox Dp9mSy6v9p8z8NxWZHBUEuM72bjhBRHYX9cSCnZ4RKIcYIsHK72qOA9NZPH6RQkOR8UL Goag== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id ij25-20020a170902ab5900b001c60ee79b6esi5736707plb.0.2023.10.23.01.11.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Oct 2023 01:11:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 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 morse.vger.email (Postfix) with ESMTP id DBCB380440D6; Mon, 23 Oct 2023 01:11:53 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229486AbjJWILm (ORCPT + 99 others); Mon, 23 Oct 2023 04:11:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38532 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229450AbjJWILl (ORCPT ); Mon, 23 Oct 2023 04:11:41 -0400 Received: from mail.loongson.cn (mail.loongson.cn [114.242.206.163]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 42B2BA1 for ; Mon, 23 Oct 2023 01:11:37 -0700 (PDT) Received: from loongson.cn (unknown [113.200.148.30]) by gateway (Coremail) with SMTP id _____8Dx_+u1KjZlWuYzAA--.34170S3; Mon, 23 Oct 2023 16:11:33 +0800 (CST) Received: from linux.localdomain (unknown [113.200.148.30]) by localhost.localdomain (Coremail) with SMTP id AQAAf8AxG9y0KjZlQRAvAA--.34174S2; Mon, 23 Oct 2023 16:11:32 +0800 (CST) From: Tiezhu Yang To: Josh Poimboeuf , Peter Zijlstra , Huacai Chen Cc: loongarch@lists.linux.dev, linux-kernel@vger.kernel.org, loongson-kernel@lists.loongnix.cn Subject: [PATCH v4 0/8] Add objtool and orc support for LoongArch Date: Mon, 23 Oct 2023 16:11:23 +0800 Message-Id: <1698048691-19521-1-git-send-email-yangtiezhu@loongson.cn> X-Mailer: git-send-email 2.1.0 X-CM-TRANSID: AQAAf8AxG9y0KjZlQRAvAA--.34174S2 X-CM-SenderInfo: p1dqw3xlh2x3gn0dqz5rrqw2lrqou0/ X-Coremail-Antispam: 1Uk129KBj93XoWxZr4UJr1fAFykWr4Utr4UZFc_yoWrWrWfpF 9rZr95GF4UWr93Aw1Dta4UurWDJan7Gr12g3Waqry8AFW2qr1DJrsakryDXF9Fqa1rGFW0 qF1rGw1aga1jvabCm3ZEXasCq-sJn29KB7ZKAUJUUUUr529EdanIXcx71UUUUU7KY7ZEXa sCq-sGcSsGvfJ3Ic02F40EFcxC0VAKzVAqx4xG6I80ebIjqfuFe4nvWSU5nxnvy29KBjDU 0xBIdaVrnRJUUU9Yb4IE77IF4wAFF20E14v26r1j6r4UM7CY07I20VC2zVCF04k26cxKx2 IYs7xG6rWj6s0DM7CIcVAFz4kK6r1Y6r17M28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48v e4kI8wA2z4x0Y4vE2Ix0cI8IcVAFwI0_Gr0_Xr1l84ACjcxK6xIIjxv20xvEc7CjxVAFwI 0_Gr0_Cr1l84ACjcxK6I8E87Iv67AKxVW8Jr0_Cr1UM28EF7xvwVC2z280aVCY1x0267AK xVW8Jr0_Cr1UM2kKe7AKxVWUXVWUAwAS0I0E0xvYzxvE52x082IY62kv0487Mc804VCY07 AIYIkI8VC2zVCFFI0UMc02F40EFcxC0VAKzVAqx4xG6I80ewAv7VC0I7IYx2IY67AKxVWU XVWUAwAv7VC2z280aVAFwI0_Jr0_Gr1lOx8S6xCaFVCjc4AY6r1j6r4UM4x0Y48IcxkI7V AKI48JMxAIw28IcxkI7VAKI48JMxC20s026xCaFVCjc4AY6r1j6r4UMxCIbckI1I0E14v2 6r1Y6r17MI8I3I0E5I8CrVAFwI0_Jr0_Jr4lx2IqxVCjr7xvwVAFwI0_JrI_JrWlx4CE17 CEb7AF67AKxVWUAVWUtwCIc40Y0x0EwIxGrwCI42IY6xIIjxv20xvE14v26r1j6r1xMIIF 0xvE2Ix0cI8IcVCY1x0267AKxVWUJVW8JwCI42IY6xAIw20EY4v20xvaj40_Jr0_JF4lIx AIcVC2z280aVAFwI0_Jr0_Gr1lIxAIcVC2z280aVCY1x0267AKxVWUJVW8JbIYCTnIWIev Ja73UjIFyTuYvjxU2MKZDUUUU 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 morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Mon, 23 Oct 2023 01:11:54 -0700 (PDT) This version is based on 6.6-rc7, tested with the latest upstream gcc and binutils (20231009). v4: -- Add "local_label" member in struct symbol, and set it as true if symbol type is STT_NOTYPE and symbol name starts with ".L" string -- Add EM_LOONGARCH definition to avoid cross-compile error -- Modify some coding issues of patch #8 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 | 19 + arch/loongarch/include/asm/Kbuild | 2 + 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 | 18 + arch/loongarch/include/asm/orc_lookup.h | 31 ++ arch/loongarch/include/asm/orc_types.h | 58 +++ arch/loongarch/include/asm/stackframe.h | 3 + arch/loongarch/include/asm/unwind.h | 19 +- arch/loongarch/include/asm/unwind_hints.h | 28 ++ arch/loongarch/kernel/Makefile | 4 + arch/loongarch/kernel/entry.S | 5 + arch/loongarch/kernel/genex.S | 4 + arch/loongarch/kernel/module.c | 22 +- arch/loongarch/kernel/relocate_kernel.S | 2 + arch/loongarch/kernel/setup.c | 2 + arch/loongarch/kernel/stacktrace.c | 1 + arch/loongarch/kernel/traps.c | 42 +- arch/loongarch/kernel/unwind_orc.c | 513 +++++++++++++++++++++ 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 | 356 ++++++++++++++ .../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 | 117 +++-- tools/objtool/include/objtool/elf.h | 1 + tools/objtool/include/objtool/orc.h | 14 + tools/objtool/orc_dump.c | 69 +-- tools/objtool/orc_gen.c | 113 +---- 47 files changed, 1962 insertions(+), 259 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