Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1154472ybt; Wed, 8 Jul 2020 23:22:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwmd9rRr0ALCSTMLXkuU9swJeg/90tZ0ewSRf06u4JrHOiZ9/CpR9CFKaTv1pKo2HECQC88 X-Received: by 2002:a17:906:a156:: with SMTP id bu22mr53654841ejb.322.1594275766188; Wed, 08 Jul 2020 23:22:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594275766; cv=none; d=google.com; s=arc-20160816; b=jckTO3HnAqaA1fqCtT5wMWgTC0JFrfM97Vwh+4h0nLBlQqnCi/QwwjeQNuJTbCqMz/ 4x906B+RQpeARg3PFehFLzxioLu+HTG9LFLMiSfptbAVwHifauvNmh8qzLmozYbt1lSV zuKwnFKrd7VSvKKBOr5MjkC5OtYNmAp2q1Ca3TQCj0bEOxYPSup69+u67PHsGZlOIVPh 4h8CELb5G/+W/TfsAqyw3D1pv2NF3rx1kbnyAr3hhbEwZOjC5r2VweHoGpg3/pTcYEvy tFeU1GMpptYvN1P/7n1YqwsL5S70a/TC0cy6BcUZheoh7lA5rb/BSJDD72LPa6YRhBAV G/WQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=gFF6cRXPZWxd7Qpi0omO8g63vjK0Tifq+qnvPaoGQN4=; b=j13QAB+u1/HHXKi1wCyoxzVv19aaylPVwtKGTZv8GzMSNefP6QFysrS3NS45RgpMvp g3TtdKRhFMzaB4bV6HPet7xLoEHgR4P9Qk0Cg0gwC9geTCvez3mn+NztxnlQn+rseG48 HCTwY9hzvVF06t//SzHG/CL1UQSLggR0Ln+pUYNYMS49FGNDbA0OgiLWArGtABfgsr8E ABGgDAww1L6aVH78VqcktqopHIwUzXnsfq+/Nsxl8DPTX2zon11jNqHdJp/OQFURjUGg q8JdaP4/d5t8b6hEHqWc0N8TqCm1P5nuRy/7Nlu20HOaGo75Vf3H+K7p/X21WUvw+xon 9aTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=EFYPCKMh; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l16si1228766edw.377.2020.07.08.23.22.23; Wed, 08 Jul 2020 23:22:46 -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=@gmail.com header.s=20161025 header.b=EFYPCKMh; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726184AbgGIGWT (ORCPT + 99 others); Thu, 9 Jul 2020 02:22:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56084 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726064AbgGIGWQ (ORCPT ); Thu, 9 Jul 2020 02:22:16 -0400 Received: from mail-wm1-x342.google.com (mail-wm1-x342.google.com [IPv6:2a00:1450:4864:20::342]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 23D47C061A0B; Wed, 8 Jul 2020 23:22:16 -0700 (PDT) Received: by mail-wm1-x342.google.com with SMTP id j18so610014wmi.3; Wed, 08 Jul 2020 23:22:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=gFF6cRXPZWxd7Qpi0omO8g63vjK0Tifq+qnvPaoGQN4=; b=EFYPCKMh/gdOpn8FHMjdfuEIXN6C/VRooCUlnoWy59ORywMooLDtxp+BS7BoIgt0G1 jmrm8e7JcbBuj9cZR3MvdgZ/nonjZvh7ddEjA+S3wAUi26hnRbCuN/ez9fiSlVKAUem7 Zj9KcE3DNCGeJImAGqdqCrHddS3WRSYPSauF1ZZKRzkXUJcJb9PqZEVdSCu8GamZHjB9 GRjHrTD5x1gTsftRjSH6nFTSc9cG3ue/tbdj4cd6RH6yMlWiZ18gsHMbqf2/EWid4yXC 2JJS6ueLMq/w2U/VS0fjhIB22AHdpqALU1/hRFInm7PLwzxS5UczZg+/OyavlaGG9DnR Op8g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=gFF6cRXPZWxd7Qpi0omO8g63vjK0Tifq+qnvPaoGQN4=; b=WmTqbLVqGnATT2XyysMmxpJi6Q7eA0XoYj14kQaXFFpJcayiw9d0KFBwpk8JnyqbBP XInv2rPGOV+Ccd0tj7tw+S2UO6k7ByYBbAqy3FPRkmIADPanN/P+cdtMIvSfbezXUR3/ R75seEYeZTUj4QrhnORbHI6NgU1Oj7b25/y31kEGBnQa4NGohDebOt3Kbr0MQC7whlMt O8JDtdLS8w9BfMZ/t+rwGoXIPzjsNgugagZshkdC+G9LSUyEr5jhiuFLJXJ9aMMZhzug 8Ly3/JWP5ditjLrj3qMv0UaGxGj8UIm5Cr4KgtRG5U6/8hl3Jo0Hgl2Wuna8j64dSsIV zS5w== X-Gm-Message-State: AOAM531vsHXvLnasqlhct/ss+ZSk6QdTgz6EAz7M9GwKwoUopG0w1YA9 BFa2CZdvjj+thdzN/KNA2oXFyOIrnkb4fv3K/+8= X-Received: by 2002:a1c:cc12:: with SMTP id h18mr13313090wmb.56.1594275734854; Wed, 08 Jul 2020 23:22:14 -0700 (PDT) MIME-Version: 1.0 References: <20200708210948.34197-1-kernel@esmil.dk> In-Reply-To: <20200708210948.34197-1-kernel@esmil.dk> From: =?UTF-8?B?QmrDtnJuIFTDtnBlbA==?= Date: Thu, 9 Jul 2020 08:22:03 +0200 Message-ID: Subject: Re: [PATCH v2 1/2] riscv: Support R_RISCV_ADD64 and R_RISCV_SUB64 relocs To: Emil Renner Berthing Cc: linux-riscv , Palmer Dabbelt , Paul Walmsley , Jonathan Corbet , linux-doc@vger.kernel.org, LKML Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 8 Jul 2020 at 23:10, Emil Renner Berthing wrote: > > These are needed for the __jump_table in modules using > static keys/jump-labels with the layout from > HAVE_ARCH_JUMP_LABEL_RELATIVE on 64bit kernels. > > Signed-off-by: Emil Renner Berthing Reviewed-by: Bj=C3=B6rn T=C3=B6pel Tested-by: Bj=C3=B6rn T=C3=B6pel > --- > > Tested on the HiFive Unleashed board. > > This patch is new in v2. It fixes an error loading modules > containing static keys found by Bj=C3=B6rn T=C3=B6pel. > > arch/riscv/kernel/module.c | 16 ++++++++++++++++ > 1 file changed, 16 insertions(+) > > diff --git a/arch/riscv/kernel/module.c b/arch/riscv/kernel/module.c > index 7191342c54da..104fba889cf7 100644 > --- a/arch/riscv/kernel/module.c > +++ b/arch/riscv/kernel/module.c > @@ -263,6 +263,13 @@ static int apply_r_riscv_add32_rela(struct module *m= e, u32 *location, > return 0; > } > > +static int apply_r_riscv_add64_rela(struct module *me, u32 *location, > + Elf_Addr v) > +{ > + *(u64 *)location +=3D (u64)v; > + return 0; > +} > + > static int apply_r_riscv_sub32_rela(struct module *me, u32 *location, > Elf_Addr v) > { > @@ -270,6 +277,13 @@ static int apply_r_riscv_sub32_rela(struct module *m= e, u32 *location, > return 0; > } > > +static int apply_r_riscv_sub64_rela(struct module *me, u32 *location, > + Elf_Addr v) > +{ > + *(u64 *)location -=3D (u64)v; > + return 0; > +} > + > static int (*reloc_handlers_rela[]) (struct module *me, u32 *location, > Elf_Addr v) =3D { > [R_RISCV_32] =3D apply_r_riscv_32_rela, > @@ -290,7 +304,9 @@ static int (*reloc_handlers_rela[]) (struct module *m= e, u32 *location, > [R_RISCV_RELAX] =3D apply_r_riscv_relax_rela, > [R_RISCV_ALIGN] =3D apply_r_riscv_align_rela, > [R_RISCV_ADD32] =3D apply_r_riscv_add32_rela, > + [R_RISCV_ADD64] =3D apply_r_riscv_add64_rela, > [R_RISCV_SUB32] =3D apply_r_riscv_sub32_rela, > + [R_RISCV_SUB64] =3D apply_r_riscv_sub64_rela, > }; > > int apply_relocate_add(Elf_Shdr *sechdrs, const char *strtab, > -- > 2.27.0 >