Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp4074706rwe; Tue, 30 Aug 2022 04:18:33 -0700 (PDT) X-Google-Smtp-Source: AA6agR5iQznjiZIfbEbb5J7dlVcK4wl82uCGURKVnuukSCsUB9/3UISFKXxsNbhko7gSztJ1DAWi X-Received: by 2002:a17:907:9693:b0:73d:cc84:deb with SMTP id hd19-20020a170907969300b0073dcc840debmr16604881ejc.552.1661858312809; Tue, 30 Aug 2022 04:18:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661858312; cv=none; d=google.com; s=arc-20160816; b=dPg0g5RxIU3Jcj5xMEP3y+kTTB5LVo1qnfFD+GyuQOn5llzPit7SvK6cM4L6DrxWiZ MdcyYhg7mtK32Jt0YR8j3bjom/d5AxYjR+3sIQTnLe4I/pV5kYpvgJMHXwOYwgll6IUf snEVz+AS666uN57zYKLObHNITjErf/pfhyX0aRO5vJNeuqVkcG6ib7hn1qIXD1fxC0S5 7H3mwAqjXXaW2Vxua7LBlY2BugAGYS0Z8MYAurOKZMnd120SqmiEc9AaF5I8w7aYtiH9 qXVh9Wi5zgFbipRiK0Wrygk+fnrONgPDwKQdcxcdVDw82PCyX2GcG4pg4EJ0RLdWK24Z V9wg== 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=UXRA4CT2ISnDc7dhmKC78KQbqt3qqTsy52pzTZI3T2c387TcTpyF0Xv+YHrCbZyja9 SUOX1k26lU3QSX3vBxobjm20eUbB23QWV2sHM4oR2b34671Oy2XNuLSBNvmvIABrXz9x DMQuYghMq5Wp8gCWMNPotVJg1cnZ80dFCAHwT7X3JwY/HzuK2EY7TXhy7a7T5TlyynBZ du9Zsq52G3DABGuswPN5D/ooFXaQ0GUxGencnTLfPJ1oubhQT0G4oHV9BwMGEPdYnLoY ZyOU83BElw3KZYM6vQpPKV9JdqSWcexfI0sWab1hvk6amnkRuHCunQmZ4cc8Uf9uWoqK T4+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@xry111.site header.s=default header.b="i/iu15Va"; 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 hv8-20020a17090760c800b007309350f2f9si1358278ejc.555.2022.08.30.04.18.06; Tue, 30 Aug 2022 04:18:32 -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="i/iu15Va"; 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 S230151AbiH3Ku2 (ORCPT + 99 others); Tue, 30 Aug 2022 06:50:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52822 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230072AbiH3KuD (ORCPT ); Tue, 30 Aug 2022 06:50:03 -0400 Received: from xry111.site (xry111.site [IPv6:2001:470:683e::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 41FFDE57 for ; Tue, 30 Aug 2022 03:49:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=xry111.site; s=default; t=1661856592; bh=YGYJfp6hCx6eH/Nfs4eCDr4R+EBIr89AN05AxFZ+kgc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=i/iu15VaVq3fWj7vxK8lMB+T7u568U+R8lUMO5NuYU84svsWy1RAaP+P3HCjCpR4A PwwA8vbo6uuAwzrFmVl63qDIdRa2d4E+WVA30ktk4H3wx4KzKjiWXm51Zk6OfoNswI HJMkEx4YO6jPOEFmkhd8utxvUG+U4pIvqD8iZ7QI= 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 4B4E6660BA; Tue, 30 Aug 2022 06:49:47 -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 v7 3/5] LoongArch: Define ELF relocation types added in v2.00 ABI Date: Tue, 30 Aug 2022 18:48:04 +0800 Message-Id: <20220830104806.128365-4-xry111@xry111.site> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220830104806.128365-1-xry111@xry111.site> References: <20220830104806.128365-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