From patchwork Mon Jul 12 01:20:16 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 1503747 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=opensbi-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=4m2cQiqU; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=brERDmzJ; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4GNQtn1Nmmz9sRN for ; Mon, 12 Jul 2021 11:20:33 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=KotuyZFOttSWA9NAGLGBtkNod6pxPK/iGLVm/1/LGRE=; b=4m2cQiqU9vvCe5 hU+7zZWVra5xGei0UTcW0UWRmfHCRMdO2uo6ZDE+1QQu0biMKYHRNZrrpodsDbc1FDdd8KVJNY0sQ hAoMXc0c+PIhkel8i1lCDVmm8p22i3AqYg01QyIQecfQPYqjyHQb6z5eDywDgQYshUr/94XVeQFxG ItWL6riC6vcDobycDzwh80Vl0Uxb9Z+x0m0KgplnKLwqcGjFJgPYfBGI229VepMle+SAWIjw9rBkv diH+8DRx4r8S5CNh+rBWa0wP+DxHgZdMvP1m19OkcK4c9liKH4qiUdsVicyFr4sL4GirZSOvTRD4U 1tXgQFh4hhF4XuPD1/BA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1m2kcV-005g6y-UV; Mon, 12 Jul 2021 01:20:27 +0000 Received: from mail-pl1-x632.google.com ([2607:f8b0:4864:20::632]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1m2kcT-005g6c-2z for opensbi@lists.infradead.org; Mon, 12 Jul 2021 01:20:26 +0000 Received: by mail-pl1-x632.google.com with SMTP id z2so5382643plg.8 for ; Sun, 11 Jul 2021 18:20:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=2NSbS6o1ICJw+Ep9/t20ycWrt+9xk3Ubnmc7fTZ+bvQ=; b=brERDmzJut9dj3IZtR0jrWxIEd1vocGkcjI8K0WilXOxnD03eUoNtOryAxhQkP6A1c kOQC7AyUR1f+pT7Cqi4Zxec9Our8mg7V7DX1wEJdh5U6eV3wrl0u98KNODrbwoImUMz7 aQJT7lsyyyr+gF0ZHRLnIwn7OAEJguKHjImdr8Fnp2kkpQnBoerTNldtv1UPqw1sqdcb 0f/6NsKijgRTw0NktpVVnJ+TxMeAhRg6ElOmzK120JkCPLduDL1J/tJHg4SG16YD3NB0 dfUu7seexlwi7W0lGp6uULFE3DopKh9UmxQUj0/pIcoRkYMFNbl27aaeQQvT9Ke6P4tj rywQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=2NSbS6o1ICJw+Ep9/t20ycWrt+9xk3Ubnmc7fTZ+bvQ=; b=QXGUTAni+yMIo3D0qJdC3KGbgfec7RQ1NVhV7Qz55BC3iAv0K1dblJs+r1bhCMTr7/ sfatmFOqzTvr/NXoqcJO9Yv2ypBU3Py4hZ1ohiKLf/bH0J2RHQXgJ2jvOMZ/bgv7vOU/ HyjZVoVaoA4CNlXtPm/CDiLDgEJTAmPKPfbWpO68b1c6NumS2bt4hMtaX0wgr4/jksAt FVXI1e4b1A4a71ENq6yEvsch/JVMpjD6f975nyJHPuZn4+OOcSPByNKfP59FbkKjQ+WL pcyr2hUy6ihG1dn5OZisRfsdyZzmO7WB9jf+Cq4nkR52L3+lRoOgSgBEWCltrYWm8mSx pbYg== X-Gm-Message-State: AOAM531dKbE23yBUii2sleJY8Kzg6XiOpf9Fh7lc1Xhq+5pkDFslkme9 ZgvkjpS4jG564X7Ipt8LTHI= X-Google-Smtp-Source: ABdhPJySpBkkM2z1OpoQRBUNAPGVYBus9O8VcMow+lNMZq6iGqWAFOUGBswcYGuPOHkN6WtFyPcK/Q== X-Received: by 2002:a17:902:dace:b029:129:5259:95c7 with SMTP id q14-20020a170902daceb0290129525995c7mr41080135plx.60.1626052823974; Sun, 11 Jul 2021 18:20:23 -0700 (PDT) Received: from i9-aorus-gtx1080.localdomain (144.168.56.201.16clouds.com. [144.168.56.201]) by smtp.gmail.com with ESMTPSA id h30sm13382217pfr.191.2021.07.11.18.20.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Jul 2021 18:20:23 -0700 (PDT) From: Bin Meng To: Anup Patel , opensbi@lists.infradead.org Cc: Bin Meng Subject: [PATCH v3] README: Update toolchain information Date: Mon, 12 Jul 2021 09:20:16 +0800 Message-Id: <20210712012016.29362-1-bmeng.cn@gmail.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210711_182025_177809_8C97A1D8 X-CRM114-Status: GOOD ( 14.23 ) X-Spam-Score: -0.2 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Recent FW_PIC=y changes actually require toolchains with PIE support and it is on by default. Existing doc uses a GNU bare-metal toolchain as examples but it does not support PIE. Replace references of bare-metal toolchain prefix with Linux toolchain prefix everywhere in documentation. Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:632 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [bmeng.cn[at]gmail.com] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-BeenThere: opensbi@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "opensbi" Errors-To: opensbi-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Recent FW_PIC=y changes actually require toolchains with PIE support and it is on by default. Existing doc uses a GNU bare-metal toolchain as examples but it does not support PIE. Replace references of bare-metal toolchain prefix with Linux toolchain prefix everywhere in documentation. Also indicate that "riscv64-unknown-freebsd-" as an alternative to "riscv64-linux-" GNU toolchain. Signed-off-by: Bin Meng Reviewed-by: Anup Patel --- Changes in v3: - Use "riscv*-linux-gnu-" intead of "riscv*-linux" Changes in v2: - Include "riscv64-unknown-freebsd-" as an alternative README.md | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index b296f00..9fdf097 100644 --- a/README.md +++ b/README.md @@ -104,6 +104,14 @@ LLVM/Clang toolchain due to LLVM's ability to support multiple backends in the same binary, so is often an easy way to obtain a working cross-compilation toolchain. +Basically, we prefer toolchains with Position Independent Executable (PIE) +support like *riscv64-linux-gnu-gcc*, *riscv64-unknown-freebsd-gcc*, or +*Clang/LLVM* as they generate PIE firmware images that can run at arbitrary +address with appropriate alignment. If a bare-metal GNU toolchain (e.g. +*riscv64-unknown-elf-gcc*) is used, static linked firmware images are +generated instead. *Clang/LLVM* can still generate PIE images if a bare-metal +triple is used (e.g. *-target riscv64-unknown-elf*). + Please note that only a 64-bit version of the toolchain is available in the Bootlin toolchain repository for now. @@ -116,7 +124,7 @@ architecture than RISC-V. For cross-compiling, the environment variable *CROSS_COMPILE* must be defined to specify the name prefix of the RISC-V compiler toolchain executables, e.g. -*riscv64-unknown-elf-* if the gcc executable used is *riscv64-unknown-elf-gcc*. +*riscv64-linux-gnu-* if the gcc executable used is *riscv64-linux-gnu-gcc*. To build *libsbi.a* simply execute: ``` @@ -192,16 +200,16 @@ Building 32-bit / 64-bit OpenSBI Images --------------------------------------- By default, building OpenSBI generates 32-bit or 64-bit images based on the supplied RISC-V cross-compile toolchain. For example if *CROSS_COMPILE* is set -to *riscv64-unknown-elf-*, 64-bit OpenSBI images will be generated. If building +to *riscv64-linux-gnu-*, 64-bit OpenSBI images will be generated. If building 32-bit OpenSBI images, *CROSS_COMPILE* should be set to a toolchain that is -pre-configured to generate 32-bit RISC-V codes, like *riscv32-unknown-elf-*. +pre-configured to generate 32-bit RISC-V codes, like *riscv32-linux-gnu-*. However it's possible to explicitly specify the image bits we want to build with a given RISC-V toolchain. This can be done by setting the environment variable *PLATFORM_RISCV_XLEN* to the desired width, for example: ``` -export CROSS_COMPILE=riscv64-unknown-elf- +export CROSS_COMPILE=riscv64-linux-gnu- export PLATFORM_RISCV_XLEN=32 ``` @@ -235,7 +243,7 @@ valid triple. These can also be mixed; for example using a GCC cross-compiler but LLVM binutils would be: ``` -make CC=riscv64-unknown-elf-gcc LLVM=1 +make CC=riscv64-linux-gnu-gcc LLVM=1 ``` These variables must be passed for all the make invocations described in this