Received: by 10.213.65.68 with SMTP id h4csp97824imn; Thu, 15 Mar 2018 18:33:19 -0700 (PDT) X-Google-Smtp-Source: AG47ELtGW/o123zu04aTJJwh74RKnnL0cKvRfKEYi1qYHNqquyxM+xRWUen0lxPInHXpekjEWbYb X-Received: by 10.99.127.91 with SMTP id p27mr21018pgn.28.1521163999487; Thu, 15 Mar 2018 18:33:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521163999; cv=none; d=google.com; s=arc-20160816; b=y2U2w3M9SkDh9X2wh0LJ9yUWoPwn2+MKglzgE1yLBsI0tloHygEXlQQ9op0BuAUMi7 Ns0deW59KujsR2hBO/+Ol6E8LDt95gAjn6GBZN+7l9hZwIzWV/9q3Dg3f68nH3+dGjLE ezeZkamDzOG4H5Y3WSboGDfPRKrPCuBmOWNOHGJsuwhUgPorxkYxEVIxXO0Ra2rrBuBP ADSEgT1rCxRyf6Tv67gpGFQ2W5NZTzRxvpbTcmh2VJ+W32xk0blauGy8RDEcB1hCVjUH 7U5XsZGicTeIpFidYp/b/1UwoyzFaxi9uJNGHABfhNuYy6seomZnpxHBNoBBrtr5A+bd VW4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=WhlTaabq4k6xWuTnod1u4sjr4ROqa2m8h+oMs/6E2rI=; b=nZlo6hmW7vU+CfnfLqd6VdxddaL2C3bmu3u9LW1CFGToloYasQR6XU/mm29YWdRBnQ bdbiuYKNdYvnLzcn+p0BlNLI4ZOf94MhQ3DTKfdFt4nK1VUVKID/yF4upYNz1NIntsWP xZzBhr0vuaUPREE29BX7yldakyWcSQWHbbBJfGUmrZrmjVBrW5fq4U8uSsFmYOalu5cO nPmOAV6EWHG3tG1RKyWMtd39myguDCFyAEdwyO7f3BMLZ69XMWx13GAWYOaSSY1O6CbS rXUKOD6mFYKSROThZ6MCiqPQhKJ+dQnFN3UOL1lLxfjIieXT0Sak9jl9rsrDaEWkDjxs 9imQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=XAPYJZMF; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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. [209.132.180.67]) by mx.google.com with ESMTP id z5-v6si4405345plo.727.2018.03.15.18.33.05; Thu, 15 Mar 2018 18:33:19 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=XAPYJZMF; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S932929AbeCPBSn (ORCPT + 99 others); Thu, 15 Mar 2018 21:18:43 -0400 Received: from mail-it0-f65.google.com ([209.85.214.65]:52473 "EHLO mail-it0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932341AbeCPBSm (ORCPT ); Thu, 15 Mar 2018 21:18:42 -0400 Received: by mail-it0-f65.google.com with SMTP id k135-v6so186872ite.2 for ; Thu, 15 Mar 2018 18:18:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=WhlTaabq4k6xWuTnod1u4sjr4ROqa2m8h+oMs/6E2rI=; b=XAPYJZMFZbY/exIxHMSr9KqAL5BUsBICIIjApEZN8i2WECQ+Pj8I5xMfYEPy8YJgIY OMzEA0NlSVuK/eIpPD+rCVTNXGwIeD89ucrcOfeYn76YotQ0cA1Ey343nM7jvgkCeSkf ZbQuQckpnnbvz61JFkoruSYVe2Ws0JxuDqFrIsYMNnUIfZnD49PYwvkmOujAqA+9bCL2 aq+KAkEoIS2rr5yOelmfSOL2pGUe2Bk3pnPfGAFt8yyYLht/mnEINpMdrFGrMFgzZ+18 9BizEXKxDiyDXdP6UNKnUqfNB3R1j7+cgTirWnOXAbdzD6FQkAvPL235br6L6wxQThw9 XNng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=WhlTaabq4k6xWuTnod1u4sjr4ROqa2m8h+oMs/6E2rI=; b=GUY0Toj5GW+SicebQlY0Q7BevZg/ZAku4vooHthCadni+GBWGYRiy4dQz+xKI3tLlZ Ri88CHL8kdNLoEN6EtRyZwe7/5kprqpUeeFLmBOlS00sT6a8k6PZ6XpUtA2l+JUR1VDi n86PiMlPvsaMEcBmnDipuZUAgrxLAp1ns5j/P/C7l1iARMU202eerCndoNOh2NSJa5dT WeZyTmpKJZQze5cXpQ3zS+/mauW6VAbMSCOzjWC0xzYTKxzmL3RmuQHINTvY7kst8+5E uSaFmSMB0lxGUZaI52dNc4LHFbY7u6q71UoS89B9+K8e3Bg8rDbzaLJ0dV0sz33QvOIF aEPA== X-Gm-Message-State: AElRT7HBPiX7Ut0QFpSdDFYoFJbko+tyedgqFn4jRsdQEj+ItuzLQf2/ +KV+L2wUV1vWy8N+h0FNrmwm9rRWYcOolJxdeUc= X-Received: by 2002:a24:58a:: with SMTP id 132-v6mr319853itl.47.1521163121730; Thu, 15 Mar 2018 18:18:41 -0700 (PDT) MIME-Version: 1.0 Received: by 10.2.69.149 with HTTP; Thu, 15 Mar 2018 18:18:41 -0700 (PDT) In-Reply-To: References: From: Zong Li Date: Fri, 16 Mar 2018 09:18:41 +0800 Message-ID: Subject: Re: [PATCH v2 00/11] RISC-V: Resolve the issue of loadable module on 64-bit To: Zong Li Cc: Palmer Dabbelt , albert@sifive.com, linux-riscv@lists.infradead.org, Linux Kernel Mailing List , greentime@andestech.com Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 2018-03-15 16:50 GMT+08:00 Zong Li : > These patches resolve the some issues of loadable module. > - symbol out of ranges > - unknown relocation types > > The reference of external variable and function symbols > cannot exceed 32-bit offset ranges in kernel module. > The module only can work on the 32-bit OS or the 64-bit > OS with sv32 virtual addressing. > > These patches will generate the .got, .got.plt and > .plt sections during loading module, let it can refer > to the symbol which locate more than 32-bit offset. > These sections depend on the relocation types: > - R_RISCV_GOT_HI20 > - R_RISCV_CALL_PLT > > These patches also support more relocation types > - R_RISCV_CALL > - R_RISCV_HI20 > - R_RISCV_LO12_I > - R_RISCV_LO12_S > - R_RISCV_RVC_BRANCH > - R_RISCV_RVC_JUMP > - R_RISCV_ALIGN > - R_RISCV_ADD32 > - R_RISCV_SUB32 > > This is the list of testing modules: > # lsmod > btrfs 7876158 0 - Live 0xffffffd00745d000 > ramoops 90806 0 - Live 0xffffffd0024b8000 > lzo 10554 0 - Live 0xffffffd002050000 > zstd_decompress 567575 1 btrfs, Live 0xffffffd00238b000 > zstd_compress 1543837 1 btrfs, Live 0xffffffd002211000 > zram 101300 0 - Live 0xffffffd0021b8000 > xxhash 62254 2 zstd_decompress,zstd_compress, Live 0xffffffd0020cf000 > xor 33246 1 btrfs, Live 0xffffffd002042000 > xfs 4395343 0 - Live 0xffffffd00399e000 > tun 252041 0 - Live 0xffffffd0038e0000 > test_user_copy 5265 0 - Live 0xffffffd003783000 > test_static_keys 19606 0 - Live 0xffffffd003717000 > test_static_key_base 7374 1 test_static_keys, Live 0xffffffd0036dc000 > test_printf 7804 0 [permanent], Live 0xffffffd00369c000 > test_module 1557 0 - Live 0xffffffd003646000 > test_kmod 49100 0 - Live 0xffffffd0035f2000 > test_bpf 1599301 0 - Live 0xffffffd003000000 > test_bitmap 4403 0 - Live 0xffffffd002dd8000 > reed_solomon 38866 1 ramoops, Live 0xffffffd002d86000 > raid6_pq 161872 1 btrfs, Live 0xffffffd002b9e000 > netdevsim 65401 0 - Live 0xffffffd002910000 > > Signed-off-by: Zong Li > --- > Change in v2: > - Add compile option 'mno-relax' for build kernel module > - Just fail on ALIGN type, this is unexpected type with mno-relax. > > Zong Li (11): > RISC-V: Add sections of PLT and GOT for kernel module > RISC-V: Add section of GOT.PLT for kernel module > RISC-V: Support GOT_HI20/CALL_PLT relocation type in kernel module > RISC-V: Support CALL relocation type in kernel module > RISC-V: Support HI20/LO12_I/LO12_S relocation type in kernel module > RISC-V: Support RVC_BRANCH/JUMP relocation type in kernel modulewq > RISC-V: Support ALIGN relocation type in kernel module > RISC-V: Support ADD32 relocation type in kernel module > RISC-V: Support SUB32 relocation type in kernel module > RISC-V: Enable module support in defconfig > RISC-V: Add definition of relocation types > > arch/riscv/Kconfig | 5 + > arch/riscv/Makefile | 5 + > arch/riscv/configs/defconfig | 2 + > arch/riscv/include/asm/module.h | 113 +++++++++++++++++++++++ > arch/riscv/include/uapi/asm/elf.h | 7 ++ > arch/riscv/kernel/Makefile | 1 + > arch/riscv/kernel/module-sections.c | 156 +++++++++++++++++++++++++++++++ > arch/riscv/kernel/module.c | 179 ++++++++++++++++++++++++++++++++++-- > arch/riscv/kernel/module.lds | 8 ++ > 9 files changed, 470 insertions(+), 6 deletions(-) > create mode 100644 arch/riscv/include/asm/module.h > create mode 100644 arch/riscv/kernel/module-sections.c > create mode 100644 arch/riscv/kernel/module.lds > > -- > 2.16.1 > Hi, The ALIGN relocation type is just fail and print the error message on v2 version, Because I think that it will not exist in module which building with 'mno-relax ' option, The behavior of check alignment will become a redundant thing. Thanks a lot.