Received: by 2002:ac0:da4c:0:0:0:0:0 with SMTP id a12csp914154imi; Thu, 21 Jul 2022 13:30:28 -0700 (PDT) X-Google-Smtp-Source: AGRyM1t9qFd9+NS081p/r+uYxaaEtHw6LLNCKiYrxJNTsRBmh2ZNP4ZhhNxIxFkWQPDbPmGcjJc6 X-Received: by 2002:a17:906:4fc5:b0:72b:9943:6f10 with SMTP id i5-20020a1709064fc500b0072b99436f10mr279991ejw.722.1658435428051; Thu, 21 Jul 2022 13:30:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658435428; cv=none; d=google.com; s=arc-20160816; b=kgs0dvVliSWuJwRUjW6WctTDRySISpinmGlN/v+OrYDRLeH0dcGzhB8gmUuxzawt3H B9Zch/guzal+JRkd8RkzVW6623B02V3Y5fxRbfguFnyQuYHGGbJ79mqo3RguuO3UbzHQ DFpY0wTBWWBpeYVSaBwLQSM3L71KQBIc+Y2PpGXSzsCSXBCkphk8aFSE1JVErZOhoYZK VBWmk5mKbDZ8+H40vZ99ylKBOJeE64/R0EWn4M26guu+3VV57rhNwKYmKW2x0e/Qv3D0 awdded774jpNjTRzmgj7x8sxViGo7R2vXKigZ6y/XIZZ1NbbziOtMR2F/ArkRRNSnKPW N4Sg== 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 :message-id:to:from:cc:in-reply-to:subject:date:dkim-signature; bh=HsT+SOh6igago54DFk+NR9EMx4G+VOnG1ZM35MOSsdM=; b=yGg238GI/rxjRvwXhB0Wnz/xxvFOxta2j+5I+SAeJ5X2kHfhz6QQk8oFGnqYH2ltks NWmReP5qYkjXTUfV0GrUWHFxL3Yr/asA4t+SPKvS70RZlP6Ez7aBp7aeRB/M5MGu+gzR y26rVQrVg9WdzG0Yixse1maNmNgbmc4sDhjt42WNr4xf/OEVIKutdjuSSzCHBC9uQcpj lm22VvfwU0LJtku/NZluO1IfCcqtgxgxDMt1GDOgaWAQ3EUsH1l2Wtd9ahlot6VHs4QG m3F04hskeAgiCuLqzKZWBs3yERbBw8vnltfhdANv/ikq7TLgzJqFFEWZgeTELUz12tw3 5bUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@dabbelt-com.20210112.gappssmtp.com header.s=20210112 header.b=dZTLC6T8; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gs16-20020a1709072d1000b007262adb2086si2969975ejc.256.2022.07.21.13.28.51; Thu, 21 Jul 2022 13:30:28 -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=@dabbelt-com.20210112.gappssmtp.com header.s=20210112 header.b=dZTLC6T8; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232440AbiGUTxX (ORCPT + 99 others); Thu, 21 Jul 2022 15:53:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32862 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229479AbiGUTxS (ORCPT ); Thu, 21 Jul 2022 15:53:18 -0400 Received: from mail-pj1-x102c.google.com (mail-pj1-x102c.google.com [IPv6:2607:f8b0:4864:20::102c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DA7D168DFD for ; Thu, 21 Jul 2022 12:53:17 -0700 (PDT) Received: by mail-pj1-x102c.google.com with SMTP id p6-20020a17090a680600b001f2267a1c84so4583566pjj.5 for ; Thu, 21 Jul 2022 12:53:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dabbelt-com.20210112.gappssmtp.com; s=20210112; h=date:subject:in-reply-to:cc:from:to:message-id:mime-version :content-transfer-encoding; bh=HsT+SOh6igago54DFk+NR9EMx4G+VOnG1ZM35MOSsdM=; b=dZTLC6T8LQqP4RfUYojYXtJS1ACmXZjhKUovfox5ilqKM1trs1sF+9KGWw1NvyVbe4 Ofm2D9OdwPyNEUdwXZf759WKjMIUbrEb38lzG35mELnSYt05VK4QEdVbHD1pGmfRELQN 79gmUrFhlT6i0QSApljrs03dmnOawpgRtgHJyhhmxaVJCN4AVP0pPvOB1EGxNzkTotBA GFD4j9kFP13RmHkmQwxHz0b4saNNjcM6b6YCSD0MLPyqhv9rWOoJWM+7gmWalUulBsAf EfLt03YQjJxc04E4Klm2fRFBGb+8f1PMJxf6Gv4aEDc5r/qRnPXyZn1M6syjTZ8MDjv1 cUVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:subject:in-reply-to:cc:from:to:message-id :mime-version:content-transfer-encoding; bh=HsT+SOh6igago54DFk+NR9EMx4G+VOnG1ZM35MOSsdM=; b=6DuxocjLAuX5Y0BS8CHZuQMpBhG4F5Z+ugESgifdZOBCis13jZQU9/uFd+pIlvBAEw YNQ1fXT/WWOPktKcdeLkR1xR964AIHimC0YaZRV6Bu46OUgR1sWyz7icUh7KWmkSnzFZ sfWBLO3Jt9DtCszMA2mNtAgZ38dtodpNzaqQhDS3eOBwPrv0d0CdGDOW04reDhn6lqsE kvKZGB0VhMxRRSqrE2vBvCzhRYJCd/+/8dip1Cwl8Z7AIyec5MaH6mIylTZ5NB4QmedC 6Mu6sLBZ0vtgd8viJpMRfYc9hPdV1a7t+OZsip3ymEC+aEXxYapwlChDKFwGu2jba5RG foyg== X-Gm-Message-State: AJIora9RMjD7+IJnfOuwvfifXH33hGOf4eIunvtDkBv45W/CWVTFow5n nuHXRBou4aZW96jmjxX7vq22Qw== X-Received: by 2002:a17:902:cece:b0:16c:3683:8835 with SMTP id d14-20020a170902cece00b0016c36838835mr45821418plg.104.1658433197228; Thu, 21 Jul 2022 12:53:17 -0700 (PDT) Received: from localhost (76-210-143-223.lightspeed.sntcca.sbcglobal.net. [76.210.143.223]) by smtp.gmail.com with ESMTPSA id x2-20020a634a02000000b0040ced958e8fsm1884826pga.80.2022.07.21.12.53.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Jul 2022 12:53:16 -0700 (PDT) Date: Thu, 21 Jul 2022 12:53:16 -0700 (PDT) X-Google-Original-Date: Thu, 21 Jul 2022 12:53:14 PDT (-0700) Subject: Re: [PATCH] [PATCH v2] riscv: add as-options for modules with assembly compontents In-Reply-To: <20220529152200.609809-1-ben.dooks@codethink.co.uk> CC: linux-kernel@lists.codethink.co.uk, linux-riscv@lists.infradead.org, aou@eecs.berkeley.edu, linux-kernel@vger.kernel.org, ben.dooks@codethink.co.uk, Bin Meng From: Palmer Dabbelt To: ben.dooks@codethink.co.uk Message-ID: Mime-Version: 1.0 (MHng) Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham 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 On Sun, 29 May 2022 08:22:00 PDT (-0700), ben.dooks@codethink.co.uk wrote: > When trying to load modules built for RISC-V which include assembly files > the kernel loader errors with "unexpected relocation type 'R_RISCV_ALIGN'" > due to R_RISCV_ALIGN relocations being generated by the assembler. > > The R_RISCV_ALIGN relocations can be removed at the expense of code space > by adding -mno-relax to gcc and as. In commit 7a8e7da42250138 > ("RISC-V: Fixes to module loading") -mno-relax is added to the build > variable KBUILD_CFLAGS_MODULE. See [1] for more info. > > The issue is that when kbuild builds a .S file, it invokes gcc with > the -mno-relax flag, but this is not being passed through to the > assembler. Adding -Wa,-mno-relax to KBUILD_AFLAGS_MODULE ensures that > the assembler is invoked correctly. This may have now been fixed in > gcc[2] and this addition should not stop newer gcc and as from working. > > [1] https://github.com/riscv/riscv-elf-psabi-doc/issues/183 > [2] https://github.com/gcc-mirror/gcc/commit/3b0a7d624e64eeb81e4d5e8c62c46d86ef521857 > > Notes: > > Signed-off-by: Ben Dooks > Reviewed-by: Bin Meng > --- > arch/riscv/Makefile | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/arch/riscv/Makefile b/arch/riscv/Makefile > index 1f5c03082976..fca40511a8c6 100644 > --- a/arch/riscv/Makefile > +++ b/arch/riscv/Makefile > @@ -60,6 +60,7 @@ ifeq ($(CONFIG_PERF_EVENTS),y) > endif > > KBUILD_CFLAGS_MODULE += $(call cc-option,-mno-relax) > +KBUILD_AFLAGS_MODULE += $(call as-option,-Wa$(comma)-mno-relax) > > # GCC versions that support the "-mstrict-align" option default to allowing > # unaligned accesses. While unaligned accesses are explicitly allowed in the Sorry for being so slow here, I've gotten pretty buried and it wasn't clear this was a fix. I put it in fixes with some tags. Thanks!