Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp3192952rwe; Mon, 29 Aug 2022 07:22:54 -0700 (PDT) X-Google-Smtp-Source: AA6agR7RBKchpju0S8HcqmtP6h1E7usmtkeHn2Imh6ttBwXTOyC4f06JhS+VDn4c4Rym7oJlHPg4 X-Received: by 2002:a05:6402:b74:b0:447:d664:83f6 with SMTP id cb20-20020a0564020b7400b00447d66483f6mr13321472edb.303.1661782974229; Mon, 29 Aug 2022 07:22:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661782974; cv=none; d=google.com; s=arc-20160816; b=uNm8Xzf3GTma9j1Qw6NyKUGJ10S3911GcGG1XYpfQYRx91pXUq7B8CFVHqSrduKf8R TeMxIY+UFHLoIyv3wZvySmn9F7X/ziRCzcj8nFQLiItbZOcAXxWOM2pICkNKZ1KsXMpH NZT6OMdcKrU3ic0S10mgFsFi+jYOx4uAeDLK7DK36qDraCZaibSLewDhQsP45LlSggsw scRpGsSk3cZOY52FxUPLCJaGMs3VsC9yjAk03yV1Ayi5iKZ5A4wBvS7Oql16VWKg4Swu UDy5ypVr0oRZQzBOfazTsb1xkn2zX8N0UNg1xS+hiLXO7N1om/ca8S+9n7Y5JHnUE6Ou NX1w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=hgDdd5EvXvT3ykyXRr4aGTMgrC5GCqOYs/uprbOdeCY=; b=drk+TipYRUj/Mgv09llN3Ko/rPjN0mMrcFAHnIHsneY99JEnpqUYC33/jjIwV4Pn9H z+ipCDI7IDL1eiDy11ll509VzvZqKqduMmqSmqlOpG9G7SI+TgRUuSnOc0+8khm7SZaX Xi2X1qsW5aTRk2qu7+6HxOxcaV776gIWpJuaOeEQPPm0hrUP0XdWlDYMRQgnvzJGSEuO 6iMjKVS7RuZKm8mabYAFZ1c7v8/Tm1as10gfKu//z25A8Q4baL7UePxiYMIYpu3/rVJk QFIzqQIjaV6L7uDIAzdF4cN/qOOCdBhfOub6eN9WzQplTDqabFAhk1BFjRD4RXngGJtT dLxg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@xry111.site header.s=default header.b=HgVw0YAR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=xry111.site Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g22-20020a1709065d1600b00734b66a6d0dsi7446761ejt.3.2022.08.29.07.22.28; Mon, 29 Aug 2022 07:22:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@xry111.site header.s=default header.b=HgVw0YAR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=xry111.site Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230052AbiH2Nfc (ORCPT + 99 others); Mon, 29 Aug 2022 09:35:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54950 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230050AbiH2NfX (ORCPT ); Mon, 29 Aug 2022 09:35:23 -0400 Received: from xry111.site (xry111.site [89.208.246.23]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B69335C9FB for ; Mon, 29 Aug 2022 06:35:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=xry111.site; s=default; t=1661780121; bh=YGYJfp6hCx6eH/Nfs4eCDr4R+EBIr89AN05AxFZ+kgc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HgVw0YARg1ql0VgB+vs4jIpCMh+GAI+g78V/SbMDayWLYuMvp6XH7iHGr5r/qc6Ip yuchfhet/FvBDclKH2lDff/vw6UqOe/EryIa4d3+Zcoh8svkHXaTf2DOiRcewb/Pbc EW3ulmmY+0LeA0tM+/UyY4SMxfgKTJcrdZ1Rs+us= Received: from xry111-x57s1.. (unknown [IPv6:240e:358:11dd:1900:dc73:854d:832e:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (Client did not present a certificate) (Authenticated sender: xry111@xry111.site) by xry111.site (Postfix) with ESMTPSA id A1F9766903; Mon, 29 Aug 2022 09:35:16 -0400 (EDT) From: Xi Ruoyao To: loongarch@lists.linux.dev Cc: linux-kernel@vger.kernel.org, WANG Xuerui , Huacai Chen , Youling Tang , Jinyang He , Xi Ruoyao Subject: [PATCH v6 4/6] LoongArch: Define ELF relocation types added in v2.00 ABI Date: Mon, 29 Aug 2022 21:31:44 +0800 Message-Id: <20220829133146.15236-5-xry111@xry111.site> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220829133146.15236-1-xry111@xry111.site> References: <20220829133146.15236-1-xry111@xry111.site> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FROM_SUSPICIOUS_NTLD, PDS_OTHER_BAD_TLD,SPF_HELO_PASS,SPF_PASS,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 lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org These relocation types are used by GNU binutils >= 2.40 and GCC >= 13. Add their definitions so we will be able to use them in later patches. Link: https://github.com/loongson/LoongArch-Documentation/pull/57 Signed-off-by: Xi Ruoyao --- arch/loongarch/include/asm/elf.h | 37 ++++++++++++++++++++++++++++++++ arch/loongarch/kernel/module.c | 2 +- 2 files changed, 38 insertions(+), 1 deletion(-) diff --git a/arch/loongarch/include/asm/elf.h b/arch/loongarch/include/asm/elf.h index 5f3ff4781fda..7af0cebf28d7 100644 --- a/arch/loongarch/include/asm/elf.h +++ b/arch/loongarch/include/asm/elf.h @@ -74,6 +74,43 @@ #define R_LARCH_SUB64 56 #define R_LARCH_GNU_VTINHERIT 57 #define R_LARCH_GNU_VTENTRY 58 +#define R_LARCH_B16 64 +#define R_LARCH_B21 65 +#define R_LARCH_B26 66 +#define R_LARCH_ABS_HI20 67 +#define R_LARCH_ABS_LO12 68 +#define R_LARCH_ABS64_LO20 69 +#define R_LARCH_ABS64_HI12 70 +#define R_LARCH_PCALA_HI20 71 +#define R_LARCH_PCALA_LO12 72 +#define R_LARCH_PCALA64_LO20 73 +#define R_LARCH_PCALA64_HI12 74 +#define R_LARCH_GOT_PC_HI20 75 +#define R_LARCH_GOT_PC_LO12 76 +#define R_LARCH_GOT64_PC_LO20 77 +#define R_LARCH_GOT64_PC_HI12 78 +#define R_LARCH_GOT_HI20 79 +#define R_LARCH_GOT_LO12 80 +#define R_LARCH_GOT64_LO20 81 +#define R_LARCH_GOT64_HI12 82 +#define R_LARCH_TLS_LE_HI20 83 +#define R_LARCH_TLS_LE_LO12 84 +#define R_LARCH_TLS_LE64_LO20 85 +#define R_LARCH_TLS_LE64_HI12 86 +#define R_LARCH_TLS_IE_PC_HI20 87 +#define R_LARCH_TLS_IE_PC_LO12 88 +#define R_LARCH_TLS_IE64_PC_LO20 89 +#define R_LARCH_TLS_IE64_PC_HI12 90 +#define R_LARCH_TLS_IE_HI20 91 +#define R_LARCH_TLS_IE_LO12 92 +#define R_LARCH_TLS_IE64_LO20 93 +#define R_LARCH_TLS_IE64_HI12 94 +#define R_LARCH_TLS_LD_PC_HI20 95 +#define R_LARCH_TLS_LD_HI20 96 +#define R_LARCH_TLS_GD_PC_HI20 97 +#define R_LARCH_TLS_GD_HI20 98 +#define R_LARCH_32_PCREL 99 +#define R_LARCH_RELAX 100 #ifndef ELF_ARCH diff --git a/arch/loongarch/kernel/module.c b/arch/loongarch/kernel/module.c index 638427ff0d51..755d91ef8d85 100644 --- a/arch/loongarch/kernel/module.c +++ b/arch/loongarch/kernel/module.c @@ -296,7 +296,7 @@ typedef int (*reloc_rela_handler)(struct module *mod, u32 *location, Elf_Addr v, /* The handlers for known reloc types */ static reloc_rela_handler reloc_rela_handlers[] = { - [R_LARCH_NONE ... R_LARCH_SUB64] = apply_r_larch_error, + [R_LARCH_NONE ... R_LARCH_RELAX] = apply_r_larch_error, [R_LARCH_NONE] = apply_r_larch_none, [R_LARCH_32] = apply_r_larch_32, -- 2.37.0