Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp17603559rwd; Tue, 27 Jun 2023 05:28:46 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7Qjgzm2H3+E9dJ4q3B8JymQ9eSyVB4fH4MTaRJ4V/A1LJLnkABtsJYXtRhYdPwqNOdSM8P X-Received: by 2002:a17:902:c702:b0:1b5:2ae4:9c7d with SMTP id p2-20020a170902c70200b001b52ae49c7dmr9358003plp.38.1687868925799; Tue, 27 Jun 2023 05:28:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687868925; cv=none; d=google.com; s=arc-20160816; b=nvsDyAe/gw4TQZ20WtCUqAEHXzVqnDwUnL29BL8C1UU0OhfvqF74mW47bulzIHEm6D 8nUO7tsnvMsjOdjx1zusw6UlwKSby0aUnO/65kSHpckHW8OS0mqV2m9eWn44jvCtXhFZ HcFFNsQ4gZrtY2pFktfrbNxx7tMNeN95ebcRlPDM2ufxmKM1G0K2GxFavdaEJVCRcGWi scbvM0er1s0jVnwpaRlt9loYwBUsiCtFj8Co5+x+J9naaTMQP0ibeEsvST3giQkYq/5l rgBRD8hVhOv6Pkz3a6LFgw4hjEQD1rgLCkQDJA33FZvzLr9N16uuPfkttbU+kL8jY8XM X+Sw== 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:date:subject:cc:to:from; bh=HdQsysw8djekhSB7mMHd2Qo1LE0edP+kUP/cf75Rk4U=; fh=u9g/gYS4E4ms0Ifj8A/hbCnk3ho+XOV11c5cF0ZP9N0=; b=OGtdQzzQCY83SHOI5MjfmWwPzcdXr4wVmTkovKHeIjkr7Fczmz0+juhOCBxmUw7dlm 5iG+ygqmt1h4R8aIr6ItRBwU+vHwc7j+pZqG2lJQ0cbEvJQ1ekSHPoFyIUzMPbeLD88r 1zCC8P/vgulhy/0OKEcAK3MYLdnuFJ49rSE0cJMMi35h6cNLRt1jc8gAMJRI07PpwH0J shTEcYEkU7hGdJpMJDdqHgaOrjcBicZi+wdNKf30XhjpB1AXzldTjNKUvIKE/30T2dbr X348vOkpLn6BeVgBPajT1PrFTeLPun/RPxYZDI5IsEOuACEC2csMtvOTJ6cHqP0gBWSq 6/Ng== ARC-Authentication-Results: i=1; mx.google.com; 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 i9-20020a170902c94900b001b5168bd8e9si7358233pla.536.2023.06.27.05.28.33; Tue, 27 Jun 2023 05:28:45 -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; 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 S230030AbjF0MPW (ORCPT + 99 others); Tue, 27 Jun 2023 08:15:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38318 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229629AbjF0MPU (ORCPT ); Tue, 27 Jun 2023 08:15:20 -0400 Received: from mail.loongson.cn (mail.loongson.cn [114.242.206.163]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 3973819A8; Tue, 27 Jun 2023 05:15:17 -0700 (PDT) Received: from loongson.cn (unknown [117.81.87.34]) by gateway (Coremail) with SMTP id _____8CxpMTT0ppk8BYDAA--.4879S3; Tue, 27 Jun 2023 20:15:15 +0800 (CST) Received: from localhost.localdomain (unknown [117.81.87.34]) by localhost.localdomain (Coremail) with SMTP id AQAAf8Bx3yO60ppkXxIMAA--.8320S2; Tue, 27 Jun 2023 20:15:14 +0800 (CST) From: WANG Rui To: Miguel Ojeda , Alex Gaynor , Wedson Almeida Filho , Boqun Feng , Gary Guo , =?UTF-8?q?Bj=C3=B6rn=20Roy=20Baron?= , Benno Lossin , Nathan Chancellor , Nick Desaulniers , Tom Rix Cc: rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev, WANG Rui Subject: [PATCH] rust: build: Define MODULE macro iif the CONFIG_MODULES is enabled Date: Tue, 27 Jun 2023 20:14:22 +0800 Message-ID: <20230627121422.112246-1-wangrui@loongson.cn> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: AQAAf8Bx3yO60ppkXxIMAA--.8320S2 X-CM-SenderInfo: pzdqw2txl6z05rqj20fqof0/ X-Coremail-Antispam: 1Uk129KBj93XoW7tFWDKFyfuw1xtF13Ww4DAwc_yoW8Gw1fpF 97W3W8Ka15GF4DtFW8Ary5WF12q34UJ34Dua1DX3y2qFZxJ3sxK3yftFZagrW7ZF4xX34F qFs7uayaga4UCwbCm3ZEXasCq-sJn29KB7ZKAUJUUUUx529EdanIXcx71UUUUU7KY7ZEXa sCq-sGcSsGvfJ3Ic02F40EFcxC0VAKzVAqx4xG6I80ebIjqfuFe4nvWSU5nxnvy29KBjDU 0xBIdaVrnRJUUUB2b4IE77IF4wAFF20E14v26r1j6r4UM7CY07I20VC2zVCF04k26cxKx2 IYs7xG6rWj6s0DM7CIcVAFz4kK6r106r15M28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48v e4kI8wA2z4x0Y4vE2Ix0cI8IcVAFwI0_JFI_Gr1l84ACjcxK6xIIjxv20xvEc7CjxVAFwI 0_Gr0_Cr1l84ACjcxK6I8E87Iv67AKxVW8Jr0_Cr1UM28EF7xvwVC2z280aVCY1x0267AK xVW8Jr0_Cr1UM2kKe7AKxVWUAVWUtwAS0I0E0xvYzxvE52x082IY62kv0487Mc804VCY07 AIYIkI8VC2zVCFFI0UMc02F40EFcxC0VAKzVAqx4xG6I80ewAv7VC0I7IYx2IY67AKxVWU AVWUtwAv7VC2z280aVAFwI0_Jr0_Gr1lOx8S6xCaFVCjc4AY6r1j6r4UM4x0Y48IcxkI7V AKI48JMxkF7I0En4kS14v26r126r1DMxAIw28IcxkI7VAKI48JMxC20s026xCaFVCjc4AY 6r1j6r4UMxCIbckI1I0E14v26r126r1DMI8I3I0E5I8CrVAFwI0_Jr0_Jr4lx2IqxVCjr7 xvwVAFwI0_JrI_JrWlx4CE17CEb7AF67AKxVWUtVW8ZwCIc40Y0x0EwIxGrwCI42IY6xII jxv20xvE14v26r1I6r4UMIIF0xvE2Ix0cI8IcVCY1x0267AKxVWUJVW8JwCI42IY6xAIw2 0EY4v20xvaj40_Jr0_JF4lIxAIcVC2z280aVAFwI0_Jr0_Gr1lIxAIcVC2z280aVCY1x02 67AKxVWUJVW8JbIYCTnIWIevJa73UjIFyTuYvjxU2txhDUUUU X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE 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 The LoongArch does not currently support modules when built with clang. A pre-processor error is expected on building modules, that's caused by: #if defined(MODULE) && defined(CONFIG_AS_HAS_EXPLICIT_RELOCS) # if __has_attribute(model) # define PER_CPU_ATTRIBUTES __attribute__((model("extreme"))) # else # error compiler support for the model attribute is necessary when a recent assembler is used # endif #endif This also happens with bindgen too, so it would be better to define MODULE macro if and only if the CONFIG_MODULES is enabled. Signed-off-by: WANG Rui --- rust/Makefile | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/rust/Makefile b/rust/Makefile index fc8cdcfcc9e5..d31d9fa27ef0 100644 --- a/rust/Makefile +++ b/rust/Makefile @@ -295,12 +295,16 @@ endif bindgen_c_flags_final = $(bindgen_c_flags_lto) -D__BINDGEN__ +ifdef CONFIG_MODULES +bindgen_c_flags_final += -DMODULE +endif + quiet_cmd_bindgen = BINDGEN $@ cmd_bindgen = \ $(BINDGEN) $< $(bindgen_target_flags) \ --use-core --with-derive-default --ctypes-prefix core::ffi --no-layout-tests \ --no-debug '.*' \ - -o $@ -- $(bindgen_c_flags_final) -DMODULE \ + -o $@ -- $(bindgen_c_flags_final) \ $(bindgen_target_cflags) $(bindgen_target_extra) $(obj)/bindings/bindings_generated.rs: private bindgen_target_flags = \ -- 2.41.0